Browse Source

* changed the 'register' and 'cdecl' calling conventions on i8086, so they don't
modify the SI and DI registers. For 'register', this makes it compatible with
Borland C++'s __fastcall calling convention, while 'cdecl' becomes compatible
with Borland C, Microsoft C and Watcom C.

git-svn-id: trunk@38824 -

nickysn 7 years ago
parent
commit
9a6e490699
1 changed files with 19 additions and 2 deletions
  1. 19 2
      compiler/i8086/cpupara.pas

+ 19 - 2
compiler/i8086/cpupara.pas

@@ -210,9 +210,10 @@ unit cpupara;
           pocall_internproc :
             result:=[];
           pocall_register,
+          pocall_cdecl:
+            result:=[RS_AX,RS_DX,RS_CX,RS_BX];
           pocall_safecall,
           pocall_stdcall,
-          pocall_cdecl,
           pocall_cppdecl,
           pocall_mwpascal,
           pocall_far16,
@@ -239,9 +240,25 @@ unit cpupara;
 
     function tcpuparamanager.get_saved_registers_int(calloption : tproccalloption):tcpuregisterarray;
       const
+        saveregs_cdecl: array [0..2] of tsuperregister = (RS_BP,RS_SI,RS_DI);
         saveregs_pascal: array [0..0] of tsuperregister = (RS_BP);
       begin
-        result:=saveregs_pascal;
+        case calloption of
+          pocall_register,
+          pocall_cdecl:
+            result:=saveregs_cdecl;
+          pocall_internproc,
+          pocall_safecall,
+          pocall_stdcall,
+          pocall_cppdecl,
+          pocall_mwpascal,
+          pocall_far16,
+          pocall_pascal,
+          pocall_oldfpccall :
+            result:=saveregs_pascal;
+          else
+            internalerror(2018042301);
+        end;
       end;