diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/ia64/gen/_setjmp.S | 5 | ||||
-rw-r--r-- | lib/libc/ia64/gen/setjmp.S | 119 | ||||
-rw-r--r-- | lib/libc/ia64/gen/sigsetjmp.S | 33 |
3 files changed, 53 insertions, 104 deletions
diff --git a/lib/libc/ia64/gen/_setjmp.S b/lib/libc/ia64/gen/_setjmp.S index dd96ba7..e4e90b2 100644 --- a/lib/libc/ia64/gen/_setjmp.S +++ b/lib/libc/ia64/gen/_setjmp.S @@ -197,7 +197,8 @@ END(_setjmp) // for a second time to the 'SetJump'. // -ENTRY(_longjmp, 2) + WEAK_ALIAS(_longjmp,___longjmp) +ENTRY(___longjmp, 2) // // Make sure buffer is aligned at 16byte boundary // @@ -346,4 +347,4 @@ ENTRY(_longjmp, 2) br.ret.sptk b0 -END(_longjmp) +END(___longjmp) diff --git a/lib/libc/ia64/gen/setjmp.S b/lib/libc/ia64/gen/setjmp.S index 8556f85..3ea14fe 100644 --- a/lib/libc/ia64/gen/setjmp.S +++ b/lib/libc/ia64/gen/setjmp.S @@ -28,7 +28,9 @@ * rights to redistribute these changes. */ -#include "SYS.h" +#define LOCORE +#include <machine/asm.h> +#include <machine/setjmp.h> /* * C library -- setjmp, longjmp @@ -42,91 +44,38 @@ */ ENTRY(setjmp, 1) - mov ret0=r0 - br.ret.sptk.few rp - -#if 0 - LDGP(pv) - stq ra, (2 * 8)(a0) /* sc_pc = return address */ - stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */ - stq s1, ((10 + 4) * 8)(a0) - stq s2, ((11 + 4) * 8)(a0) - stq s3, ((12 + 4) * 8)(a0) - stq s4, ((13 + 4) * 8)(a0) - stq s5, ((14 + 4) * 8)(a0) - stq s6, ((15 + 4) * 8)(a0) - stq ra, ((26 + 4) * 8)(a0) - stq sp, ((30 + 4) * 8)(a0) - - /* - * get signal information - */ - mov a0, s0 /* squirrel away ptr to sc */ - - /* see what's blocked */ - lda a2, (71 * 8)(a0) /* oset: sc_reserved */ - mov zero, a1 /* set: NULL */ - addq a1, 1, a0 /* how: SIG_BLOCK */ - CALL(_sigprocmask) /* see what's blocked */ - - lda sp, -24(sp) /* sizeof struct sigaltstack */ - mov zero, a0 - mov sp, a1 - CALL(_sigaltstack) - ldl t0, 16(sp) /* offset of ss_flags */ - lda sp, 24(sp) /* sizeof struct sigaltstack */ - ldq ra, ((26 + 4) * 8)(s0) /* restore return address */ - blt v0, botch /* check for error */ - and t0, 0x1, t0 /* get SA_ONSTACK flag */ - stq t0, (0 * 8)(s0) /* and save it in sc_onstack */ - /* - * Restore old s0 and a0, and continue saving registers - */ - mov s0, a0 - ldq s0, (( 9 + 4) * 8)(a0) - - ldiq t0, 0xacedbade /* sigcontext magic number */ - stq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */ - /* Too bad we can't check if we actually used FP */ - ldiq t0, 1 - stq t0, (36 * 8)(a0) /* say we've used FP. */ - stt fs0, ((2 + 37) * 8)(a0) /* saved bits of sc_fpregs */ - stt fs1, ((3 + 37) * 8)(a0) - stt fs2, ((4 + 37) * 8)(a0) - stt fs3, ((5 + 37) * 8)(a0) - stt fs4, ((6 + 37) * 8)(a0) - stt fs5, ((7 + 37) * 8)(a0) - stt fs6, ((8 + 37) * 8)(a0) - stt fs7, ((9 + 37) * 8)(a0) - mf_fpcr ft0 /* get FP control reg */ - stt ft0, (69 * 8)(a0) /* and store it in sc_fpcr */ - stq zero, (70 * 8)(a0) /* FP software control XXX */ - stq zero, (71 * 8)(a0) /* sc_reserved[0] */ - stq zero, (72 * 8)(a0) /* sc_reserved[1] */ - stq zero, (73 * 8)(a0) /* sc_xxx[0] */ - stq zero, (74 * 8)(a0) /* sc_xxx[1] */ - stq zero, (75 * 8)(a0) /* sc_xxx[2] */ - stq zero, (76 * 8)(a0) /* sc_xxx[3] */ - stq zero, (77 * 8)(a0) /* sc_xxx[4] */ - stq zero, (78 * 8)(a0) /* sc_xxx[5] */ - stq zero, (79 * 8)(a0) /* sc_xxx[6] */ - stq zero, (80 * 8)(a0) /* sc_xxx[7] */ - - mov zero, v0 /* return zero */ - RET -#endif + alloc loc0=ar.pfs,1,2,3,0 + mov loc1=rp + ;; + mov out0=1 // how = SIG_BLOCK + mov out1=0 // set = NULL + add out2=J_SIG0,in0 // oset = &jb[J_SIG0] + br.call.sptk.few rp=__sys_sigprocmask + ;; + mov rp=loc1 + mov r14=loc0 + ;; + alloc r15=ar.pfs,1,0,0,0 // drop register frame + ;; + mov ar.pfs=r14 // restore ar.pfs + br.sptk.many _setjmp // finish saving state END(setjmp) -XENTRY(longjmp) + WEAK_ALIAS(longjmp,__longjmp) ENTRY(__longjmp, 2) -#if 0 - LDGP(pv) - stq a1, (( 0 + 4) * 8)(a0) /* save return value */ - PCALL(_sigreturn) /* use sigreturn to return */ - -botch: - CALL(longjmperror) - CALL(abort) - RET /* "can't" get here... */ -#endif + alloc loc0=ar.pfs,2,2,3,0 + mov loc1=rp + ;; + mov out0=3 // how = SIG_SETMASK + add out1=J_SIG0,in0 // set = &jb[J_SIG0] + mov out2=0 // oset = NULL + br.call.sptk.few rp=__sys_sigprocmask + ;; + mov rp=loc1 + mov r14=loc0 + ;; + alloc r15=ar.pfs,2,0,0,0 // drop register frame + ;; + mov ar.pfs=r14 // restore ar.pfs + br.sptk.many _longjmp // finish restoring state END(__longjmp) diff --git a/lib/libc/ia64/gen/sigsetjmp.S b/lib/libc/ia64/gen/sigsetjmp.S index 622ea34..d9fe852 100644 --- a/lib/libc/ia64/gen/sigsetjmp.S +++ b/lib/libc/ia64/gen/sigsetjmp.S @@ -28,7 +28,9 @@ * rights to redistribute these changes. */ +#define LOCORE #include <machine/asm.h> +#include <machine/setjmp.h> /* * C library -- sigsetjmp, siglongjmp @@ -43,24 +45,21 @@ */ ENTRY(sigsetjmp, 2) -#if 0 - LDGP(pv) - stq a1, (81 * 8)(a0) /* save the mask */ - bne a1, Lsavesig /* if !zero, save signals */ - jmp zero, _setjmp /* else don't. */ -Lsavesig: - jmp zero, setjmp -#endif + add r14=J_SIGMASK,in0 // place to save mask + ;; + st8 [r14]=in1 // save mask value + cmp.ne p6,p7=0,in1 // save signal state? +(p6) br.cond.dptk.many setjmp +(p7) br.cond.dpnt.many _setjmp END(sigsetjmp) -XENTRY(siglongjmp) + WEAK_ALIAS(siglongjmp,__siglongjmp) ENTRY(__siglongjmp, 2) -#if 0 - LDGP(pv) - ldq t0, (81 * 8)(a0) /* get the mask */ - bne t0, Lrestoresig /* if !zero, restore signals */ - jmp zero, _longjmp -Lrestoresig: - jmp zero, longjmp -#endif + add r14=J_SIGMASK,in0 // address of mask value + ;; + ld8 r14=[r14] + ;; + cmp.ne p6,p7=0,r14 // did we save signals? +(p6) br.cond.dptk.many longjmp +(p7) br.cond.dpnt.many _longjmp END(__siglongjmp) |