diff options
Diffstat (limited to 'riscv/trunk/rtl/riscv64/setjump.inc')
-rw-r--r-- | riscv/trunk/rtl/riscv64/setjump.inc | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/riscv/trunk/rtl/riscv64/setjump.inc b/riscv/trunk/rtl/riscv64/setjump.inc new file mode 100644 index 0000000000..2bdbe0a390 --- /dev/null +++ b/riscv/trunk/rtl/riscv64/setjump.inc @@ -0,0 +1,58 @@ +{ + + This file is part of the Free Pascal run time library. + Copyright (c) 2008 by the Free Pascal development team. + + SetJmp and LongJmp implementation for exception handling + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +function fpc_setjmp(var S : jmp_buf) : longint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc; + asm + sd ra, 0*8(a0) + sd s0, 1*8(a0) + sd s1, 2*8(a0) + sd s2, 3*8(a0) + sd s3, 4*8(a0) + sd s4, 5*8(a0) + sd s5, 6*8(a0) + sd s6, 7*8(a0) + sd s7, 8*8(a0) + sd s8, 9*8(a0) + sd s9, 10*8(a0) + sd s10, 11*8(a0) + sd s11, 12*8(a0) + sd sp, 13*8(a0) + + addi x10, x0, 0 + end; + + +procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;nostackframe;[Public, alias : 'FPC_LONGJMP'];compilerproc; + asm + ld ra, 0*8(a0) + ld s0, 1*8(a0) + ld s1, 2*8(a0) + ld s2, 3*8(a0) + ld s3, 4*8(a0) + ld s4, 5*8(a0) + ld s5, 6*8(a0) + ld s6, 7*8(a0) + ld s7, 8*8(a0) + ld s8, 9*8(a0) + ld s9, 10*8(a0) + ld s10,11*8(a0) + ld s11,12*8(a0) + ld sp, 13*8(a0) + + sltiu a0, a1, 1 + add a0, a0, a1 + end; + |