Browse Source

* fixed mmap for non-i386 non-m68k architectures (not sure about
x86-64)

Jonas Maebe 22 years ago
parent
commit
8bd6d64c35
3 changed files with 54 additions and 6 deletions
  1. 21 1
      rtl/linux/ossysc.inc
  2. 27 1
      rtl/linux/powerpc/syscall.inc
  3. 6 4
      rtl/linux/powerpc/syscallh.inc

+ 21 - 1
rtl/linux/ossysc.inc

@@ -344,9 +344,18 @@ type
   end;
 
 
+{$ifdef i386}
+{$define OLDMMAP}
+{$endif i386}
+
+{$ifdef m68k}
+{$define OLDMMAP}
+{$endif m68k}
+
 Function Fpmmap(adr:pointer;len:size_t;prot:cint;flags:cint;fd:cint;off:off_t):pointer;  [public, alias : 'FPC_SYSC_MMAP'];
 // OFF_T procedure, and returns a pointer, NOT cint.
 
+{$ifdef OLDMMAP}
 var
   mmapargs : tmmapargs;
 begin
@@ -358,6 +367,13 @@ begin
   mmapargs.offset:=TSysParam(off);
   Fpmmap:=pointer(do_syscall(syscall_nr_mmap,TSysParam(@MMapArgs)));
 end;
+{$else OLDMMAP}
+begin
+  Fpmmap:= pointer(do_syscall(syscall_nr_mmap,TSysParam(adr),TSysParam(len),
+    TSysParam(prot),TSysParam(flags),TSysParam(fd),TSysParam(off)));
+end;
+{$endif OLDMMAP}
+
 
 Function Fpmunmap(adr:pointer;len:size_t):cint; [public, alias :'FPC_SYSC_MUNMAP'];
 begin
@@ -431,7 +447,11 @@ end;
 
 {
  $Log$
- Revision 1.2  2002-12-18 17:38:01  marco
+ Revision 1.3  2003-05-11 16:07:55  jonas
+   * fixed mmap for non-i386 non-m68k architectures (not sure about
+     x86-64)
+
+ Revision 1.2  2002/12/18 17:38:01  marco
   * small fix, new rtl now cycles
 
  Revision 1.1  2002/12/18 16:43:26  marco

+ 27 - 1
rtl/linux/powerpc/syscall.inc

@@ -131,6 +131,28 @@ asm
    li    r3,-1
 end;
 
+
+function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
+{
+  This function puts the registers in place, does the call, and then
+  copies back the registers as they are after the SysCall.
+}
+asm
+  mr  r0,r3
+  mr  r3,r4
+  mr  r4,r5
+  mr  r5,r6
+  mr  r6,r7
+  mr  r7,r8
+  mr  r8,r9
+  sc
+   bnslr
+   neg   r3, r3
+   lis   r4,Errno@ha
+   stw   r3,Errno@l(r4)
+   li    r3,-1
+end;
+
 // Old style syscall:
 // Better use ktrace/strace/gdb for debugging.
 
@@ -216,7 +238,11 @@ end;
 
 {
   $Log$
-  Revision 1.4  2003-04-22 17:07:55  florian
+  Revision 1.5  2003-05-11 16:07:55  jonas
+    * fixed mmap for non-i386 non-m68k architectures (not sure about
+      x86-64)
+
+  Revision 1.4  2003/04/22 17:07:55  florian
     * there where two SYSCALL1 procedures for the powerpc, fixed
 
   Revision 1.3  2003/01/09 13:38:26  florian

+ 6 - 4
rtl/linux/powerpc/syscallh.inc

@@ -40,13 +40,15 @@ function Do_SysCall(sysnr,param1,param2:TSysParam):TSysResult;  external name 'F
 function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
 function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult;  external name 'FPC_SYSCALL5';
-{$ifdef notsupported}
-function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;  external name 'FPC_SYSCALL5';
-{$endif notsupported}
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult;  external name 'FPC_SYSCALL6';
 
 {
   $Log$
-  Revision 1.1  2002-12-22 16:00:28  jonas
+  Revision 1.2  2003-05-11 16:07:55  jonas
+    * fixed mmap for non-i386 non-m68k architectures (not sure about
+      x86-64)
+
+  Revision 1.1  2002/12/22 16:00:28  jonas
     + added syscallh.inc, adapted syscall.inc
 
   Revision 1.3  2002/12/18 20:41:33  peter