16-bit code and L4

Valery V. Sedletski _valerius at mail.ru
Mon Jun 25 07:43:55 CEST 2007

Thanks for answening so quickly.

>> >Fiasco makes some GDT slots available to userland so that FS and GS can
>> >be used with those.
>> >
>> And how to access these GDT descriptors from userland? Is this
>> documented somewhere? Can usermode task change attributes of these
>> descriptors (such as "16-bits" attribute)?  Are they (descriptors)
>> somehow mapped to requestor's address space or how else can usermode
>> task modify these descriptors? Or, can usermode task only load
>> selectors corresponding to these descriptors, but not modify
>> descriptors itself?
>Userland can load descriptors that are sanity checked by the kernel and
>then stored in the GDT. Using 16-bit segments should work too although I
>never tried. Similar features are offered for the LDT. Our l4sys package
>contains segment.h headers which describe the kernel interface.

Yes, I see:

L4_INLINE void
fiasco_gdt_set(void *desc, unsigned int size,
               unsigned int entry_number_start, l4_threadid_t tid);

It is privileged architecture-specific syscall, as I understood. And what means
"sanity checking" by the kernel? Does the kernel simply check that the descriptor
defines a valid  segment, or, there are some additional chacks. For example, must
segments to be a non-overlapping, or not? (For 32-bit<-->16-bit thunking it is important
to have a possibility for the segments to be overlapping -- the code can be at the same 
time to be in 16-bit segment and 32-bit segment).
>> And what about DS/ES? Can usermode task load these registers with
>> another selector, as with FS/GS?
>Loading should work I guess but DS and ES are currently not restored on
>exit to user.

so, if user restores these segments on exit, the loading should work?

>Adam                 adam at os.inf.tu-dresden.de
>  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

More information about the l4-hackers mailing list