Changing a data segment to a code segment in OS/2

Tamura Jones TAMURA at HLERUL5.BITNET
Thu Oct 13 19:50:00 AEST 1988


> SUBJECT: Changing data segment to code segment in OS/2
> In article <993 at tiger.oxy.edu> bagpiper at oxy.edu (Michael Paul Hunter) writes:
> >I thought that I had heard that their was a privileged routine that could
> >convert a section of memory from the 'data' type to the 'code' type?  I
> >think I heard about this in an interview with [forgot his name but he was
> >the chief architect for OS/2 and wrote a book...] in which he talked about
> >this routine...?!
>
> The answer is yes: OS/2 (which is, incidentally, not a compiler) does
> indeed have as part of its design a system call that changes the tag
> associated with a region.  Presumably, when a region is changed from
> data to code, it is made read-only and any caches in the CPU are
> flushed if necessary, and so forth.  Obviously a machine with such a
> system call will have trouble with multiser protection mechanisms that
> are not enforced by hardware.

The routine is NOT priviliged.
The routine does NOT change a data to a code segment.
The routine, DosCreateCSAlias, creates a CS alias, a CS segment
descriptor, that is identical to the DS segment descriptor you
already have. From the point you used the routine onwards you have
two CONCEPTUALLY different ways of accessing the segment in question.
You can execute it as code, using CS, or read/modify it as data,
using DS. Using the wrong segment register for a purpose will result in a
Generel Protection (GP) Fault.

The person reffered to is Ed Iaccobucci and he wrote the book
"Inside OS/2", published by Microsoft Press.
Warning #1: there exist another book with the same title
Warning #2: The book contains no source code, it explains the
concept and ideas behind OS/2, nothing more.
Warning #3: And that can get quite technical at times! If you
are not familiar with OS terminology and concepts, this may
prove a difficult book.
Warning #4: If you want to know about OS/2, you NEED to read this
book one day or another. It may however not be the best to start with...

Just thought people might like to know this, but it is, as Chris Torek
already pointed out, in beyond the bounds of this list. (GP Fault)

/* Tamura "2 C | ! 2 C == ?" Jones  ( quote free after ) */
#include <disclaim.h>           /*  ( W. Shakespeare's ) */
/* INTERNET: TAMURA at HLERUL5.BITNET  ( Hamlet, Act III, ) */
/* imagine  #include on first line  ( scene 1, line 56 ) */



More information about the Comp.lang.c mailing list