Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
2.3 KB
|
Rev | Line | |
---|
[444] | 1 | /* A setjmp.c for Moxie |
---|
| 2 | Copyright (C) 2009 Anthony Green |
---|
| 3 | |
---|
| 4 | The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 5 | and license this software and its documentation for any purpose, provided |
---|
| 6 | that existing copyright notices are retained in all copies and that this |
---|
| 7 | notice is included verbatim in any distributions. No written agreement, |
---|
| 8 | license, or royalty fee is required for any of the authorized uses. |
---|
| 9 | Modifications to this software may be copyrighted by their authors |
---|
| 10 | and need not follow the licensing terms described here, provided that |
---|
| 11 | the new terms are clearly indicated on the first page of each file where |
---|
| 12 | they apply. */ |
---|
| 13 | |
---|
| 14 | # setjmp/longjmp for moxie. The jmpbuf looks like this: |
---|
| 15 | # |
---|
| 16 | # Register jmpbuf offset |
---|
| 17 | # $r0 0x00 |
---|
| 18 | # $r1 0x04 |
---|
| 19 | # $r2 0x08 |
---|
| 20 | # $r3 0x0c |
---|
| 21 | # $r4 0x10 |
---|
| 22 | # $r5 0x14 |
---|
| 23 | # $r6 0x18 |
---|
| 24 | # $r7 0x1c |
---|
| 25 | # $r8 0x20 |
---|
| 26 | # $r9 0x24 |
---|
| 27 | # $r10 0x28 |
---|
| 28 | # $r11 0x2c |
---|
| 29 | # $r12 0x30 |
---|
| 30 | # $r13 0x34 |
---|
| 31 | # $fp 0x38 |
---|
| 32 | # $sp 0x3c |
---|
| 33 | |
---|
| 34 | .text |
---|
| 35 | .global setjmp |
---|
| 36 | .type setjmp,@function |
---|
| 37 | setjmp: |
---|
| 38 | st.l ($r0), $r0 |
---|
| 39 | sto.l 0x04($r0), $r1 |
---|
| 40 | sto.l 0x08($r0), $r2 |
---|
| 41 | sto.l 0x0c($r0), $r3 |
---|
| 42 | sto.l 0x10($r0), $r4 |
---|
| 43 | sto.l 0x14($r0), $r5 |
---|
| 44 | sto.l 0x18($r0), $r6 |
---|
| 45 | sto.l 0x1c($r0), $r7 |
---|
| 46 | sto.l 0x20($r0), $r8 |
---|
| 47 | sto.l 0x24($r0), $r9 |
---|
| 48 | sto.l 0x28($r0), $r10 |
---|
| 49 | sto.l 0x2c($r0), $r11 |
---|
| 50 | sto.l 0x30($r0), $r12 |
---|
| 51 | sto.l 0x34($r0), $r13 |
---|
| 52 | sto.l 0x38($r0), $sp |
---|
| 53 | sto.l 0x3c($r0), $fp |
---|
| 54 | xor $r0, $r0 |
---|
| 55 | ret |
---|
| 56 | .Lend1: |
---|
| 57 | .size setjmp,.Lend1-setjmp |
---|
| 58 | |
---|
| 59 | .global longjmp |
---|
| 60 | .type longjmp,@function |
---|
| 61 | longjmp: |
---|
| 62 | ldi.l $r2, 0x00 |
---|
| 63 | cmp $r1, $r2 |
---|
| 64 | beq .Lreturn1 |
---|
| 65 | ldo.l $r1, 0x04($r0) |
---|
| 66 | ldo.l $r2, 0x08($r0) |
---|
| 67 | ldo.l $r3, 0x0c($r0) |
---|
| 68 | ldo.l $r4, 0x10($r0) |
---|
| 69 | ldo.l $r5, 0x14($r0) |
---|
| 70 | ldo.l $r6, 0x18($r0) |
---|
| 71 | ldo.l $r7, 0x1c($r0) |
---|
| 72 | ldo.l $r8, 0x20($r0) |
---|
| 73 | ldo.l $r9, 0x24($r0) |
---|
| 74 | ldo.l $r10, 0x28($r0) |
---|
| 75 | ldo.l $r11, 0x2c($r0) |
---|
| 76 | ldo.l $r12, 0x30($r0) |
---|
| 77 | ldo.l $r13, 0x34($r0) |
---|
| 78 | ldo.l $sp, 0x38($r0) |
---|
| 79 | ldo.l $fp, 0x3c($r0) |
---|
| 80 | mov $r0, $r1 |
---|
| 81 | ret |
---|
| 82 | .Lreturn1: |
---|
| 83 | ldo.l $r1, 0x04($r0) |
---|
| 84 | ldo.l $r2, 0x08($r0) |
---|
| 85 | ldo.l $r3, 0x0c($r0) |
---|
| 86 | ldo.l $r4, 0x10($r0) |
---|
| 87 | ldo.l $r5, 0x14($r0) |
---|
| 88 | ldo.l $r6, 0x18($r0) |
---|
| 89 | ldo.l $r7, 0x1c($r0) |
---|
| 90 | ldo.l $r8, 0x20($r0) |
---|
| 91 | ldo.l $r9, 0x24($r0) |
---|
| 92 | ldo.l $r10, 0x28($r0) |
---|
| 93 | ldo.l $r11, 0x2c($r0) |
---|
| 94 | ldo.l $r12, 0x30($r0) |
---|
| 95 | ldo.l $r13, 0x34($r0) |
---|
| 96 | ldo.l $sp, 0x38($r0) |
---|
| 97 | ldo.l $fp, 0x3c($r0) |
---|
| 98 | ldi.l $r0, 0x01 |
---|
| 99 | ret |
---|
| 100 | .Lend2: |
---|
| 101 | .size longjmp,.Lend2-longjmp |
---|
Note: See
TracBrowser
for help on using the repository browser.