for vx32 and linuxemu an interface is needed in the plan9 
kernel to modify per process gdt entries.

for linuxemu, i ended up with a kernel patch that adds
a gdt file to devproc for each process that contains
the binary representation of the process view of the
global descriptor table.

/n/sources/contrib/cinap_Lenrek/gdtpatch.tar

the interface:

/proc/n/gdt

reading the gdt file gets you the whole gdt table.

starting from a constant offset, here are 4 descriptors
that are writable trou the gdt file. writing any other
offsets causes an error.

the write also checks if the current segment registers
still contain valid selectors if the write would be applied.
so for example writing a descriptor for a read only segment
that is selected by the current ss register will fail.

i would like to have such an interface in the default
distribution some day so any objections are welcome.

implementation details for the patch:

the patch adds Segdesc ugdt[NUGDT] to the PMMU struct 
in pc/dat.h for the per process gdt entries. these entries are
copied to m->gdt[] on procrestore in pc/main.c on context
switch.

noted was changed in pc/trap.c to only check for the
case that the selectors point to valid descriptors, not
force any specific selector.

pc/mmu.c contains the reading/writing and checking code.

--
cinap


Reply via email to