Browse Source

* m68k: Fixed damage caused by r27573 and r28177:
* longjmp: restored loading of function result (d0) which got removed in r28177.
* While at the point, added test for zero, because longjmp must never return zero values.
* Assembler reader: 'fp' refers to frame pointer, not the stack pointer.

git-svn-id: trunk@28183 -

sergei 11 years ago
parent
commit
cfe13734e0
2 changed files with 8 additions and 2 deletions
  1. 1 1
      compiler/m68k/ra68kmot.pas
  2. 7 1
      rtl/m68k/setjump.inc

+ 1 - 1
compiler/m68k/ra68kmot.pas

@@ -220,7 +220,7 @@ const
         if lower(s)='sp' then
           actasmregister:=NR_STACK_POINTER_REG;
         if lower(s)='fp' then
-          actasmregister:=NR_STACK_POINTER_REG;
+          actasmregister:=NR_FRAME_POINTER_REG;
         if actasmregister<>NR_NO then
           begin
             result:=true;

+ 7 - 1
rtl/m68k/setjump.inc

@@ -56,7 +56,13 @@ Procedure fpc_longJmp (Var S : Jmp_buf; value : longint); assembler;nostackframe
 asm
   // load S to a0
   move.l 4(sp),a0
-
+  // load 'value' to d0
+  move.l 8(sp),d0
+  // don't return zero
+  tst.l  d0
+  seq    d1
+  and.l #1,d1
+  or    d1,d0
   // restore FP
   move.l (a0),fp
   // restore SP