xref: /DragonOS/kernel/src/arch/x86_64/asm/pio.rs (revision a03c4f9dee5705207325c56629c0ccd219168f10)
1 use crate::arch::io::PortIOArch;
2 
3 pub struct X86_64PortIOArch;
4 
5 impl PortIOArch for X86_64PortIOArch {
6     #[inline(always)]
in8(port: u16) -> u87     unsafe fn in8(port: u16) -> u8 {
8         x86::io::inb(port)
9     }
10 
11     #[inline(always)]
in16(port: u16) -> u1612     unsafe fn in16(port: u16) -> u16 {
13         x86::io::inw(port)
14     }
15 
16     #[inline(always)]
in32(port: u16) -> u3217     unsafe fn in32(port: u16) -> u32 {
18         x86::io::inl(port)
19     }
20 
21     #[inline(always)]
out8(port: u16, data: u8)22     unsafe fn out8(port: u16, data: u8) {
23         x86::io::outb(port, data)
24     }
25 
26     #[inline(always)]
out16(port: u16, data: u16)27     unsafe fn out16(port: u16, data: u16) {
28         x86::io::outw(port, data)
29     }
30 
31     #[inline(always)]
out32(port: u16, data: u32)32     unsafe fn out32(port: u16, data: u32) {
33         x86::io::outl(port, data)
34     }
35 }
36