Jonathan Hunt jhuntnz@users.sourceforge.net writes:
Yes I would but interested in porting this to a 386. Could anyone give me some more information on what would be required to change. (The FAQ is rather brief). I understand the the CR0::WP bit enables an exception when a fully privileged task (such as the kernel task) writes to a read-only page but when does this happen that I can check explicitly for it?
Offhand I can think of two places that rely on page faults when writing to write-protected pages:
- When reading from a nonexisting thread's thread-control block (TCB), the TCB's virtual-memory region is backed by a read-only zero-filled page. This page gets replaced with a newly-allocated page only when a write access occurs. This mechanism is intended to prevent malicious threads from causing the kernel to allocate hundreds of pages by attempting to send IPC to (or otherwise modify) nonexisting threads.
In a first 386 version, this protection mechanism can just be disabled.
- In memory-copying IPC operations (and some other operations that write to the user address space, like exception delivery), the kernel relies on page faults when accessing write-protected user pages.
This could be approximated by checking for write permission in the copy operation, like Linux does.
Michael
l4-hackers@os.inf.tu-dresden.de