SIGSEGV - Handling page faults in user mode
This is a library for handling page faults in user mode. A page fault
occurs when a program tries to access to a region of memory that is
currently not available. Catching and handling a page fault is a useful
technique for implementing:
- pageable virtual memory,
- memory-mapped access to persistent databases,
- generational garbage collectors,
- stack overflow handlers,
- distributed shared memory,
Pageable virtual memory is usually done in the operating system's kernel.
This library helps in implementing the others.
Installing a page fault handler is usually more efficient than doing
access checks in software at every access, because it's effectively the
hardware (the MMU) which checks whether a page is present or not.
Note that if you use system calls (like read()) to write into write-
protected pages, the system will react by returning -1 and setting
errno to EFAULT, instead of signalling SIGSEGV and restarting the system
call. In this case, the program has to do what the SIGSEGV handler would
do, and then restart the read() operation. Some buggy systems (SunOS 4)
go into an endless loop on this occasion; on these systems you have to
make sure that an area is writable _before_ you call read() on it,
Installation instructions on Unix:
Installation instructions on Win32 with MS Visual C/C++ 4.0 or 5.0:
nmake -f Makefile.msvc check
Copyright 1998 Bruno Haible, <firstname.lastname@example.org>
This is free software distributed under the GNU General Public Licence
described in the file COPYING. Contact the author if you don't have this
or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
on this software.