Compare commits

...

2 Commits

Author SHA1 Message Date
9cdf9aa71b
core/x86_64: Make in/out wrappers inline 2025-02-17 23:04:58 +01:00
c455e8ea0b
core: Fix a small error in thread.zig 2025-02-17 23:04:43 +01:00
2 changed files with 7 additions and 7 deletions

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),

View File

@ -59,7 +59,7 @@ pub fn switchTask(regs: *interrupts.InterruptStackFrame, new_task: *ThreadContro
pub fn fetchNewTask(core: *cpu.arch.Core, should_idle_if_not_found: bool) ?*ThreadControlBlock { pub fn fetchNewTask(core: *cpu.arch.Core, should_idle_if_not_found: bool) ?*ThreadControlBlock {
const last = core.thread_list.last orelse { const last = core.thread_list.last orelse {
if (should_idle_if_not_found) { if (should_idle_if_not_found) {
return &core.idle_thread; return &core.idle_thread.data;
} else return null; } else return null;
}; };