Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
802 bytes
|
Rev | Line | |
---|
[444] | 1 | # setjmp/longjmp for m32r. The jmpbuf looks like this: |
---|
| 2 | # |
---|
| 3 | # Register jmpbuf offset |
---|
| 4 | # reserved 0x00 |
---|
| 5 | # R8 0x04 |
---|
| 6 | # R9 0x08 |
---|
| 7 | # R10 0x0c |
---|
| 8 | # R11 0x10 |
---|
| 9 | # R12 0x14 |
---|
| 10 | # R13 (FP) 0x18 |
---|
| 11 | # R14 (LR) 0x1c |
---|
| 12 | # R15 (SP) 0x20 |
---|
| 13 | # reserved 0x24 |
---|
| 14 | |
---|
| 15 | .text |
---|
| 16 | .global setjmp |
---|
| 17 | setjmp: |
---|
| 18 | ;addi r0, #-4 ; commented out as first word is reserved |
---|
| 19 | ;st r1, @+r0 |
---|
| 20 | st r8, @+r0 |
---|
| 21 | st r9, @+r0 |
---|
| 22 | st r10, @+r0 |
---|
| 23 | st r11, @+r0 |
---|
| 24 | st r12, @+r0 |
---|
| 25 | st r13, @+r0 |
---|
| 26 | st r14, @+r0 |
---|
| 27 | st r15, @+r0 |
---|
| 28 | |
---|
| 29 | # Return 0 to caller. |
---|
| 30 | ldi r0, #0 |
---|
| 31 | jmp lr |
---|
| 32 | |
---|
| 33 | .global longjmp |
---|
| 34 | longjmp: |
---|
| 35 | addi r0, #4 ; first word is reserved |
---|
| 36 | ;ld r1, @r0+ |
---|
| 37 | ld r8, @r0+ |
---|
| 38 | ld r9, @r0+ |
---|
| 39 | ld r10, @r0+ |
---|
| 40 | ld r11, @r0+ |
---|
| 41 | ld r12, @r0+ |
---|
| 42 | ld r13, @r0+ |
---|
| 43 | ld r2, @r0+ ; return address |
---|
| 44 | ld r15, @r0+ |
---|
| 45 | |
---|
| 46 | # If caller attempted to return 0, return 1 instead. |
---|
| 47 | |
---|
| 48 | mv r0, r1 |
---|
| 49 | bnez r0, .Lnonzero |
---|
| 50 | ldi r0, #1 |
---|
| 51 | .Lnonzero: |
---|
| 52 | jmp r2 |
---|
Note: See
TracBrowser
for help on using the repository browser.