diff options
Diffstat (limited to 'util/x86emu/yabel/compat')
-rw-r--r-- | util/x86emu/yabel/compat/functions.c | 50 | ||||
-rw-r--r-- | util/x86emu/yabel/compat/time.h | 3 |
2 files changed, 5 insertions, 48 deletions
diff --git a/util/x86emu/yabel/compat/functions.c b/util/x86emu/yabel/compat/functions.c index 4d1f1e4fda..6367fb025d 100644 --- a/util/x86emu/yabel/compat/functions.c +++ b/util/x86emu/yabel/compat/functions.c @@ -18,6 +18,7 @@ #include <device/device.h> #include "../debug.h" #include "../biosemu.h" +#include "../compat/time.h" #define VMEM_SIZE (1024 * 1024) /* 1 MB */ @@ -52,6 +53,8 @@ void run_bios(struct device * dev, unsigned long addr) } } +unsigned long tb_freq = 0; + u64 get_time(void) { u64 act; @@ -64,50 +67,3 @@ u64 get_time(void) act = ((u64) edx << 32) | eax; return act; } - -unsigned int -read_io(void *addr, size_t sz) -{ - unsigned int ret; - /* since we are using inb instructions, we need the port number as 16bit value */ - u16 port = (u16)(u32) addr; - - switch (sz) { - case 1: - asm volatile ("inb %1, %b0" : "=a"(ret) : "d" (port)); - break; - case 2: - asm volatile ("inw %1, %w0" : "=a"(ret) : "d" (port)); - break; - case 4: - asm volatile ("inl %1, %0" : "=a"(ret) : "d" (port)); - break; - default: - ret = 0; - } - - return ret; -} - -int -write_io(void *addr, unsigned int value, size_t sz) -{ - u16 port = (u16)(u32) addr; - switch (sz) { - /* since we are using inb instructions, we need the port number as 16bit value */ - case 1: - asm volatile ("outb %b0, %1" : : "a"(value), "d" (port)); - break; - case 2: - asm volatile ("outw %w0, %1" : : "a"(value), "d" (port)); - break; - case 4: - asm volatile ("outl %0, %1" : : "a"(value), "d" (port)); - break; - default: - return -1; - } - - return 0; -} - diff --git a/util/x86emu/yabel/compat/time.h b/util/x86emu/yabel/compat/time.h index c8432eca43..6f7099bd86 100644 --- a/util/x86emu/yabel/compat/time.h +++ b/util/x86emu/yabel/compat/time.h @@ -13,5 +13,6 @@ #define _BIOSEMU_COMPAT_TIME_H /* TODO: check how this works in x86 */ -static unsigned long tb_freq = 0; +extern unsigned long tb_freq; +u64 get_time(void); #endif |