core/x86_64: Make in/out wrappers inline

This commit is contained in:
Gabriel 2025-02-17 23:04:58 +01:00
parent 13445bac1f
commit 9cbb043238

View File

@ -1,11 +1,11 @@
pub fn inb(port: u16) u8 { pub inline fn inb(port: u16) u8 {
return asm volatile ("inb %[port], %[result]" return asm volatile ("inb %[port], %[result]"
: [result] "={al}" (-> u8), : [result] "={al}" (-> u8),
: [port] "N{dx}" (port), : [port] "N{dx}" (port),
); );
} }
pub fn outb(port: u16, value: u8) void { pub inline fn outb(port: u16, value: u8) void {
return asm volatile ("outb %[data], %[port]" return asm volatile ("outb %[data], %[port]"
: :
: [port] "{dx}" (port), : [port] "{dx}" (port),
@ -13,14 +13,14 @@ pub fn outb(port: u16, value: u8) void {
); );
} }
pub fn inw(port: u16) u16 { pub inline fn inw(port: u16) u16 {
return asm volatile ("inw %[port], %[result]" return asm volatile ("inw %[port], %[result]"
: [result] "={ax}" (-> u16), : [result] "={ax}" (-> u16),
: [port] "N{dx}" (port), : [port] "N{dx}" (port),
); );
} }
pub fn outw(port: u16, value: u16) void { pub inline fn outw(port: u16, value: u16) void {
return asm volatile ("outw %[data], %[port]" return asm volatile ("outw %[data], %[port]"
: :
: [port] "{dx}" (port), : [port] "{dx}" (port),
@ -28,14 +28,14 @@ pub fn outw(port: u16, value: u16) void {
); );
} }
pub fn inl(port: u16) u32 { pub inline fn inl(port: u16) u32 {
return asm volatile ("inl %[port], %[result]" return asm volatile ("inl %[port], %[result]"
: [result] "={eax}" (-> u16), : [result] "={eax}" (-> u16),
: [port] "N{dx}" (port), : [port] "N{dx}" (port),
); );
} }
pub fn outl(port: u16, value: u32) void { pub inline fn outl(port: u16, value: u32) void {
return asm volatile ("outw %[data], %[port]" return asm volatile ("outw %[data], %[port]"
: :
: [port] "{dx}" (port), : [port] "{dx}" (port),