mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-30 01:19:14 +02:00
+ set/longjmp implementation for avr
git-svn-id: trunk@34971 -
This commit is contained in:
parent
10360a823e
commit
0c238b72e5
@ -14,13 +14,89 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
function fpc_setjmp(var S : jmp_buf) : smallint;assembler;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc;
|
||||
function fpc_setjmp(var S : jmp_buf) : shortint;assembler;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc;
|
||||
asm
|
||||
mov r26,r24
|
||||
mov r27,r25
|
||||
st x+,r1
|
||||
st x+,r2
|
||||
st x+,r3
|
||||
st x+,r4
|
||||
st x+,r5
|
||||
st x+,r6
|
||||
st x+,r7
|
||||
st x+,r8
|
||||
st x+,r9
|
||||
st x+,r10
|
||||
st x+,r11
|
||||
st x+,r12
|
||||
st x+,r13
|
||||
st x+,r14
|
||||
st x+,r15
|
||||
st x+,r16
|
||||
st x+,r17
|
||||
st x+,r28
|
||||
st x+,r29
|
||||
|
||||
// store stack pointer
|
||||
in r18,61
|
||||
in r19,62
|
||||
st x+,r18
|
||||
st x+,r19
|
||||
|
||||
// store return address
|
||||
pop r18
|
||||
pop r19
|
||||
st x+,r18
|
||||
st x+,r19
|
||||
push r19
|
||||
push r18
|
||||
|
||||
clr r24
|
||||
end;
|
||||
|
||||
|
||||
procedure fpc_longjmp(var S : jmp_buf;value : smallint);assembler;[Public, alias : 'FPC_LONGJMP'];compilerproc;
|
||||
procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias : 'FPC_LONGJMP'];compilerproc;
|
||||
asm
|
||||
mov r26,r24
|
||||
mov r27,r25
|
||||
ld r1,x+
|
||||
ld r2,x+
|
||||
ld r3,x+
|
||||
ld r4,x+
|
||||
ld r5,x+
|
||||
ld r6,x+
|
||||
ld r7,x+
|
||||
ld r8,x+
|
||||
ld r9,x+
|
||||
ld r10,x+
|
||||
ld r11,x+
|
||||
ld r12,x+
|
||||
ld r13,x+
|
||||
ld r14,x+
|
||||
ld r15,x+
|
||||
ld r16,x+
|
||||
ld r17,x+
|
||||
ld r28,x+
|
||||
ld r29,x+
|
||||
|
||||
// restore stack pointer
|
||||
ld r18,x+
|
||||
ld r19,x+
|
||||
in r0,63
|
||||
cli
|
||||
out 62,r19
|
||||
out 63,r0
|
||||
out 61,r18
|
||||
|
||||
// restore return address
|
||||
pop r18
|
||||
pop r19
|
||||
ld r18,x+
|
||||
ld r19,x+
|
||||
push r19
|
||||
push r18
|
||||
mov r24,r22
|
||||
end;
|
||||
|
||||
|
||||
|
@ -16,10 +16,11 @@
|
||||
|
||||
type
|
||||
jmp_buf = packed record
|
||||
r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r28,r29,splo,sphi,pclo,pchi : byte;
|
||||
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'];
|
||||
function setjmp(var S : jmp_buf) : shortint;[external name 'FPC_SETJMP'];
|
||||
procedure longjmp(var S : jmp_buf;value : shortint);[external name 'FPC_LONGJMP'];
|
||||
|
||||
|
||||
|
@ -776,8 +776,8 @@ function fpc_qword_to_double(q: qword): double; compilerproc;
|
||||
function fpc_longword_to_double(i: longword): double; compilerproc;
|
||||
{$endif FPC_INCLUDE_SOFTWARE_LONGWORD_TO_DOUBLE}
|
||||
|
||||
function fpc_setjmp(var s : jmp_buf) : {$ifdef CPU16}smallint{$else}longint{$endif}; compilerproc;
|
||||
procedure fpc_longjmp(var s : jmp_buf; value : {$ifdef CPU16}smallint{$else}longint{$endif}); compilerproc;
|
||||
function fpc_setjmp(var s : jmp_buf) : {$if defined(CPUINT8)}shortint{$elseif defined(CPUINT16)}smallint{$else}longint{$endif}; compilerproc;
|
||||
procedure fpc_longjmp(var s : jmp_buf; value : {$if defined(CPUINT8)}shortint{$elseif defined(CPUINT16)}smallint{$else}longint{$endif}); compilerproc;
|
||||
|
||||
{$ifdef cpui8086}
|
||||
{ i8086 stack checking }
|
||||
|
Loading…
Reference in New Issue
Block a user