mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 21:07:58 +02:00
+ RiscV32: setjmp/longjmp implementation, based on the RiscV64 one
git-svn-id: trunk@48893 -
This commit is contained in:
parent
6f3fccddd1
commit
8735d09894
@ -16,11 +16,124 @@
|
||||
|
||||
function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc;
|
||||
asm
|
||||
end;
|
||||
sw ra, jmp_buf.ra(a0)
|
||||
sw s0, jmp_buf.s0(a0)
|
||||
sw s1, jmp_buf.s1(a0)
|
||||
sw s2, jmp_buf.s2(a0)
|
||||
sw s3, jmp_buf.s3(a0)
|
||||
sw s4, jmp_buf.s4(a0)
|
||||
sw s5, jmp_buf.s5(a0)
|
||||
sw s6, jmp_buf.s6(a0)
|
||||
sw s7, jmp_buf.s7(a0)
|
||||
sw s8, jmp_buf.s8(a0)
|
||||
sw s9, jmp_buf.s9(a0)
|
||||
sw s10, jmp_buf.s10(a0)
|
||||
sw s11, jmp_buf.s11(a0)
|
||||
sw sp, jmp_buf.sp(a0)
|
||||
|
||||
{$if defined(FPUFD) or defined(FPUD)}
|
||||
frcsr t0
|
||||
|
||||
sw t0, jmp_buf.fcsr(a0)
|
||||
|
||||
fsd f8, jmp_buf.f8(a0)
|
||||
fsd f9, jmp_buf.f9(a0)
|
||||
fsd f18, jmp_buf.f18(a0)
|
||||
fsd f19, jmp_buf.f19(a0)
|
||||
fsd f20, jmp_buf.f20(a0)
|
||||
fsd f21, jmp_buf.f21(a0)
|
||||
fsd f22, jmp_buf.f22(a0)
|
||||
fsd f23, jmp_buf.f23(a0)
|
||||
fsd f24, jmp_buf.f24(a0)
|
||||
fsd f25, jmp_buf.f25(a0)
|
||||
fsd f26, jmp_buf.f26(a0)
|
||||
fsd f27, jmp_buf.f27(a0)
|
||||
{$endif FPUFD or FPUD}
|
||||
{$if defined(FPUF)}
|
||||
frcsr t0
|
||||
|
||||
sw t0, jmp_buf.fcsr(a0)
|
||||
|
||||
fsw f8, jmp_buf.f8(a0)
|
||||
fsw f9, jmp_buf.f9(a0)
|
||||
fsw f18, jmp_buf.f18(a0)
|
||||
fsw f19, jmp_buf.f19(a0)
|
||||
fsw f20, jmp_buf.f20(a0)
|
||||
fsw f21, jmp_buf.f21(a0)
|
||||
fsw f22, jmp_buf.f22(a0)
|
||||
fsw f23, jmp_buf.f23(a0)
|
||||
fsw f24, jmp_buf.f24(a0)
|
||||
fsw f25, jmp_buf.f25(a0)
|
||||
fsw f26, jmp_buf.f26(a0)
|
||||
fsw f27, jmp_buf.f27(a0)
|
||||
{$endif FPUF}
|
||||
|
||||
addi x10, x0, 0
|
||||
end;
|
||||
|
||||
|
||||
procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP'];compilerproc;
|
||||
asm
|
||||
lw ra, jmp_buf.ra(a0)
|
||||
lw s0, jmp_buf.s0(a0)
|
||||
lw s1, jmp_buf.s1(a0)
|
||||
lw s2, jmp_buf.s2(a0)
|
||||
lw s3, jmp_buf.s3(a0)
|
||||
lw s4, jmp_buf.s4(a0)
|
||||
lw s5, jmp_buf.s5(a0)
|
||||
lw s6, jmp_buf.s6(a0)
|
||||
lw s7, jmp_buf.s7(a0)
|
||||
lw s8, jmp_buf.s8(a0)
|
||||
lw s9, jmp_buf.s9(a0)
|
||||
lw s10, jmp_buf.s10(a0)
|
||||
lw s11, jmp_buf.s11(a0)
|
||||
|
||||
{$if defined(FPUFD) or defined(FPUD)}
|
||||
lw sp, jmp_buf.fcsr(a0)
|
||||
|
||||
fld f8, jmp_buf.f8(a0)
|
||||
fld f9, jmp_buf.f9(a0)
|
||||
fld f18, jmp_buf.f18(a0)
|
||||
fld f19, jmp_buf.f19(a0)
|
||||
fld f20, jmp_buf.f20(a0)
|
||||
fld f21, jmp_buf.f21(a0)
|
||||
fld f22, jmp_buf.f22(a0)
|
||||
fld f23, jmp_buf.f23(a0)
|
||||
fld f24, jmp_buf.f24(a0)
|
||||
fld f25, jmp_buf.f25(a0)
|
||||
fld f26, jmp_buf.f26(a0)
|
||||
fld f27, jmp_buf.f27(a0)
|
||||
|
||||
fscsr sp
|
||||
{$endif FPUFD or FPUD}
|
||||
{$if defined(FPUF)}
|
||||
lw sp, jmp_buf.fcsr(a0)
|
||||
|
||||
flw f8, jmp_buf.f8(a0)
|
||||
flw f9, jmp_buf.f9(a0)
|
||||
flw f18, jmp_buf.f18(a0)
|
||||
flw f19, jmp_buf.f19(a0)
|
||||
flw f20, jmp_buf.f20(a0)
|
||||
flw f21, jmp_buf.f21(a0)
|
||||
flw f22, jmp_buf.f22(a0)
|
||||
flw f23, jmp_buf.f23(a0)
|
||||
flw f24, jmp_buf.f24(a0)
|
||||
flw f25, jmp_buf.f25(a0)
|
||||
flw f26, jmp_buf.f26(a0)
|
||||
flw f27, jmp_buf.f27(a0)
|
||||
|
||||
fscsr sp
|
||||
{$endif FPUF}
|
||||
lw sp, jmp_buf.sp(a0)
|
||||
|
||||
beq a1, x0, .Lone
|
||||
jal x0, .Lzero
|
||||
.Lone:
|
||||
addi a0, x0, 1
|
||||
jal x0, .Lexit
|
||||
.Lzero:
|
||||
addi a0, a1, 0
|
||||
.Lexit:
|
||||
end;
|
||||
|
||||
|
||||
|
@ -15,11 +15,20 @@
|
||||
**********************************************************************}
|
||||
|
||||
type
|
||||
jmp_buf = packed record
|
||||
jmp_buf = record
|
||||
ra,s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,sp: dword;
|
||||
{$if defined(FPUFD) or defined(FPUD)}
|
||||
fcsr,dummy : dword;
|
||||
f8,f9,f18,f19,f20,f21,
|
||||
f22,f23,f24,f25,f26,f27: qword;
|
||||
{$endif FPUFD or FPUD}
|
||||
{$if defined(FPUF)}
|
||||
fcsr : dword;
|
||||
f8,f9,f18,f19,f20,f21,
|
||||
f22,f23,f24,f25,f26,f27: longword;
|
||||
{$endif FPUF}
|
||||
end;
|
||||
pjmp_buf = ^jmp_buf;
|
||||
|
||||
function setjmp(var S : jmp_buf) : longint;[external name 'FPC_SETJMP'];
|
||||
procedure longjmp(var S : jmp_buf;value : longint);[external name 'FPC_LONGJMP'];
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user