Extract 'struct bregs' out of biosvar.h; clean up header includes.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 4 Jul 2008 17:04:29 +0000 (13:04 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 4 Jul 2008 17:04:29 +0000 (13:04 -0400)
33 files changed:
src/acpi.c
src/apm.c
src/ata.c
src/biosvar.h
src/boot.c
src/bregs.h [new file with mode: 0644]
src/cdrom.c
src/clock.c
src/config.h
src/coreboot.c
src/disk.c
src/disk.h
src/floppy.c
src/kbd.c
src/memmap.c
src/mouse.c
src/mptable.c
src/output.c
src/pcibios.c
src/pciinit.c
src/pic.c
src/pic.h
src/pirtable.c
src/post.c
src/post_menu.c
src/serial.c
src/shadow.c
src/smbios.c
src/smm.c
src/smpdetect.c
src/system.c
src/util.c
src/util.h

index 51f8161359612fc5b3dcde79e92432a1a60e17f5..c7d043084107fe9acdef77f4c3280c53b56f91b9 100644 (file)
@@ -9,6 +9,7 @@
 #include "util.h" // memcpy
 #include "memmap.h" // bios_table_cur_addr
 #include "pci.h" // pci_find_device
+#include "biosvar.h" // GET_EBDA
 
 
 /****************************************************/
index 19885aa524d4ec4e03305a4aef0b3903e339aea6..20786c0259da2a605d80b785a873e73049100839 100644 (file)
--- a/src/apm.c
+++ b/src/apm.c
@@ -7,9 +7,10 @@
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
 #include "farptr.h" // GET_VAR
-#include "biosvar.h" // struct bregs
+#include "bregs.h" // struct bregs
 #include "ioport.h" // outb
 #include "util.h" // irq_enable
+#include "config.h" // CONFIG_*
 
 static void
 out_str(const char *str_cs)
index 724ad6252a2082e9b059f60fc296d237bdbc3cea..04b0a439f27043df548ec0f35296f6bdce63789a 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -11,6 +11,7 @@
 #include "util.h" // dprintf
 #include "cmos.h" // inb_cmos
 #include "pic.h" // unmask_pic2
+#include "biosvar.h" // GET_EBDA
 
 #define TIMEOUT 0
 #define BSY 1
index 348161d42f5f094d72f9971a4c3f05d087b39942..808f83b81c169dae780f3aa1627b1a9e691bb648 100644 (file)
@@ -7,7 +7,7 @@
 #define __BIOSVAR_H
 
 #include "types.h" // u8
-#include "farptr.h" // SET_SEG
+#include "farptr.h" // GET_FARVAR
 #include "config.h" // CONFIG_*
 
 
@@ -274,6 +274,9 @@ struct extended_bios_data_area_s {
     struct ipl_s ipl;
 } PACKED;
 
+#define EBDA_SIZE DIV_ROUND_UP(sizeof(struct extended_bios_data_area_s), 1024)
+#define BASE_MEM_IN_K (640 - EBDA_SIZE)
+
 // Accessor functions
 #define GET_EBDA(var) \
     GET_FARVAR(SEG_EBDA, ((struct extended_bios_data_area_s *)0)->var)
@@ -281,43 +284,6 @@ struct extended_bios_data_area_s {
     SET_FARVAR(SEG_EBDA, ((struct extended_bios_data_area_s *)0)->var, (val))
 
 
-/****************************************************************
- * Registers saved/restored in romlayout.S
- ****************************************************************/
-
-#define UREG(ER, R, RH, RL) union { u32 ER; struct { u16 R; u16 R ## _hi; }; struct { u8 RL; u8 RH; u8 R ## _hilo; u8 R ## _hihi; }; }
-
-// Layout of registers passed in to irq handlers.  Note that this
-// layout corresponds to code in romlayout.S - don't change it here
-// without also updating the assembler code.
-struct bregs {
-    u16 ds;
-    u16 es;
-    UREG(edi, di, di_hi, di_lo);
-    UREG(esi, si, si_hi, si_lo);
-    UREG(ebx, bx, bh, bl);
-    UREG(edx, dx, dh, dl);
-    UREG(ecx, cx, ch, cl);
-    UREG(eax, ax, ah, al);
-    u16 ip;
-    u16 cs;
-    u16 flags;
-} PACKED;
-
-// bregs flags bitdefs
-#define F_ZF (1<<6)
-#define F_CF (1<<0)
-
-static inline void
-set_cf(struct bregs *regs, int cond)
-{
-    if (cond)
-        regs->flags |= F_CF;
-    else
-        regs->flags &= ~F_CF;
-}
-
-
 /****************************************************************
  * Bios Config Table
  ****************************************************************/
@@ -332,16 +298,4 @@ struct bios_config_table_s {
 
 extern struct bios_config_table_s BIOS_CONFIG_TABLE;
 
-
-/****************************************************************
- * Memory layout info
- ****************************************************************/
-
-#define SEG_BIOS     0xf000
-#define SEG_EBDA     0x9fc0
-#define SEG_BDA      0x0000
-
-#define EBDA_SIZE DIV_ROUND_UP(sizeof(struct extended_bios_data_area_s), 1024)
-#define BASE_MEM_IN_K (640 - EBDA_SIZE)
-
 #endif // __BIOSVAR_H
index ff41930b17e5e1a095d1655ccc75b1464592aa0f..687be346dc5d2c6be9ca26ee8fcee70cdd01c771 100644 (file)
@@ -6,10 +6,11 @@
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
 #include "util.h" // irq_enable
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // GET_EBDA
 #include "config.h" // CONFIG_*
 #include "ata.h" // ata_detect
 #include "disk.h" // cdrom_boot
+#include "bregs.h" // struct bregs
 
 // We need a copy of this string, but we are not actually a PnP BIOS,
 // so make sure it is *not* aligned, so OSes will not see it if they
diff --git a/src/bregs.h b/src/bregs.h
new file mode 100644 (file)
index 0000000..8da6c52
--- /dev/null
@@ -0,0 +1,90 @@
+// Structure layout of cpu registers the the bios uses.
+//
+// Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
+//
+// This file may be distributed under the terms of the GNU GPLv3 license.
+
+#ifndef __BREGS_H
+#define __BREGS_H
+
+
+/****************************************************************
+ * Registers saved/restored in romlayout.S
+ ****************************************************************/
+
+#define UREG(ER, R, RH, RL) union { u32 ER; struct { u16 R; u16 R ## _hi; }; struct { u8 RL; u8 RH; u8 R ## _hilo; u8 R ## _hihi; }; }
+
+// Layout of registers passed in to irq handlers.  Note that this
+// layout corresponds to code in romlayout.S - don't change it here
+// without also updating the assembler code.
+struct bregs {
+    u16 ds;
+    u16 es;
+    UREG(edi, di, di_hi, di_lo);
+    UREG(esi, si, si_hi, si_lo);
+    UREG(ebx, bx, bh, bl);
+    UREG(edx, dx, dh, dl);
+    UREG(ecx, cx, ch, cl);
+    UREG(eax, ax, ah, al);
+    u16 ip;
+    u16 cs;
+    u16 flags;
+} PACKED;
+
+
+/****************************************************************
+ * Helper functions
+ ****************************************************************/
+
+// bregs flags bitdefs
+#define F_ZF (1<<6)
+#define F_CF (1<<0)
+
+static inline void
+set_cf(struct bregs *regs, int cond)
+{
+    if (cond)
+        regs->flags |= F_CF;
+    else
+        regs->flags &= ~F_CF;
+}
+
+// Frequently used return codes
+#define RET_EUNSUPPORTED 0x86
+
+static inline void
+set_success(struct bregs *regs)
+{
+    set_cf(regs, 0);
+}
+
+static inline void
+set_code_success(struct bregs *regs)
+{
+    regs->ah = 0;
+    set_cf(regs, 0);
+}
+
+static inline void
+set_fail_silent(struct bregs *regs)
+{
+    set_cf(regs, 1);
+}
+
+static inline void
+set_code_fail_silent(struct bregs *regs, u8 code)
+{
+    regs->ah = code;
+    set_cf(regs, 1);
+}
+
+#define set_fail(regs) \
+    __set_fail(__func__, (regs))
+#define set_code_fail(regs, code)               \
+    __set_code_fail(__func__, (regs), (code))
+
+// util.c
+void __set_fail(const char *fname, struct bregs *regs);
+void __set_code_fail(const char *fname, struct bregs *regs, u8 code);
+
+#endif // bregs.h
index adb2cfcac2d62decf8ebfd85ef6a7f356d1ddbc2..57c2ce48dc277420eaad3c69bbd8a5cb493f6d25 100644 (file)
@@ -8,6 +8,8 @@
 #include "disk.h" // cdrom_13
 #include "util.h" // memset
 #include "ata.h" // ATA_CMD_READ_SECTORS
+#include "bregs.h" // struct bregs
+#include "biosvar.h" // GET_EBDA
 
 
 /****************************************************************
index 4162570494947766ebfa38810fb3f173bbeb7ffe..d3756865bc2382d7d270194d5dd174ceb84df6dc 100644 (file)
@@ -5,11 +5,12 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // SET_BDA
 #include "util.h" // debug_enter
 #include "disk.h" // floppy_tick
 #include "cmos.h" // inb_cmos
 #include "pic.h" // unmask_pic1
+#include "bregs.h" // struct bregs
 
 // RTC register flags
 #define RTC_A_UIP 0x80
index dc123b625675a6e4c8cc0622c74fe4745cb4427a..9adb3c335a778d63ac26fe903a6e5db804189bf2 100644 (file)
 // Start of fixed addresses in 0xf0000 segment.
 #define BUILD_START_FIXED       0xe050
 
+// Important 16-bit segments
+#define SEG_BIOS     0xf000
+#define SEG_EBDA     0x9fc0
+#define SEG_BDA      0x0000
+
 // Debugging levels.  If non-zero and CONFIG_DEBUG_LEVEL is greater
 // than the specified value, then the corresponding irq handler will
 // report every enter event.
index 534a3c04a8189cb3ce2e890a21eca9073fc8469c..d7aeef13d34c7b8f78a822b9fdd261e6873907bc 100644 (file)
@@ -8,6 +8,7 @@
 #include "util.h" // dprintf
 #include "pci.h" // struct pir_header
 #include "acpi.h" // struct rsdp_descriptor
+#include "biosvar.h" // GET_EBDA
 
 
 /****************************************************************
@@ -85,7 +86,7 @@ copy_acpi_rsdp(void *pos)
 
 // Attempt to find (and relocate) any standard bios tables found in a
 // given address range.
-void
+static void
 scan_tables(u32 start, u32 size)
 {
     void *p = (void*)ALIGN(start, 16);
index 8f26c4b0b67255852c4dec550e57298084451430..e22afd7ebe8c4f5a0207cbdc78c690ea848dafeb 100644 (file)
@@ -6,11 +6,12 @@
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
 #include "disk.h" // floppy_13
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // SET_BDA
 #include "config.h" // CONFIG_*
 #include "util.h" // debug_enter
 #include "ata.h" // ATA_*
 #include "pic.h" // eoi_pic2
+#include "bregs.h" // struct bregs
 
 
 /****************************************************************
index 3339b0d4c7e5378d98858f7c4cd634c0a55d9896..54df9cdfc93145fa75261a12e94ffb0836c7ac87 100644 (file)
@@ -6,9 +6,7 @@
 #ifndef __DISK_H
 #define __DISK_H
 
-#include "ioport.h" // outb
-#include "biosvar.h" // struct bregs
-#include "util.h" // set_code_fail
+#include "types.h" // u8
 
 #define DISK_RET_SUCCESS       0x00
 #define DISK_RET_EPARAM        0x01
@@ -93,6 +91,7 @@ struct floppy_ext_dbt_s {
 } PACKED;
 
 // Helper function for setting up a return code.
+struct bregs;
 void __disk_ret(const char *fname, struct bregs *regs, u8 code);
 #define disk_ret(regs, code) \
     __disk_ret(__func__, (regs), (code))
index afb87786cf28b7c9fd63b2018cc15683d2d87549..a7908dc574c523b357fb351c3cd929f2b8c06d88 100644 (file)
@@ -8,10 +8,11 @@
 #include "types.h" // u8
 #include "disk.h" // DISK_RET_SUCCESS
 #include "config.h" // CONFIG_FLOPPY_SUPPORT
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // SET_BDA
 #include "util.h" // irq_disable
 #include "cmos.h" // inb_cmos
 #include "pic.h" // unmask_pic1
+#include "bregs.h" // struct bregs
 
 #define BX_FLOPPY_ON_CNT 37   /* 2 seconds */
 
index 4304c0dc7c4aa65be61a1e056b8206a3938226ad..5dbb2570df786686d322d23589006a8bb8208f11 100644 (file)
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -5,10 +5,11 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // GET_BDA
 #include "util.h" // debug_enter
 #include "config.h" // CONFIG_*
 #include "pic.h" // eoi_pic1
+#include "bregs.h" // struct bregs
 
 //--------------------------------------------------------------------------
 // keyboard_panic
index 81d15f4dad671255db79b15754669f770ea1cf67..67f10e89db10b8864022c2d034c7e14add023225 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "memmap.h" // struct e820entry
 #include "util.h" // dprintf.h
+#include "biosvar.h" // SET_EBDA
 
 // Temporary storage used during map building.
 static struct e820entry e820_list[64];
index 163d849d671e058989f6737f0a7b27f8f7df3ebc..08beafe6ae34b1598b6dc6b633981a56400decaa 100644 (file)
@@ -5,9 +5,10 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // GET_EBDA
 #include "util.h" // debug_isr
 #include "pic.h" // unmask_pic2
+#include "bregs.h" // struct bregs
 
 static char panic_msg_keyb_buffer_full[] = "%s: keyboard input buffer full\n";
 
index b1b05e1e6a76a1c01edaa534ad2cb1e8bce3dffd..90b8d2f0f961068092d15a348c4477d4a3c7ecec 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "util.h" // dprintf
 #include "memmap.h" // bios_table_cur_addr
+#include "config.h" // CONFIG_*
 
 static void putb(u8 **pp, int val)
 {
index 6d4767baac3183ae88c87d56d6b97299f81d0abb..27fca330f1c8ec5ab4f12de56895341f3dce838d 100644 (file)
@@ -8,7 +8,8 @@
 
 #include "farptr.h" // GET_VAR
 #include "util.h" // printf
-#include "biosvar.h" // struct bregs
+#include "bregs.h" // struct bregs
+#include "config.h" // CONFIG_*
 
 #define DEBUG_PORT 0x03f8
 #define DEBUG_TIMEOUT 100000
index 436c106b50b9d2f933ea2bd08b0aa703ac8b12c9..05d78565998b0c068567bd383def171e3bed6037 100644 (file)
@@ -8,6 +8,8 @@
 #include "types.h" // u32
 #include "util.h" // handle_1ab1
 #include "pci.h" // pci_config_readl
+#include "bregs.h" // struct bregs
+#include "biosvar.h" // GET_EBDA
 
 #define RET_FUNC_NOT_SUPPORTED 0x81
 #define RET_BAD_VENDOR_ID      0x83
index 303f581ef5c48892f2d96d408f76594d7d61db38..15fa9b7cafb31eec9bbccfc295e112607814efb9 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "util.h" // dprintf
 #include "pci.h" // PCIDevice
+#include "biosvar.h" // GET_EBDA
 
 #define PCI_ADDRESS_SPACE_MEM          0x00
 #define PCI_ADDRESS_SPACE_IO           0x01
index 708872426b470991e7ce92db2f03c85c023c2e18..129fc349adeefade915e7315f4916aa1a63d88bf 100644 (file)
--- a/src/pic.c
+++ b/src/pic.c
@@ -5,7 +5,9 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "pic.h"
+#include "pic.h" // get_pic1_isr
+#include "util.h" // dprintf
+#include "config.h" // CONFIG_*
 
 void
 pic_setup()
index 8775191abf44f9eafa7cf04d36eb49b20c22ff34..f020f5599af9a84eb185dfd54bba429c5572709d 100644 (file)
--- a/src/pic.h
+++ b/src/pic.h
@@ -8,7 +8,6 @@
 #define __PIC_H
 
 #include "ioport.h" // PORT_PIC*
-#include "util.h" // dprintf
 
 // PORT_PIC1 bitdefs
 #define PIC1_IRQ0  (1<<0)
index 433b889ce63efea7dca2a4f59f8f40c5708ca5d6..75c46938bccc06a22cf79e4a37bc679c967c9ee3 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "pci.h" // struct pir_header
 #include "util.h" // checksum
+#include "biosvar.h" // SET_EBDA
 
 struct pir_table {
     struct pir_header pir;
index e1ec630ee9b565982df08002ff08ca2d6e100c01..8c3b20a6417c2fb24c95b91d193b905ed740e031 100644 (file)
@@ -18,6 +18,7 @@
 #include "pic.h" // pic_setup
 #include "pci.h" // create_pirtable
 #include "acpi.h" // acpi_bios_init
+#include "bregs.h" // struct bregs
 
 #define bda ((struct bios_data_area_s *)MAKE_FARPTR(SEG_BDA, 0))
 #define ebda ((struct extended_bios_data_area_s *)MAKE_FARPTR(SEG_EBDA, 0))
index 4526e44da3e5a01bd737d9acd6bdc2896f9a312e..5115321ea6c8bb4264a9350bf1dbce7e2d50b01d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "biosvar.h" // GET_EBDA
 #include "util.h" // usleep
+#include "bregs.h" // struct bregs
 
 static u8
 check_for_keystroke()
index 6c38086e9a29e16a7bd2e7b48655f015b2b5d04e..46a9558b363cc7e98fde276dc285a87d4d505c05 100644 (file)
@@ -5,8 +5,9 @@
 //
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
-#include "biosvar.h" // struct bregs
+#include "biosvar.h" // SET_BDA
 #include "util.h" // debug_enter
+#include "bregs.h" // struct bregs
 
 
 /****************************************************************
index 887851d1b96c43fd377c803db7e9d5b432aecf01..b9457c55b7a5a5c0f385542ab66ccf501efef272 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "util.h" // memcpy
 #include "pci.h" // pci_config_writeb
+#include "config.h" // CONFIG_*
 
 // Test if 'addr' is in the range from 'start'..'start+size'
 #define IN_RANGE(addr, start, size) ({   \
index fe78e12a20823570334aca9ca9402409a911c023..020d7c4c325fecd0d1298c9b24bd2b6e74ea3e2d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "util.h" // dprintf
 #include "memmap.h" // bios_table_cur_addr
+#include "biosvar.h" // GET_EBDA
 
 
 /****************************************************************
index 9a9edb89c9470b30c07ab523f6f74d31c394f76e..9500e923bf38e81b779f62d1cca66ee0f7ee8172 100644 (file)
--- a/src/smm.c
+++ b/src/smm.c
@@ -7,6 +7,8 @@
 
 #include "pci.h" // PCIDevice
 #include "util.h" // wbinvd
+#include "config.h" // CONFIG_*
+#include "ioport.h" // outb
 
 asm(
     ".global smm_relocation_start\n"
index 2d03d7cb77e6d6971d9e20fcea161f5d2f74abdd..1c4630cb5dbe15785fdcec7234023d4a4339a31e 100644 (file)
@@ -6,6 +6,7 @@
 // This file may be distributed under the terms of the GNU GPLv3 license.
 
 #include "util.h" // dprintf
+#include "config.h" // CONFIG_*
 
 #define CPUID_APIC (1 << 9)
 
index e73fe5ca82e1ecfe563b3e5b7f6aaaa9023dc70b..d9ff5a7609e6c73a9d9244551a25fc47b6c00386 100644 (file)
@@ -10,6 +10,7 @@
 #include "ioport.h" // inb
 #include "memmap.h" // E820_RAM
 #include "pic.h" // eoi_pic2
+#include "bregs.h" // struct bregs
 
 // Use PS2 System Control port A to set A20 enable
 static inline u8
index 6b2d9dba44f536b1dc9f70e13af1938482503af6..c4f61c5a92eb08e47b7072e1661f9a74e1e9a5a9 100644 (file)
@@ -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
index 3f7283f0a8328f2481d0725f64883c5ed7a187a8..47ce0c7e3379c34985debdf224e8c83b454453e6 100644 (file)
@@ -6,8 +6,7 @@
 #ifndef __UTIL_H
 #define __UTIL_H
 
-#include "ioport.h" // outb
-#include "biosvar.h" // struct bregs
+#include "types.h" // u32
 
 static inline void irq_disable(void)
 {
@@ -63,30 +62,9 @@ void *memset(void *s, int c, size_t n);
 void *memcpy(void *d1, const void *s1, size_t len);
 void *memmove(void *d, const void *s, size_t len);
 
-// Call a function with a specified register state.  Note that on
-// return, the interrupt enable/disable flag may be altered.
-static 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");
-}
-
-static inline
-void __call16_int(struct bregs *callregs, u16 offset)
-{
-    callregs->cs = SEG_BIOS;
-    callregs->ip = offset;
-    call16(callregs);
-}
-
+struct bregs;
+inline void call16(struct bregs *callregs);
+inline void __call16_int(struct bregs *callregs, u16 offset);
 #ifdef MODE16
 #define call16_int(nr, callregs) do {                           \
         extern void irq_trampoline_ ##nr ();                    \
@@ -126,42 +104,6 @@ void __debug_isr(const char *fname);
 #define debug_stub(regs) \
     __debug_stub(__func__, regs)
 
-// Frequently used return codes
-#define RET_EUNSUPPORTED 0x86
-static inline void
-set_success(struct bregs *regs)
-{
-    set_cf(regs, 0);
-}
-
-static inline void
-set_code_success(struct bregs *regs)
-{
-    regs->ah = 0;
-    set_cf(regs, 0);
-}
-
-static inline void
-set_fail_silent(struct bregs *regs)
-{
-    set_cf(regs, 1);
-}
-
-static inline void
-set_code_fail_silent(struct bregs *regs, u8 code)
-{
-    regs->ah = code;
-    set_cf(regs, 1);
-}
-
-void __set_fail(const char *fname, struct bregs *regs);
-void __set_code_fail(const char *fname, struct bregs *regs, u8 code);
-
-#define set_fail(regs) \
-    __set_fail(__func__, (regs))
-#define set_code_fail(regs, code)               \
-    __set_code_fail(__func__, (regs), (code))
-
 // kbd.c
 void handle_15c2(struct bregs *regs);