Re: SIGSEGV handler Question
- From: John Reiser <jreiser@xxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 13:02:25 -0700
I'd like to ask if it is possible to write a signal handler to capture
SIGSEGV, and handles the fault by changing the virtual address the program
is accessing instead? For example, if a read to VM address 0x12340000 causes
a SIGSEGV, instead of changing the memory protection of 0x12340000 to
readable or perform a memory mapping on this address inside the signal
handler, is it possible to change the VM address to be accessed to, say
0x56780000 inside the handler (assume 0x56780000 is mapped and is readable)?
In most cases upon resume-from-trap-handler, the underlying hardware executes
complete instructions. So you must arrange that the complete instruction
references the address that you intend. Some mc68k models, as well as
some other less common hardware, have a "continuation mode" where a resume-
from-trap-handler begins special manipulation with exposed internal state
of the CPU, and this state may contain an address for the Memory Address
Register. This mode is [almost-] universally deprecated because in practice
it is poorly documented, is poorly tested, often contains unknown dependencies
on timing and/or previous instructions and/or following instructions, and
often changes from stepping to stepping of the chip.
--
.
- Follow-Ups:
- Re: SIGSEGV handler Question
- From: LaBird
- Re: SIGSEGV handler Question
- References:
- SIGSEGV handler Question
- From: LaBird
- SIGSEGV handler Question
- Prev by Date: Re: SMTP library??
- Next by Date: Re: SMTP library??
- Previous by thread: SIGSEGV handler Question
- Next by thread: Re: SIGSEGV handler Question
- Index(es):
Relevant Pages
|