Преглед на файлове

* rtl/m68k/setjumph.inc:
data registers stored are 1 to 7, not 0 to 7
* rtl/m68k/setjump.inc:
don't use "S" or "value" to reference the parameters as the code generator does not use "sp" instead of "fp" in case of "nostackframe"
restore a0 at the end of setjmp

git-svn-id: trunk@23240 -

svenbarth преди 12 години
родител
ревизия
e240856e43
променени са 2 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 8 4
      rtl/m68k/setjump.inc
  2. 1 1
      rtl/m68k/setjumph.inc

+ 8 - 4
rtl/m68k/setjump.inc

@@ -16,12 +16,14 @@
            Set_Jmp/Long_jmp
            Set_Jmp/Long_jmp
  **********************************************************************}
  **********************************************************************}
 
 
+{$warning Fix register handling in case of nostackframe }
+
 Function fpc_SetJmp (Var S : Jmp_buf) : longint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP'];compilerproc;
 Function fpc_SetJmp (Var S : Jmp_buf) : longint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP'];compilerproc;
 asm
 asm
   // Temporarily store a0 into d0
   // Temporarily store a0 into d0
   move.l  a0,d0
   move.l  a0,d0
   // load S to a0
   // load S to a0
-  move.l S, a0
+  move.l 4(sp), a0
   // save a0 (now in d0) to offset 40
   // save a0 (now in d0) to offset 40
   move.l d0, 40(a0)
   move.l d0, 40(a0)
   // save return address (PC)
   // save return address (PC)
@@ -32,7 +34,7 @@ asm
   // save SP
   // save SP
   move.l sp, d0
   move.l sp, d0
   addq.l #8, d0
   addq.l #8, d0
-  move.l d0, (a0)
+  move.l d0, 4(a0)
   // save a1
   // save a1
   move.l a1,d0
   move.l a1,d0
   move.l d0,44(a0)
   move.l d0,44(a0)
@@ -56,6 +58,8 @@ asm
   move d5, 28(a0)
   move d5, 28(a0)
   move d6, 32(a0)
   move d6, 32(a0)
   move d7, 36(a0)
   move d7, 36(a0)
+  // restore a0
+  move.l 40(a0), a0
 
 
   // return 0
   // return 0
   clr.l d0
   clr.l d0
@@ -64,7 +68,7 @@ end;
 Procedure fpc_longJmp (Var S : Jmp_buf; value : longint); assembler;nostackframe;[Public, alias : 'FPC_LONGJMP'];compilerproc;
 Procedure fpc_longJmp (Var S : Jmp_buf; value : longint); assembler;nostackframe;[Public, alias : 'FPC_LONGJMP'];compilerproc;
 asm
 asm
   // load S to a0
   // load S to a0
-  move.l S,a0
+  move.l 4(sp),a0
   // Restore address registers
   // Restore address registers
   // restore a1
   // restore a1
   move.l 44(a0),d0
   move.l 44(a0),d0
@@ -91,7 +95,7 @@ asm
   move 36(a0),d7
   move 36(a0),d7
 
 
   // load value to d0
   // load value to d0
-  move.l value,d0
+  move.l 8(sp),d0
   // Save temporarily into d1 slot
   // Save temporarily into d1 slot
   move.l d0,12(a0)
   move.l d0,12(a0)
   // restore FP
   // restore FP

+ 1 - 1
rtl/m68k/setjumph.inc

@@ -26,7 +26,7 @@ Type
       if called from SetJmp or value if called from LongJmp }
       if called from SetJmp or value if called from LongJmp }
     { data registers (d1, d2, d3, d4, d5, d6, d7) }
     { data registers (d1, d2, d3, d4, d5, d6, d7) }
     { offsets:        12, 16, 20, 24, 28, 32, 36 }
     { offsets:        12, 16, 20, 24, 28, 32, 36 }
-    dregs : array[0..7] of dword;
+    dregs : array[1..7] of dword;
     { address registers (a0, a1, a2, a3, a4, a5), a6 and a7 are fp and sp respectively }
     { address registers (a0, a1, a2, a3, a4, a5), a6 and a7 are fp and sp respectively }
     { offsets:           40, 44, 48, 52, 56, 60 }
     { offsets:           40, 44, 48, 52, 56, 60 }
     aregs : array[0..5] of dword;
     aregs : array[0..5] of dword;