瀏覽代碼

+ added framework code for AmigaOS/PPC syscall support

git-svn-id: trunk@2239 -
Károly Balogh 19 年之前
父節點
當前提交
b718d9ff37
共有 4 個文件被更改,包括 31 次插入5 次删除
  1. 2 0
      compiler/parser.pas
  2. 19 5
      compiler/pdecsub.pas
  3. 8 0
      compiler/powerpc/nppccal.pas
  4. 2 0
      compiler/scandir.pas

+ 2 - 0
compiler/parser.pas

@@ -119,6 +119,8 @@ implementation
 
          { target specific stuff }
          case target_info.system of
+           system_powerpc_amiga:
+             include(supported_calling_conventions,pocall_syscall);
            system_powerpc_morphos:
              include(supported_calling_conventions,pocall_syscall);
            system_m68k_amiga:

+ 19 - 5
compiler/pdecsub.pas

@@ -1314,7 +1314,7 @@ var
   symtable : tsymtable;
 {$endif defined(powerpc) or defined(m68k)}
 begin
-  if pd.deftype<>procdef then
+  if (pd.deftype<>procdef) and (target_info.system <> system_powerpc_amiga) then
     internalerror(2003042614);
   tprocdef(pd).forwarddef:=false;
 {$ifdef m68k}
@@ -1343,10 +1343,20 @@ begin
         end;
       (paramanager as tm68kparamanager).create_funcretloc_info(pd,calleeside);
       (paramanager as tm68kparamanager).create_funcretloc_info(pd,callerside);
+  
+      tprocdef(pd).extnumber:=get_intconst;
     end;
 {$endif m68k}
 {$ifdef powerpc}
-   if target_info.system in [system_powerpc_morphos] then
+   if target_info.system = system_powerpc_amiga then
+    begin
+      include(pd.procoptions,po_syscall_sysv);
+      
+      (paramanager as tppcparamanager).create_funcretloc_info(pd,calleeside);
+      (paramanager as tppcparamanager).create_funcretloc_info(pd,callerside);
+    end else
+    
+   if target_info.system = system_powerpc_morphos then
     begin
       if idtoken=_LEGACY then
         begin
@@ -1366,7 +1376,7 @@ begin
       else if idtoken=_SYSVBASE then
         begin
           consume(_SYSVBASE);
-          include(pd.procoptions,po_syscall_sysvbase);
+          include(pd.procoptions,po_syscall_sysvbase);    
         end
       else if idtoken=_R12BASE then
         begin
@@ -1430,9 +1440,10 @@ begin
         end;
       (paramanager as tppcparamanager).create_funcretloc_info(pd,calleeside);
       (paramanager as tppcparamanager).create_funcretloc_info(pd,callerside);
+
+      tprocdef(pd).extnumber:=get_intconst;
     end;
 {$endif powerpc}
-  tprocdef(pd).extnumber:=get_intconst;
 end;
 
 
@@ -1802,7 +1813,10 @@ const
       mutexclpo     : [po_external]
     ),(
       idtok:_SYSCALL;
-      pd_flags : [pd_interface,pd_implemen,pd_notobject,pd_notobjintf];
+      { Different kind of syscalls are valid for AOS68k, AOSPPC and MOS. }
+      { FIX ME!!! MorphOS/AOS68k pd_flags should be: 
+        pd_interface, pd_implemen, pd_notobject, pd_notobjintf (KB) }
+      pd_flags : [pd_interface,pd_implemen,pd_procvar];
       handler  : @pd_syscall;
       pocall   : pocall_syscall;
       pooption : [];

+ 8 - 0
compiler/powerpc/nppccal.pas

@@ -68,6 +68,14 @@ implementation
         tmpref: treference;
       begin
         case target_info.system of
+          system_powerpc_amiga:
+            begin
+              // one syscall convention for Amiga/PowerPC
+              // which is quite standard
+              extra_call_code;
+              cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
+              extra_post_call_code;
+            end;
           system_powerpc_morphos:
             begin
               if (po_syscall_sysv in tprocdef(procdefinition).procoptions) or

+ 2 - 0
compiler/scandir.pas

@@ -914,6 +914,8 @@ implementation
       begin
         { not needed on amiga/m68k for now, because there's only one }
         { syscall convention (legacy) (KB) }
+        { not needed on amiga/powerpc because there's only one }
+        { syscall convention (sysv) (KB) }
         if not (target_info.system in [system_powerpc_morphos]) then
           comment (V_Warning,'Syscall directive is useless on this target.');
         current_scanner.skipspace;