Browse Source

* fixed calling sequence for subroutines using the aix abi

florian 22 years ago
parent
commit
999b859bc8
2 changed files with 27 additions and 5 deletions
  1. 21 3
      compiler/powerpc/cpupara.pas
  2. 6 2
      compiler/systems/i_linux.pas

+ 21 - 3
compiler/powerpc/cpupara.pas

@@ -43,7 +43,7 @@ unit cpupara;
   implementation
   implementation
 
 
     uses
     uses
-       verbose,
+       verbose,systems,
        cpuinfo,cginfo,cgbase,
        cpuinfo,cginfo,cgbase,
        defutil;
        defutil;
 
 
@@ -162,6 +162,8 @@ unit cpupara;
                 hp.paraloc.loc:=LOC_REGISTER;
                 hp.paraloc.loc:=LOC_REGISTER;
                 hp.paraloc.register:=nextintreg;
                 hp.paraloc.register:=nextintreg;
                 inc(nextintreg.number,NR_R1-NR_R0);
                 inc(nextintreg.number,NR_R1-NR_R0);
+                if target_info.abi=abi_powerpc_aix then
+                  inc(stack_offset,4);
              end
              end
            else
            else
               begin
               begin
@@ -178,7 +180,14 @@ unit cpupara;
          nextintreg.number:=NR_R3;
          nextintreg.number:=NR_R3;
          nextfloatreg.enum:=R_F1;
          nextfloatreg.enum:=R_F1;
          nextmmreg.enum:=R_M1;
          nextmmreg.enum:=R_M1;
-         stack_offset:=0;
+         case target_info.abi of
+           abi_powerpc_aix:
+             stack_offset:=24;
+           abi_powerpc_sysv:
+             stack_offset:=8;
+           else
+             internalerror(2003051901);
+         end;
 
 
          { frame pointer for nested procedures? }
          { frame pointer for nested procedures? }
          { inc(nextintreg);                     }
          { inc(nextintreg);                     }
@@ -206,10 +215,14 @@ unit cpupara;
                            hp.paraloc.loc:=LOC_REGISTER;
                            hp.paraloc.loc:=LOC_REGISTER;
                            hp.paraloc.registerlow:=nextintreg;
                            hp.paraloc.registerlow:=nextintreg;
                            inc(nextintreg.number,NR_R1-NR_R0);
                            inc(nextintreg.number,NR_R1-NR_R0);
+                           if target_info.abi=abi_powerpc_aix then
+                             inc(stack_offset,4);
                            if is_64bit then
                            if is_64bit then
                              begin
                              begin
                                hp.paraloc.registerhigh:=nextintreg;
                                hp.paraloc.registerhigh:=nextintreg;
                                inc(nextintreg.number,NR_R1-NR_R0);
                                inc(nextintreg.number,NR_R1-NR_R0);
+                               if target_info.abi=abi_powerpc_aix then
+                                 inc(stack_offset,4);
                              end;
                              end;
                         end
                         end
                       else
                       else
@@ -233,6 +246,8 @@ unit cpupara;
                            hp.paraloc.loc:=LOC_FPUREGISTER;
                            hp.paraloc.loc:=LOC_FPUREGISTER;
                            hp.paraloc.register:=nextfloatreg;
                            hp.paraloc.register:=nextfloatreg;
                            inc(nextfloatreg.enum);
                            inc(nextfloatreg.enum);
+                           if target_info.abi=abi_powerpc_aix then
+                             inc(stack_offset,8);
                         end
                         end
                       else
                       else
                          begin
                          begin
@@ -317,7 +332,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2003-05-12 20:14:47  florian
+  Revision 1.30  2003-05-19 12:15:28  florian
+    * fixed calling sequence for subroutines using the aix abi
+
+  Revision 1.29  2003/05/12 20:14:47  florian
     * fixed parameter passing by value of large sets, strings and method pointers
     * fixed parameter passing by value of large sets, strings and method pointers
 
 
   Revision 1.28  2003/05/11 23:19:32  florian
   Revision 1.28  2003/05/11 23:19:32  florian

+ 6 - 2
compiler/systems/i_linux.pas

@@ -218,7 +218,8 @@ unit i_linux;
             stacksize    : 32*1024*1024;
             stacksize    : 32*1024*1024;
             DllScanSupported:false;
             DllScanSupported:false;
             use_function_relative_addresses : true;
             use_function_relative_addresses : true;
-            abi : abi_powerpc_sysv;
+            { abi_powerpc_sysv doesn't work yet }
+            abi : abi_powerpc_aix;
           );
           );
 
 
        system_alpha_linux_info : tsysteminfo =
        system_alpha_linux_info : tsysteminfo =
@@ -447,7 +448,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2003-05-18 15:15:59  florian
+  Revision 1.7  2003-05-19 12:15:28  florian
+    * fixed calling sequence for subroutines using the aix abi
+
+  Revision 1.6  2003/05/18 15:15:59  florian
     + added abi field to tsysteminfo
     + added abi field to tsysteminfo
 
 
   Revision 1.5  2003/04/30 15:45:35  florian
   Revision 1.5  2003/04/30 15:45:35  florian