Loading and Executing Object Code at Runtime

Sean Eric Fagan sef at kithrup.COM
Sun Feb 17 08:30:56 AEST 1991


In article <1991Feb16.163527.25147 at virtech.uucp> cpcahil at virtech.uucp (Conor P. Cahill) writes:
>	(*funcp)(test);

This is, if you will pardon the hand waving, "different."  This is an idiom
the compiler knows about, and it spits out the correct code.  Specifically,
it spits out code that uses cs, not ds.  On the '386, not matter how hard
you try, you cannot execute something in a writable segment!  The execute
bit and the writable bit are mutually exclusive (and if I had my '386 book
here, I'd remember why; I think they are the same bit or something weird
like that).  *However*:  you *can* alias two or more segments, and use
segment prefixes.  But unless you've done that, you cannot execute out of
your data space.

Fortunately (or otherwise), all '386 unices I've seen (except for '386
xenix) have a nice, flat address space, even though there are still two
segments.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef at kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.



More information about the Comp.unix.internals mailing list