Re: Query on memory management

Jamie Lokier
2000-04-06T18:30:24Z

Andi Kleen wrote:
> > (4) Is there a "hook" for user defined page replacement or page fault
> > handling? I could not find one.
>
> Just mprotect() the data in user space and set a signal handler for SIGSEGV
> The fault address can be read from the sigcontext_struct passed to the
> signal handler.

But note that this does not handle page faults when systems calls access
the memory. I.e. you'll get EFAULTs when you read/write/ioctl the
protected memory region instead of triggering your SEGV handler.

enjoy,
-- Jamie