diff --git a/arch/x86/include/arch/port.h b/arch/x86/include/arch/port.h index 0823794..598cc4d 100644 --- a/arch/x86/include/arch/port.h +++ b/arch/x86/include/arch/port.h @@ -28,12 +28,12 @@ * @param port Port number * @return The byte that was read */ -inline u8 x86_inb(u16 port) +static inline u8 x86_inb(u16 port) { u8 data; __asm__ volatile( -" inb %1, %0 \n" +" inb %w1, %b0 \n" : "=a"(data) : "Nd"(port) ); @@ -47,12 +47,12 @@ inline u8 x86_inb(u16 port) * @param port Port number * @return The word that was read */ -inline u16 x86_inw(u16 port) +static inline u16 x86_inw(u16 port) { u16 data; __asm__ volatile( -" inw %1, %0 \n" +" inw %w1, %w0 \n" : "=a"(data) : "Nd"(port) ); @@ -66,12 +66,12 @@ inline u16 x86_inw(u16 port) * @param port Port number * @return The longword that was read */ -inline u32 x86_inl(u16 port) +static inline u32 x86_inl(u16 port) { u32 data; __asm__ volatile( -" inl %1, %0 \n" +" inl %w1, %l0 \n" : "=a"(data) : "Nd"(port) ); @@ -85,10 +85,10 @@ inline u32 x86_inl(u16 port) * @param port Port number * @param data Byte to send through the port */ -inline void x86_outb(u16 port, u8 data) +static inline void x86_outb(u16 port, u8 data) { __asm__ volatile( -" outb %0, %1 \n" +" outb %b0, %w1 \n" : : "a"(data), "Nd"(port) ); @@ -100,10 +100,10 @@ inline void x86_outb(u16 port, u8 data) * @param port Port number * @param data Word to send through the port */ -inline void x86_outw(u16 port, u16 data) +static inline void x86_outw(u16 port, u16 data) { __asm__ volatile( -" outw %0, %1 \n" +" outw %w0, %w1 \n" : : "a"(data), "Nd"(port) ); @@ -115,17 +115,17 @@ inline void x86_outw(u16 port, u16 data) * @param port Port number * @param data Longword to send through the port */ -inline void x86_outl(u16 port, u32 data) +static inline void x86_outl(u16 port, u32 data) { __asm__ volatile( -" outl %0, %1 \n" +" outl %l0, %w1 \n" : : "a"(data), "Nd"(port) ); } /** @brief Induce a brief CPU delay by writing zero to I/O port `0x80`. */ -inline void x86_io_wait(void) +static inline void x86_io_wait(void) { x86_outb(0x80, 0); } diff --git a/arch/x86/sys/i386/CMakeLists.txt b/arch/x86/sys/i386/CMakeLists.txt index 788dfd2..310ed5d 100644 --- a/arch/x86/sys/i386/CMakeLists.txt +++ b/arch/x86/sys/i386/CMakeLists.txt @@ -3,7 +3,6 @@ target_sources(gay_arch PRIVATE idt.S irq.S - port.S switch.S systm.c trap.S diff --git a/arch/x86/sys/i386/port.S b/arch/x86/sys/i386/port.S deleted file mode 100644 index a0dfd1d..0000000 --- a/arch/x86/sys/i386/port.S +++ /dev/null @@ -1,74 +0,0 @@ -/* See the end of this file for copyright and license terms. */ - -#include - - .text - -/* void x86_io_wait(void); */ -ASM_ENTRY(x86_io_wait) - xor %al, %al - outb %al, $0x80 - ret -ASM_END(x86_io_wait) - -/* u8 x86_inb(u16 port); */ -ASM_ENTRY(x86_inb) - mov 4(%esp), %edx - xor %eax, %eax - inb %dx, %al - ret -ASM_END(x86_inb) - -/* u16 x86_inw(u16 port); */ -ASM_ENTRY(x86_inw) - mov 4(%esp), %edx - xor %eax, %eax - inw %dx, %ax - ret -ASM_END(x86_inw) - -/* u32 x86_inl(u16 port); */ -ASM_ENTRY(x86_inl) - mov 4(%esp), %edx - xor %eax, %eax - inl %dx, %eax - ret -ASM_END(x86_inl) - -/* void x86_outb(u16 port, u8 data); */ -ASM_ENTRY(x86_outb) - mov 4(%esp), %edx - mov 8(%esp), %eax - outb %al, %dx - ret -ASM_END(x86_outb) - -/* void x86_outw(u16 port, u16 data); */ -ASM_ENTRY(x86_outw) - mov 4(%esp), %edx - mov 8(%esp), %eax - outw %ax, %dx - ret -ASM_END(x86_outw) - -/* void x86_outl(u16 port, u32 data); */ -ASM_ENTRY(x86_outl) - mov 4(%esp), %edx - mov 8(%esp), %eax - outl %eax, %dx - ret -ASM_END(x86_outl) - -/* - * This file is part of GayBSD. - * Copyright (c) 2021 fef . - * - * GayBSD is nonviolent software: you may only use, redistribute, and/or - * modify it under the terms of the Cooperative Nonviolent Public License - * (CNPL) as found in the LICENSE file in the source code root directory - * or at ; either version 7 - * of the license, or (at your option) any later version. - * - * GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent - * permitted by applicable law. See the CNPL for details. - */