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