Browse Source

m68k-palmos: fixed the syscall generation, and improved it to support the dispatch-selector-in-reg-D2 traps

git-svn-id: trunk@36892 -
Károly Balogh 8 years ago
parent
commit
addc3a2f94
5 changed files with 26 additions and 6 deletions
  1. 9 2
      compiler/m68k/n68kcal.pas
  2. 12 2
      compiler/pdecsub.pas
  3. 1 1
      compiler/ppu.pas
  4. 2 0
      compiler/symconst.pas
  5. 2 1
      compiler/utils/ppuutils/ppudump.pp

+ 9 - 2
compiler/m68k/n68kcal.pas

@@ -102,8 +102,15 @@ implementation
             begin
               if po_syscall in tprocdef(procdefinition).procoptions then
                 begin
-                  current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_MOVE,S_W,tprocdef(procdefinition).import_nr,NR_D0));
-                  current_asmdata.CurrAsmList.concat(taicpu.op_const(A_TRAP,S_NO,tprocdef(procdefinition).extnumber));
+                  if po_syscall_has_importnr in tprocdef(procdefinition).procoptions then
+                    begin
+                      cg.getcpuregister(current_asmdata.CurrAsmList,NR_D2);
+                      current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_MOVE,S_L,tprocdef(procdefinition).import_nr,NR_D2));
+                    end;
+                  current_asmdata.CurrAsmList.concat(taicpu.op_const(A_TRAP,S_NO,15));
+                  current_asmdata.CurrAsmList.concat(tai_const.create_16bit(tprocdef(procdefinition).extnumber));
+                  if po_syscall_has_importnr in tprocdef(procdefinition).procoptions then
+                    cg.getcpuregister(current_asmdata.CurrAsmList,NR_D2);
                 end
               else
                 internalerror(2017081201);

+ 12 - 2
compiler/pdecsub.pas

@@ -2183,8 +2183,18 @@ begin
   if target_info.system = system_m68k_palmos then
     begin
       v:=get_intconst;
-      tprocdef(pd).import_nr:=longint(v.svalue);
-      tprocdef(pd).extnumber:=15;
+      tprocdef(pd).extnumber:=longint(v.svalue);
+      if ((v<0) or (v>high(word))) then
+        message(parser_e_range_check_error);
+
+      if try_to_consume(_COMMA) then
+        begin
+          v:=get_intconst;
+          if ((v<0) or (v>high(word))) then
+            message(parser_e_range_check_error);
+          tprocdef(pd).import_nr:=longint(v.svalue);
+          include(pd.procoptions,po_syscall_has_importnr);
+        end;
       exit;
     end;
 

+ 1 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion = 193;
+  CurrentPPUVersion = 194;
 
 { unit flags }
   uf_init                = $000001; { unit has initialization section }

+ 2 - 0
compiler/symconst.pas

@@ -355,6 +355,8 @@ type
     po_syscall_basereg,
     { Used to record the fact that a symbol is associated to this syscall }
     po_syscall_has_libsym,
+    { Syscall uses the import Nr. }
+    po_syscall_has_importnr,
     { Procedure can be inlined }
     po_inline,
     { Procedure is used for internal compiler calls }

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -111,7 +111,7 @@ const
   { 22 }  'Solaris-sparc',
   { 23 }  'Linux-sparc',
   { 24 }  'OpenBSD-i386',
-  { 25 }  'OpenBSD-m68k',
+  { 25 }  'OpenBSD-m68k (obsolete)',
   { 26 }  'Linux-x86-64',
   { 27 }  'Darwin-ppc',
   { 28 }  'OS/2 via EMX',
@@ -1951,6 +1951,7 @@ const
      (mask:po_syscall_baselast;str:'SyscallBaseLast'),
      (mask:po_syscall_basereg; str:'SyscallBaseReg'),
      (mask:po_syscall_has_libsym; str:'Has LibSym'),
+     (mask:po_syscall_has_importnr; str:'Uses ImportNr'),
      (mask:po_inline;          str:'Inline'),
      (mask:po_compilerproc;    str:'CompilerProc'),
      (mask:po_has_importdll;   str:'HasImportDLL'),