From 63289deade17fab6cb5862103713fc0a5d178ed7 Mon Sep 17 00:00:00 2001 From: josh Date: Mon, 20 Jul 2009 19:21:20 +0000 Subject: [PATCH] updated include/portio.h to not use gcc-specific "statement blocks" but instead have inportX() be static inline functions. Verified that the compiler does in fact inline them git-svn-id: svn://anubis/hos/trunk@60 5b3e749e-e535-0410-8002-a9bb6afbdfca --- kernel/include/portio.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/kernel/include/portio.h b/kernel/include/portio.h index fbf4484..9a9f762 100755 --- a/kernel/include/portio.h +++ b/kernel/include/portio.h @@ -13,25 +13,25 @@ #define outportd(port, val) \ __asm__ __volatile__ ("outl %%eax, %%dx" : : "a" (val), "d" (port)); -#define inportb(port) \ - ({ \ - u8_t val; \ - __asm__ __volatile__ ("inb %%dx, %%al" : "=a" (val) : "d" (port)); \ - val; \ - }); +static inline u8_t inportb(u16_t port) +{ + u8_t val; + __asm__ __volatile__ ("inb %%dx, %%al" : "=a" (val) : "d" (port)); + return val; +} -#define inportw(port) \ - ({ \ - u16_t val; \ - __asm__ __volatile__ ("inw %%dx, %%al" : "=a" (val) : "d" (port)); \ - val; \ - }); +static inline u16_t inportw(u16_t port) +{ + u16_t val; + __asm__ __volatile__ ("inw %%dx, %%al" : "=a" (val) : "d" (port)); + return val; +} -#define inportd(port) \ - ({ \ - u32_t val; \ - __asm__ __volatile__ ("inl %%dx, %%al" : "=a" (val) : "d" (port)); \ - val; \ - }); +static inline u32_t inportd(u16_t port) +{ + u32_t val; + __asm__ __volatile__ ("inl %%dx, %%al" : "=a" (val) : "d" (port)); + return val; +} #endif