Hi everybody,
I need to implement the SharedUserData, which is a page of memory located at (KERNEL_BASE - 0x10000) shared between user space (read-only access) and kernel space.
Some information in that page are very accurate (system time in 100ns units for instance), so I don't think that it would be possible to create a shared page at (KERNEL_BASE - 0x10000) and refresh it fast enough.
Please correct me if I'm wrong, but I think that the way to go would be to create a copy of that page in memory and initialize it when Wine starts (some information never change, like the system root or version number). When a user space program would try to access that page, the page fault exception handler would return the appropriate data.
I'm not very familiar with Wine internals, so I might be wrong, or forget some important issues. Comments are more than welcome :-)
I'd also appreciate if someone could give me some hints about the implementation (where I should look for the page fault exception handler, where I should initialize that shared data, where I can find the needed information to initialize those data, ...).
Thanks in advance.
Laurent Pinchart
On Wed, Apr 03, 2002 at 09:49:07AM +0200, Laurent Pinchart wrote:
Hi everybody,
I need to implement the SharedUserData, which is a page of memory located at (KERNEL_BASE - 0x10000) shared between user space (read-only access) and kernel space.
I don't know how to get the 'page fault' trap for a 'valid' user page on all systems that wine might run on. Certainly the assumption that (KERNEL_BASE - 0x10000) is available is probably false...
However you don't actually need a valid user address, a kernel address (ie one that is always invalid) will do. Catching SIGSEGV might be enough - but I'm not totally certain how you can get the value back into the main process context (emulate the instruction and modify the saved program counter ????)
David
I need to implement the SharedUserData, which is a page of memory located at (KERNEL_BASE - 0x10000) shared between user space (read-only access) and kernel space.
I don't know how to get the 'page fault' trap for a 'valid' user page on all systems that wine might run on. Certainly the assumption that (KERNEL_BASE - 0x10000) is available is probably false...
However you don't actually need a valid user address, a kernel address (ie one that is always invalid) will do.
I'm not sure to understand what you mean. The user program will try to access KERNEL_BASE - 0x10000 (which is 0x7ffe0000 on IA-32). I need that to trigger a segfault.
Catching SIGSEGV might be enough - but I'm not totally certain how you can get the value back into the main process context (emulate the instruction and modify the saved program counter ????)
That's what I thought at first. I could also try to set a hardware breakpoint for read/write accesses at that address, but that's highly not portable, and won't work nicely with a debugger. If someone has a better idea I'll be glad to hear it.
Laurent Pinchart