Executing data on a vax (minting new procedures)
thorinn at diku.UUCP
thorinn at diku.UUCP
Fri Apr 4 11:31:12 AEST 1986
In article <802 at ttrdc.UUCP> levy at ttrdc.UUCP writes:
>>The person who started this discussion was already able to create code
>>in the .data space; whether it's done by the loader or at run-time by
>>the program is irrelevant. The question is whether it's possible to
>>_execute_ such a function. On a vax, you can.
But you have to take care here; I quote from the "VAX-11 Architecture
Reference Manual", 20 May 1982, Revision 6.1, page 2-20:
2.7 SEPARATION OF PROCEDURE AND DATA
The VAX-11 architecture encourages (and provides the mechanisms to
facilitate) separation of procedure (instructions) and writable data.
Procedures may not write data which is to be subsequently executed as an
instruction without an intervening REI instruction being executed (See
Chapter 6) or an intervening context switch occurring (See Chapter 7).
If no REI or context switch occurs between a procedure writing data as
instructions to be executed, and those instructions being executed, the
instructions executed are UNPREDICTABLE.
The pretty sentiments apart, I suppose DEC want their hands free to use
a separate I-cache without monitoring data writes. Come to think of it, even
a simple pre-fetch approach could be compromised by the PDP-11 practice of
using the immediate operand of an instruction as a data cell; eg. various
RT-11 device drivers: "INC XXINIT, ... , TST (PC)+, XXINIT: .WORD 0"
(According to section 8.3, "CACHE" (ibid.), the architecture guarantees
consistent *data* behaviour even when faced with multiple processors and
I/O devices. The above eliminates these headaches as well for the I-cache.)
However, a cheap system call (eg. getpid() for UNIX) should eliminate this
problem in the context of constructing new procedures.
--
Lars Mathiesen, DIKU, U. of Copenhagen, Denmark ..mcvax!diku!thorinn
More information about the Comp.unix.wizards
mailing list