An example of this is the TRACE390 program in CBT182. It also cannot issue EX against branch instructions otherwise it would lose control, so they must be emulated.
Robert Ngan CSC Financial Services Group |------------> | From: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |robin <[email protected]> | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | To: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |[email protected] | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Date: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |2010/07/14 20:27 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Subject: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Re: z Linux assembler relative or friend or foe? | >--------------------------------------------------------------------------------------------------------------------------------------------------| From: Tom Marchant <[email protected]> To: [email protected] <[email protected]> Date: Thursday, 15 July 2010 2:26 >On Wed, 14 Jul 2010 09:01:43 -0500, Paul Raulerson wrote: > >>On Jul 13, 2010, at 11:24 AM, Tom Marchant wrote: >>> >>> Are you saying that the Linux kernel scans all executable >>> code looking for particular instructions? Or that it interpretively >>> executes them? Neither of these would be "trivial," IMO. >> >>It does if you tell it to, which is why I said it was trivial. The >underlying complexity >>is not relevant if you only intend to use it. >>> >>> Or is there some other mechanism that Linux uses to prohibit >>> the execution of ordinary instructions that are neither privileged >>> nor semi-privileged? >>> >> >>Yes, and it it is commonly exhibited in the ptrace() libraries. >>.... As I said, >>doing that will incur an execution hit, but not nearly as much >>as one might think. >> >>Simply blocking the execution of an instruction is not an >>intensive process. > >I see. There is a big difference between being able to trace the >execution of a program and using the trace mechanism routinely to >run every program. That is what would be needed if there was a >desire to prohibit the use of non-privileged instructions. There >would be a very high CPU overhead in doing that. At least >an order of magnitude, and probably a lot higher due to cache >miss effects. It's possible in the s/390 architecture to trap (inhibit) non-priveleged instructions, using EX to execute every instruction [except, of course, EX itself]. The overheads are not "an order of magnitude", but are not trivial either. We did this [use EX to execute programs] in a load-and-go assembler that provided run-time diagnostic support.
