/* * sMachDep.s for stubbed PCR. * Contains an alternate implementation of setjmp/longjmp. The standard one * uses a bigger buffer, and thus breaks with Cedar code that thinks it knows * the size of the buffer. Stole from real PCR. */ #include ! ! ! Replacement for _setjmp / _longjmp ! ! Doesn't do Sun's check-for-longjmp-0 hack. ! ! This uses three cells of the jmp_buf: ! ! buf[0] (offset=0): saved pc (exactly as stored by the call instruction) ! buf[1] (offset=4): not used ! buf[2] (offset=8): saved sp (stored here for compatibility with _setjmp) ! .seg "text" .proc 16 .globl _XR_setjmp _XR_setjmp: st %sp,[%o0+8] st %o7,[%o0] retl clr %o0 ! delay slot ! ! .seg "text" .proc 16 .globl _XR_longjmp _XR_longjmp: t ST_FLUSH_WINDOWS sub %sp,64,%sp ! leave space for another copy of regs in case ! preempted while fp and sp inconsistent below. ! (this is why C library versions of _setjmp/ ! _longjmp can't be used) ld [%o0+8],%fp sub %fp,64,%sp ld [%o0],%i7 ! return ptr ret restore %o1,0,%o0 ! delay slot