diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2008-07-04 13:04:29 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2008-07-04 13:04:29 -0400 |
commit | 9521e26a164eb4689b34d82a5de0d998bdd4c4dc (patch) | |
tree | d3ba8e12b31213defe5fa794e4d0bcec711c871f /src/util.c | |
parent | 0525d29af0803bdfca40f9bb8b1f8cf5b9a84c05 (diff) | |
download | seabios-9521e26a164eb4689b34d82a5de0d998bdd4c4dc.tar.gz |
Extract 'struct bregs' out of biosvar.h; clean up header includes.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -1,4 +1,37 @@ +// Misc utility functions. +// +// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> +// +// This file may be distributed under the terms of the GNU GPLv3 license. + #include "util.h" // usleep +#include "bregs.h" // struct bregs +#include "config.h" // SEG_BIOS +#include "farptr.h" // GET_FARPTR + +// Call a function with a specified register state. Note that on +// return, the interrupt enable/disable flag may be altered. +inline void +call16(struct bregs *callregs) +{ + asm volatile( +#ifdef MODE16 + "calll __call16\n" +#else + "calll __call16_from32\n" +#endif + : "+a" (callregs), "+m" (*callregs) + : + : "ebx", "ecx", "edx", "esi", "edi", "ebp", "cc"); +} + +inline void +__call16_int(struct bregs *callregs, u16 offset) +{ + callregs->cs = SEG_BIOS; + callregs->ip = offset; + call16(callregs); +} // Sum the bytes in the specified area. u8 |