Jelajahi Sumber

* ioperm/iopl added from linuxold. Untested but will probably work

marco 21 tahun lalu
induk
melakukan
88d81ba3d4
1 mengubah file dengan 47 tambahan dan 0 penghapusan
  1. 47 0
      rtl/unix/x86.pp

+ 47 - 0
rtl/unix/x86.pp

@@ -1,7 +1,25 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1997-2004 by the Free Pascal development team
+
+    Some x86 specific stuff. Has to be fixed still for *BSD
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY;without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
 unit x86;
 
 interface
 
+Uses BaseUnix;
+
 function ReadPortB (Port : Longint): Byte; 
 function ReadPortW (Port : Longint): Word; 
 function ReadPortL (Port : Longint): Longint;
@@ -21,9 +39,14 @@ Procedure WritePortW (Port : Longint; Value : Word);
 Procedure WritePortW (Port : Longint; Var Buf; Count: longint);
 Procedure WritePortl (Port : Longint; Var Buf; Count: longint);
 
+Function  fpIOperm (From,Num : Cardinal; Value : cint) : cint;
+Function  fpIoPL(Level : cint) : cint;
+
 implementation
 {$ASMMODE ATT}
 
+Uses Syscall;
+
 Procedure WritePort (Port : Longint; Value : Byte);
 {
   Writes 'Value' to port 'Port'
@@ -286,4 +309,28 @@ begin
   end ['ECX','EDI','EDX'];
 end;
 
+Function  fpIOperm (From,Num : Cardinal; Value : cint) : cint;
+{
+  Set permissions on NUM ports starting with port FROM to VALUE
+  this works ONLY as root.
+}
+
+begin
+  fpIOPerm:=do_Syscall(Syscall_nr_ioperm,TSysParam(From),TSysParam(Num),TSysParam(Value));
+end;
+
+Function fpIoPL(Level : cint) : cint;
+
+begin
+  fpIOPL:=do_Syscall(Syscall_nr_iopl,TSysParam(Level));
+end;
+
+
 end.
+
+{
+  $Log$
+  Revision 1.3  2004-04-12 10:31:58  marco
+   * ioperm/iopl added from linuxold. Untested but will probably work
+
+}