// Basic x86 asm functions and function defs.
//
-// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
#ifndef __UTIL_H
return val;
}
+#define call16_simpint(nr, peax, pflags) do { \
+ extern void __force_link_error__call16_simpint_only_in_16bit_mode(); \
+ if (!MODE16) \
+ __force_link_error__call16_simpint_only_in_16bit_mode(); \
+ \
+ asm volatile( \
+ "stc\n" \
+ "int %2\n" \
+ "pushfl\n" \
+ "popl %1\n" \
+ "cli\n" \
+ "cld" \
+ : "+a"(*peax), "=r"(*pflags) \
+ : "i"(nr) \
+ : "cc", "memory"); \
+ } while (0)
+
// util.c
inline u32 stack_hop(u32 eax, u32 edx, u32 ecx, void *func);
-u8 checksum_far(u16 buf_seg, u8 *buf_far, u32 len);
-u8 checksum(u8 *buf, u32 len);
+u8 checksum_far(u16 buf_seg, void *buf_far, u32 len);
+u8 checksum(void *buf, u32 len);
+int memcmp(const void *s1, const void *s2, size_t n);
+size_t strlen(const char *s);
+int strcmp(const char *s1, const char *s2);
+inline void memset_far(u16 d_seg, void *d_far, u8 c, size_t len);
+inline void memset16_far(u16 d_seg, void *d_far, u16 c, size_t len);
void *memset(void *s, int c, size_t n);
-void *memcpy(void *d1, const void *s1, size_t len);
+#define memcpy __builtin_memcpy
inline void memcpy_far(u16 d_seg, void *d_far
, u16 s_seg, const void *s_far, size_t len);
void *memmove(void *d, const void *s, size_t len);
extern void irq_trampoline_ ##nr (); \
__call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \
} while (0)
-inline void call16_simpint(int nr, u32 *eax, u32 *flags);
+void usleep(u32 usec);
int get_keystroke(int msec);
// output.c
} while (0)
#define debug_stub(regs) \
__debug_stub((regs), __LINE__, __func__)
+void hexdump(void *d, int len);
// kbd.c
void kbd_setup();
int smp_probe(void);
void smp_probe_setup(void);
-// mptable.c
-void mptable_init(void);
-
// smbios.c
void smbios_init(void);
// coreboot.c
-void coreboot_fill_map();
+const char *cbfs_findNprefix(const char *prefix, int n);
+int cbfs_copy_optionrom(void *dst, u32 maxlen, u32 vendev);
+void cbfs_run_payload(const char *filename);
+struct cbfs_file;
+struct cbfs_file *cbfs_copy_gen_optionrom(void *dst, u32 maxlen
+ , struct cbfs_file *file);
+void coreboot_setup();
// vgahooks.c
void handle_155f();