فهرست منبع

* aros64: recent developments hanged the library call ABI, lets try to follow it (aros64 is experimental)

Karoly Balogh 3 سال پیش
والد
کامیت
568d4de77e
4فایلهای تغییر یافته به همراه20 افزوده شده و 5 حذف شده
  1. 1 1
      compiler/pdecsub.pas
  2. 1 1
      compiler/syscinfo.pas
  3. 15 0
      compiler/x86_64/cpupara.pas
  4. 3 3
      compiler/x86_64/nx64cal.pas

+ 1 - 1
compiler/pdecsub.pas

@@ -2197,7 +2197,7 @@ procedure pd_syscall(pd:tabstractprocdef);
                 system_i386_aros:
                     result:='eax';
                 system_x86_64_aros:
-                    result:='rax';
+                    result:='r12';
                 system_powerpc_morphos:
                     result:='r12';
                 else

+ 1 - 1
compiler/syscinfo.pas

@@ -81,7 +81,7 @@ const
       ( system: system_powerpc_morphos; procoption: po_syscall_legacy ),
       ( system: system_arm_aros;        procoption: po_syscall_baselast ),
       ( system: system_i386_aros;       procoption: po_syscall_baselast ),
-      ( system: system_x86_64_aros;     procoption: po_syscall_baselast ));
+      ( system: system_x86_64_aros;     procoption: po_syscall_basereg ));
 
 var
   default_syscall_convention: tprocoption = po_none;

+ 15 - 0
compiler/x86_64/cpupara.pas

@@ -1659,6 +1659,21 @@ unit cpupara;
           begin
             hp:=tparavarsym(paras[i]);
             paradef:=hp.vardef;
+
+            { in syscalls the libbase might be set as explicit paraloc }
+            if (vo_has_explicit_paraloc in hp.varoptions) then
+              if not (vo_is_syscall_lib in hp.varoptions) then
+                internalerror(2022010501)
+              else
+                begin
+                  paracgsize:=def_cgsize(paradef);
+                  hp.paraloc[side].def:=paradef;
+                  hp.paraloc[side].size:=paracgsize;
+                  hp.paraloc[side].intsize:=tcgsize2size[paracgsize];
+                  hp.paraloc[side].alignment:=sizeof(pint);
+                  continue;
+                end;
+
             { on win64, if a record has only one field and that field is a
               single or double, it has to be handled like a single/double }
             if use_ms_abi and

+ 3 - 3
compiler/x86_64/nx64cal.pas

@@ -61,11 +61,11 @@ implementation
                 begin
                   current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('AROS SysCall')));
 
-                  cg.getcpuregister(current_asmdata.CurrAsmList,NR_RAX);
-                  get_syscall_call_ref(tmpref,NR_RAX);
+                  cg.getcpuregister(current_asmdata.CurrAsmList,NR_R12);
+                  get_syscall_call_ref(tmpref,NR_R12);
 
                   current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_CALL,S_NO,tmpref));
-                  cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RAX);
+                  cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R12);
                   exit;
                 end;
               internalerror(2016120101);