Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!samsung!usc!nic.csu.net!csun!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Newsgroups: comp.unix.internals Subject: Re: Loading and Executing Object Code at Runtime Message-ID: <1991Feb16.213056.2632@kithrup.COM> Date: 16 Feb 91 21:30:56 GMT References: <6073@auspex.auspex.com> <1991Feb16.100946.601@kithrup.COM> <1991Feb16.163527.25147@virtech.uucp> Organization: Kithrup Enterprises, Ltd. Lines: 22 In article <1991Feb16.163527.25147@virtech.uucp> cpcahil@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@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.