scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

longjmp.s (936B)


      1 	.file	"longjmp.s"
      2 	.text
      3 	.global longjmp
      4 
      5 longjmp:
      6 	/* 0) move old return address into r0 */
      7 	lwz 0,0(3)
      8 	/* 1) put it into link reg */
      9 	mtlr 0
     10 	/* 2 ) restore stack ptr */
     11 	lwz 1,4(3)
     12 	/* 3) restore control reg */
     13 	lwz 0,8(3)
     14 	mtcr 0
     15 	/* 4) restore r14-r31 */
     16 	lwz 14,12(3)
     17 	lwz 15,16(3)
     18 	lwz 16,20(3)
     19 	lwz 17,24(3)
     20 	lwz 18,28(3)
     21 	lwz 19,32(3)
     22 	lwz 20,36(3)
     23 	lwz 21,40(3)
     24 	lwz 22,44(3)
     25 	lwz 23,48(3)
     26 	lwz 24,52(3)
     27 	lwz 25,56(3)
     28 	lwz 26,60(3)
     29 	lwz 27,64(3)
     30 	lwz 28,68(3)
     31 	lwz 29,72(3)
     32 	lwz 30,76(3)
     33 	lwz 31,80(3)
     34 	lfd 14,88(3)
     35 	lfd 15,96(3)
     36 	lfd 16,104(3)
     37 	lfd 17,112(3)
     38 	lfd 18,120(3)
     39 	lfd 19,128(3)
     40 	lfd 20,136(3)
     41 	lfd 21,144(3)
     42 	lfd 22,152(3)
     43 	lfd 23,160(3)
     44 	lfd 24,168(3)
     45 	lfd 25,176(3)
     46 	lfd 26,184(3)
     47 	lfd 27,192(3)
     48 	lfd 28,200(3)
     49 	lfd 29,208(3)
     50 	lfd 30,216(3)
     51 	lfd 31,224(3)
     52 
     53 	/* 5) put val into return reg r3 */
     54 	mr 3,4
     55 
     56 	/* 6) check if return value is 0, make it 1 in that case */
     57 	cmpwi cr7,4,0
     58 	bne cr7,1f
     59 	li 3, 1
     60 1:
     61 	blr
     62