9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] interface for per process gdt manipulation
@ 2009-06-16  3:46 cinap_lenrek
  2009-06-16  3:52 ` Russ Cox
  0 siblings, 1 reply; 4+ messages in thread
From: cinap_lenrek @ 2009-06-16  3:46 UTC (permalink / raw)
  To: 9fans

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-16  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16  3:46 [9fans] interface for per process gdt manipulation cinap_lenrek
2009-06-16  3:52 ` Russ Cox
2009-06-16  5:37   ` cinap_lenrek
2009-06-16  6:00     ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).