|
| 1 | +@ thumb callee save: bx, bp, sp, r12, r14, r14, r15 |
| 2 | + |
| 3 | + .syntax unified |
| 4 | + .cpu cortex-m4 |
| 5 | + .thumb |
| 6 | + .text |
| 7 | + .align 2 |
| 8 | + |
| 9 | +@ uint nlr_push(r0=nlr_buf_t *nlr) |
| 10 | + .global nlr_push |
| 11 | + .thumb |
| 12 | + .thumb_func |
| 13 | + .type nlr_push, %function |
| 14 | +nlr_push: |
| 15 | + str lr, [r0, #8] @ store lr into nlr_buf |
| 16 | + str r4, [r0, #12] @ store r4 into nlr_buf |
| 17 | + str r5, [r0, #16] @ store r5 into nlr_buf |
| 18 | + str r6, [r0, #20] @ store r6 into nlr_buf |
| 19 | + str r7, [r0, #24] @ store r7 into nlr_buf |
| 20 | + str r8, [r0, #28] @ store r8 into nlr_buf |
| 21 | + str r9, [r0, #32] @ store r9 into nlr_buf |
| 22 | + str r10, [r0, #36] @ store r10 into nlr_buf |
| 23 | + str r11, [r0, #40] @ store r11 into nlr_buf |
| 24 | + str r13, [r0, #44] @ store r13=sp into nlr_buf |
| 25 | + |
| 26 | + ldr r3, .L2 @ load addr of nlr_top |
| 27 | + ldr r2, [r3] @ load nlr_top |
| 28 | + str r2, [r0] @ store nlr_top into nlr_buf |
| 29 | + str r0, [r3] @ store nlr_buf into nlr_top (to link list) |
| 30 | + |
| 31 | + movs r0, #0 @ return 0, normal return |
| 32 | + bx lr @ return |
| 33 | + .align 2 |
| 34 | +.L2: |
| 35 | + .word .LANCHOR0 |
| 36 | + .size nlr_push, .-nlr_push |
| 37 | + |
| 38 | +@ void nlr_pop() |
| 39 | + .global nlr_pop |
| 40 | + .thumb |
| 41 | + .thumb_func |
| 42 | + .type nlr_pop, %function |
| 43 | +nlr_pop: |
| 44 | + ldr r3, .L5 @ load addr of nlr_top |
| 45 | + ldr r2, [r3] @ load nlr_top |
| 46 | + ldr r2, [r2] @ load prev nlr_buf |
| 47 | + str r2, [r3] @ store prev nlr_buf to nlr_top (to unlink list) |
| 48 | + bx lr @ return |
| 49 | + .align 2 |
| 50 | +.L5: |
| 51 | + .word .LANCHOR0 |
| 52 | + .size nlr_pop, .-nlr_pop |
| 53 | + |
| 54 | +@ void nlr_jump(r0=uint val) |
| 55 | + .global nlr_jump |
| 56 | + .thumb |
| 57 | + .thumb_func |
| 58 | + .type nlr_jump, %function |
| 59 | +nlr_jump: |
| 60 | + ldr r3, .L2 @ load addr of nlr_top |
| 61 | + ldr r2, [r3] @ load nlr_top |
| 62 | + str r0, [r2, #4] @ store return value |
| 63 | + ldr r0, [r2] @ load prev nlr_buf |
| 64 | + str r0, [r3] @ store prev nol_buf into nlr_top (to unlink list) |
| 65 | + |
| 66 | + ldr lr, [r2, #8] @ load lr from nlr_buf |
| 67 | + ldr r4, [r2, #12] @ load r4 from nlr_buf |
| 68 | + ldr r5, [r2, #16] @ load r5 from nlr_buf |
| 69 | + ldr r6, [r2, #20] @ load r6 from nlr_buf |
| 70 | + ldr r7, [r2, #24] @ load r7 from nlr_buf |
| 71 | + ldr r8, [r2, #28] @ load r8 from nlr_buf |
| 72 | + ldr r9, [r2, #32] @ load r9 from nlr_buf |
| 73 | + ldr r10, [r2, #36] @ load r10 from nlr_buf |
| 74 | + ldr r11, [r2, #40] @ load r11 from nlr_buf |
| 75 | + ldr r13, [r2, #44] @ load r13=sp from nlr_buf |
| 76 | + |
| 77 | + movs r0, #1 @ return 1, non-local return |
| 78 | + bx lr @ return |
| 79 | + .align 2 |
| 80 | +.L6: |
| 81 | + .word .LANCHOR0 |
| 82 | + .size nlr_jump, .-nlr_jump |
| 83 | + |
| 84 | +@ local variable nlr_top |
| 85 | + .bss |
| 86 | + .align 2 |
| 87 | + .set .LANCHOR0,. + 0 |
| 88 | + .type nlr_top, %object |
| 89 | + .size nlr_top, 4 |
| 90 | +nlr_top: |
| 91 | + .space 4 |
0 commit comments