16-bit code and L4
adam at os.inf.tu-dresden.de
Mon Jun 25 17:39:35 CEST 2007
On Mon Jun 25, 2007 at 20:36:26 +1300, Valery V. Sedletski wrote:
> On Mon, 25 Jun 2007 18:43:55 +1300 (MSD), Valery V. Sedletski wrote:
> >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.
This is defined per thread, so it's not privileged.
> >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).
The kernel makes sure that the PL is 3 and that the present bit is set.
In particular it doesn't care about base or limits.
> In segment.h header, there is an implementation of this function,
> through using LLDT instruction. (and not through using a special
> syscall). So, LLDT instruction is allowed for usermode programs, and
> the kernel intercept lldt instruction.-- Probably when this
> instruction is used in usermode program, the TRAP occurs, and the
> kernel handles this trap, modifying the LDT or GDT. Is this right?
Yes, just take lldt as a sycall for user land.
> (I searched an fiasco_gdt_set() function in the source code and I
> found that L4Linux uses this function. So, it is, probably, was
> created for demands of L4Linux development?)
Yes, the current interface was made in a way to make it work smoothly
with Linux. We didn't have another user yet.
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers