Turning a SIGSEGV into a regular function call under Linux, allowing throw

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 14 10:13:04 PDT 2012


On Wed, Mar 14, 2012 at 05:39:38PM +0100, deadalnix wrote:
> Le 14/03/2012 17:08, Vladimir Panteleev a écrit :
> >On Wednesday, 14 March 2012 at 11:11:54 UTC, deadalnix wrote:
> >>You are loosing EAX in the process.
> >
> >When would this matter? EAX is a scratch register per ABIs, no?
> 
> You may want to return from the function the standard way an resume
> operations. To implement a moving GC using page protection for
> example.

I believe the original purpose of this was to catch SIGSEGV and turn it
into a thrown Error. So we don't care whether EAX is overwritten since
we're never going to return to the code that caused the SEGV; we're just
reconstructing the stack frame so that stack unwinding will work
correctly when we throw the Error.


T

-- 
People tell me that I'm skeptical, but I don't believe it.


More information about the Digitalmars-d mailing list