Bläddra i källkod

* Xtensa-FreeRTOS: use setjmp/longjmp provided by the Xtensa libraries, we
have to link against them anyways

git-svn-id: trunk@46694 -

florian 5 år sedan
förälder
incheckning
3c6c403b7b
2 ändrade filer med 31 tillägg och 13 borttagningar
  1. 25 11
      rtl/xtensa/setjump.inc
  2. 6 2
      rtl/xtensa/setjumph.inc

+ 25 - 11
rtl/xtensa/setjump.inc

@@ -15,8 +15,8 @@
  **********************************************************************}
 
 
-function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP']; compilerproc; nostackframe;
 {$ifdef fpc_abi_call0}
+function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP']; compilerproc; nostackframe;
   asm
     s32i.n a0,S.a0
     s32i.n a1,S.a1
@@ -27,16 +27,9 @@ function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_S
     s32i.n a15,S.a15
     movi.n a2,0
   end;
-{$endif fpc_abi_call0}
-{$ifdef fpc_abi_windowed}
-  asm
-    movi a2,0
-  end;
-{$endif fpc_abi_windowed}
 
 
 procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP']; compilerproc; nostackframe;
-{$ifdef fpc_abi_call0}
   asm
     l32i.n a0,S.a0
     l32i.n a1,S.a1
@@ -48,9 +41,30 @@ procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias
     movi.n a2,1
     movnez a2,value,value
   end;
-{$endif fpc_abi_call0}
-{$ifdef fpc_abi_windowed}
+{$elseif defined(freertos) and defined(fpc_abi_windowed)}
+
+function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP']; compilerproc; nostackframe;
+  asm
+    j.l setjmp,a15
+  end;
+
+
+procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP']; compilerproc; nostackframe;
+  asm
+    j.l longjmp,a15
+  end;
+
+{$else}
+function fpc_setjmp(var S : jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP']; compilerproc; external;
+  asm
+    entry a1,16
+    movi.n a2,0
+  end;
+
+
+procedure fpc_longjmp(var S : jmp_buf;value : longint);assembler;[Public, alias : 'FPC_LONGJMP']; compilerproc; external;
   asm
+    entry a1,16
   end;
-{$endif fpc_abi_windowed}
+{$endif}
 

+ 6 - 2
rtl/xtensa/setjumph.inc

@@ -22,11 +22,15 @@ type
 {$endif fpc_abi_call0}
 {$ifdef fpc_abi_windowed}
    jmp_buf = record
+     data : array[0..16] of DWord;
    end;
 {$endif fpc_abi_windowed}
    pjmp_buf = ^jmp_buf;
 
+{$if defined(freertos) and defined(fpc_abi_windowed)}
+function setjmp(var S : jmp_buf) : longint;external;
+procedure longjmp(var S : jmp_buf;value : longint);external;
+{$else defined(freertos) and defined(fpc_abi_windowed)}
 function setjmp(var S : jmp_buf) : longint;[external name 'FPC_SETJMP'];
 procedure longjmp(var S : jmp_buf;value : longint);[external name 'FPC_LONGJMP'];
-
-
+{$endif defined(freertos) and defined(fpc_abi_windowed)}