2
0
Эх сурвалжийг харах

* fixed x86 unit for x86-64
* enabled ports again for x86_64-linux

git-svn-id: trunk@11360 -

florian 17 жил өмнө
parent
commit
5ff2312993

+ 1 - 1
rtl/linux/Makefile

@@ -280,7 +280,7 @@ CPU_UNITS=x86 ports cpu mmx
 SYSINIT_UNITS=si_prc si_c21g si_c21 si_c si_dll si_uc
 endif
 ifeq ($(ARCH),x86_64)
-CPU_UNITS=
+CPU_UNITS=x86 ports
 SYSINIT_UNITS=   # si_prc si_c si_dll
 endif
 ifeq ($(ARCH),arm)

+ 1 - 1
rtl/linux/Makefile.fpc

@@ -72,7 +72,7 @@ SYSINIT_UNITS=si_prc si_c21g si_c21 si_c si_dll si_uc
 endif
 
 ifeq ($(ARCH),x86_64)
-CPU_UNITS=
+CPU_UNITS=x86 ports
 SYSINIT_UNITS=   # si_prc si_c si_dll
 endif
 

+ 173 - 29
rtl/unix/x86.pp

@@ -51,11 +51,18 @@ Procedure WritePort (Port : Longint; Value : Byte);
   Writes 'Value' to port 'Port'
 }
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         movb value,%al
         outb %al,%dx
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        movb value,%al
+        outb %al,%dx
+{$endif CPUX86_64}        
+  end;
 end;
 
 Procedure WritePort (Port : Longint; Value : Word);
@@ -64,11 +71,18 @@ Procedure WritePort (Port : Longint; Value : Word);
 }
 
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         movw value,%ax
         outw %ax,%dx
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        movw value,%ax
+        outw %ax,%dx
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -77,13 +91,19 @@ Procedure WritePort (Port : Longint; Value : Longint);
 {
   Writes 'Value' to port 'Port'
 }
-
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         movl value,%eax
         outl %eax,%dx
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        movl value,%eax
+        outl %eax,%dx
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -92,11 +112,18 @@ Procedure WritePortB (Port : Longint; Value : Byte);
   Writes 'Value' to port 'Port'
 }
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         movb value,%al
         outb %al,%dx
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        movb value,%al
+        outb %al,%dx
+{$endif CPUX86_64}        
+  end;
 end;
 
 Procedure WritePortW (Port : Longint; Value : Word);
@@ -105,11 +132,18 @@ Procedure WritePortW (Port : Longint; Value : Word);
 }
 
 begin
-        asm
+  asm
+{$ifdef CPU386}        
+        movl port,%edx
+        movw value,%ax
+        outw %ax,%dx
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
         movl port,%edx
         movw value,%ax
         outw %ax,%dx
-        end ['EAX','EDX'];
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -120,11 +154,18 @@ Procedure WritePortL (Port : Longint; Value : Longint);
 }
 
 begin
-        asm
+  asm
+{$ifdef CPU386}        
+        movl port,%edx
+        movl value,%eax
+        outl %eax,%dx
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
         movl port,%edx
         movl value,%eax
         outl %eax,%dx
-        end ['EAX','EDX'];
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -135,13 +176,23 @@ Procedure WritePortl (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%esi
         movl port,%edx
         cld
         rep
         outsl
-  end ['ECX','ESI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rsi
+        movl port,%edx
+        cld
+        rep
+        outsl
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -152,13 +203,23 @@ Procedure WritePortW (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%esi
         movl port,%edx
         cld
         rep
         outsw
-  end ['ECX','ESI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rsi
+        movl port,%edx
+        cld
+        rep
+        outsw
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -169,13 +230,23 @@ Procedure WritePortB (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%esi
         movl port,%edx
         cld
         rep
         outsb
-  end ['ECX','ESI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rsi
+        movl port,%edx
+        cld
+        rep
+        outsb
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -185,12 +256,20 @@ Procedure ReadPort (Port : Longint; Var Value : Byte);
   Reads 'Value' from port 'Port'
 }
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         inb %dx,%al
         movl value,%edx
         movb %al,(%edx)
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        inb %dx,%al
+        movq value,%rdx
+        movb %al,(%rdx)
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -200,12 +279,20 @@ Procedure ReadPort (Port : Longint; Var Value : Word);
   Reads 'Value' from port 'Port'
 }
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         inw %dx,%ax
         movl value,%edx
         movw %ax,(%edx)
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        inw %dx,%ax
+        movq value,%rdx
+        movw %ax,(%rdx)
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -215,12 +302,20 @@ Procedure ReadPort (Port : Longint; Var Value : Longint);
   Reads 'Value' from port 'Port'
 }
 begin
-        asm
+  asm
+{$ifdef CPU386}        
         movl port,%edx
         inl %dx,%eax
         movl value,%edx
         movl %eax,(%edx)
-        end ['EAX','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl port,%edx
+        inl %dx,%eax
+        movq value,%rdx
+        movl %eax,(%rdx)
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -229,31 +324,50 @@ function ReadPortB (Port : Longint): Byte; assembler;
 {
   Reads a byte from port 'Port'
 }
-
 asm
+{$ifdef CPU386}        
+  movl port,%edx
+  xorl %eax,%eax
+  inb %dx,%al
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
   movl port,%edx
   xorl %eax,%eax
   inb %dx,%al
-end ['EAX','EDX'];
+{$endif CPUX86_64}        
+end;
 
 function ReadPortW (Port : Longint): Word; assembler;
 {
   Reads a word from port 'Port'
 }
 asm
+{$ifdef CPU386}        
+  movl port,%edx
+  xorl %eax,%eax
+  inw %dx,%ax
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
   movl port,%edx
   xorl %eax,%eax
   inw %dx,%ax
-end ['EAX','EDX'];
+{$endif CPUX86_64}        
+end;
 
 function ReadPortL (Port : Longint): LongInt; assembler;
 {
   Reads a LongInt from port 'Port'
 }
 asm
+{$ifdef CPU386}        
+  movl port,%edx
+  inl %dx,%eax
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
   movl port,%edx
   inl %dx,%eax
-end ['EAX','EDX'];
+{$endif CPUX86_64}        
+end;
 
 Procedure ReadPortL (Port : Longint; Var Buf; Count: longint);
 {
@@ -261,13 +375,23 @@ Procedure ReadPortL (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%edi
         movl port,%edx
         cld
         rep
         insl
-  end ['ECX','EDI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rdi
+        movl port,%edx
+        cld
+        rep
+        insl
+{$endif CPUX86_64}        
+  end;
 end;
 
 
@@ -278,13 +402,23 @@ Procedure ReadPortW (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%edi
         movl port,%edx
         cld
         rep
         insw
-  end ['ECX','EDI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rdi
+        movl port,%edx
+        cld
+        rep
+        insw
+{$endif CPUX86_64}        
+  end;
 end;
 
 Procedure ReadPortB (Port : Longint; Var Buf; Count: longint);
@@ -293,13 +427,23 @@ Procedure ReadPortB (Port : Longint; Var Buf; Count: longint);
 }
 begin
   asm
+{$ifdef CPU386}        
         movl count,%ecx
         movl buf,%edi
         movl port,%edx
         cld
         rep
         insb
-  end ['ECX','EDI','EDX'];
+{$endif CPU386}        
+{$ifdef CPUX86_64}        
+        movl count,%ecx
+        movq buf,%rdi
+        movl port,%edx
+        cld
+        rep
+        insb
+{$endif CPUX86_64}        
+  end;
 end;
 
 {$ifdef linux}