# ZSVJMP.S -- LinuxPPC version, September 2001. .file "zsvjmp.s" # ZSVJMP -- SPP callable SETJMP. .text .align 2 .globl _zsvjmp_ _zsvjmp_: # R3 = buf, R4 = &status li r11,0 ; r11 = 0 stw r11,0(r4) ; set *status to zero stw r4,0(r3) ; store &status in buf[0] addi r3,r3,4 ; reference buf[1] for setjmp b L_setjmp$stub L2: lwz r1,0(r1) lwz r0,8(r1) mtlr r0 lmw r30,-8(r1) blr # The setjmp code is only available in a dynamic library on 10.1. .picsymbol_stub L_setjmp$stub: .indirect_symbol _setjmp mflr r0 bcl 20,31,L1$pb L1$pb: mflr r11 addis r11,r11,ha16(L1$lz-L1$pb) mtlr r0 lwz r12,lo16(L1$lz-L1$pb)(r11) mtctr r12 addi r11,r11,lo16(L1$lz-L1$pb) bctr .lazy_symbol_pointer L1$lz: .indirect_symbol _setjmp .long dyld_stub_binding_helper .text .Lfe1: # Set the address of the MEM common to zero. .globl mem_ mem_ = 0 # GFPUCW -- Get the FPU control register. .globl _gfpucw_ _gfpucw_: stwu r1, -32(r1) stw r31, 28(r1) mr r31, r1 stw r3, 8(r31) mffs f0 stfd f0, 16(r31) lwz r0, 20(r31) mr r9, r0 lwz r9, 8(r31) stw r0, 0(r9) .L3: lwz r11, 0(r1) lwz r31, -4(r11) mr r1, r11 blr .Lfe2: # SFPUCW -- Set the FPU control register. .globl _sfpucw_ _sfpucw_: stwu r1, -32(r1) stw r31, 28(r1) mr r31, r1 stw r3, 8(r31) lis r0, 0xfff8 stw r0, 16(r31) lwz r9, 8(r31) lwz r0, 0(r9) stw r0, 20(r31) lfd f0, 16(r31) mtfsf 255, f0 .L4: lwz r11, 0(r1) lwz r31, -4(r11) mr r1, r11 blr .Lfe3: # CFPUCW -- Clear the exception flags in the FPU control register. # So far I have not been able to find a way to make this work, at # least with the current version of LinuxPPC. All of the instructions # below fail, raising another SIGFPE if an exception condition is # already present. ANY instruction involving the FPU will raise # SIGFPE once the exception condition exists. Also, LinuxPPC # sigaction does not block SIGFPE in the called exception handler, # contrary to the manpage. It appears that the exception handling # in the kernel needs to clear the exception condition but is not # doing so. Supervisor level instructions appear to be required to # clear the exception condition, so this has to be done in the kernel # before the user level signal handler is called. .globl _cfpucw_ _cfpucw_: stwu r1, -32(r1) stw r31, 28(r1) mr r31, r1 #mcrfs r0, 0 #mtfsfi r0, 0 #mtfsfi r3, 0 #mtfsfi r3, 0 #mtfsfi r5, 0 #mtfsfb0 r3 #mtfsfb0 r5 #mtfsfb0 r7 .L5: lwz r11, 0(r1) lwz r31, -4(r11) mr r1, r11 blr .Lfe4: