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:
741 bytes
|
Line | |
---|
1 | # setjmp/longjmp for FR30. The jmpbuf looks like this: |
---|
2 | # |
---|
3 | # Register jmpbuf offset |
---|
4 | # R8 0x00 |
---|
5 | # R9 0x04 |
---|
6 | # R10 0x08 |
---|
7 | # R11 0x0c |
---|
8 | # R12 0x10 |
---|
9 | # R13 0x14 |
---|
10 | # R14 (FP) 0x18 |
---|
11 | # R15 (SP) 0x1c |
---|
12 | # RP 0x20 |
---|
13 | |
---|
14 | .macro save reg |
---|
15 | st \reg,@r4 |
---|
16 | add #4,r4 |
---|
17 | .endm |
---|
18 | |
---|
19 | .macro restore reg |
---|
20 | ld @r4,\reg |
---|
21 | add #4,r4 |
---|
22 | .endm |
---|
23 | |
---|
24 | |
---|
25 | .text |
---|
26 | .global setjmp |
---|
27 | setjmp: |
---|
28 | save r8 |
---|
29 | save r9 |
---|
30 | save r10 |
---|
31 | save r11 |
---|
32 | save r12 |
---|
33 | save r13 |
---|
34 | save r14 |
---|
35 | save r15 |
---|
36 | mov RP,r5 |
---|
37 | st r5,@r4 |
---|
38 | |
---|
39 | # Return 0 to caller. |
---|
40 | ldi:8 #0,r4 |
---|
41 | ret |
---|
42 | |
---|
43 | .global longjmp |
---|
44 | longjmp: |
---|
45 | restore r8 |
---|
46 | restore r9 |
---|
47 | restore r10 |
---|
48 | restore r11 |
---|
49 | restore r12 |
---|
50 | restore r13 |
---|
51 | restore r14 |
---|
52 | restore r15 |
---|
53 | ld @r4,r4 |
---|
54 | mov r4,RP |
---|
55 | |
---|
56 | # If caller attempted to return 0, return 1 instead. |
---|
57 | |
---|
58 | mov r5,r4 |
---|
59 | or r4,r4 |
---|
60 | bne 1f |
---|
61 | ldi:8 #1,r4 |
---|
62 | 1: |
---|
63 | ret |
---|
64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.