summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/ts_386ex/tools/ts_1325_ada/i386_ports.adb
blob: 9705d069d85de16e773c774c8bc5e53963ced148 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
with System.Machine_Code;
use System.Machine_Code;

package body I386_Ports is

   procedure Outport (Addr: in Port_Address; Data: in Byte) is
   begin
      Asm ("movb %0, %%al;" &
           "movw %1, %%dx;" &
           "outb %%al, %%dx",
           No_Output_Operands,
           (Byte'Asm_Input ("g", Data),
            Port_Address'Asm_Input ("g", Addr)),
           Clobber => "al dx",
           Volatile => True);
   end Outport;

   procedure Inport (Addr: in Port_Address; Data: out Byte) is
   begin
      Asm ("movw %1, %%dx;"   &
           "inb %%dx, %%al;"  &
           "movb %%al, %0",
           Byte'Asm_Output ("=g", Data),
           Port_Address'Asm_Input ("g", Addr),
           Clobber => "dx al",
           Volatile => True);
   end Inport;

end I386_Ports;