[SeaBIOS] [PATCH 04/23] Move stacks.c definitions from util.h to new file stacks.h.

Kevin O'Connor kevin at koconnor.net
Sun Sep 15 07:08:27 CEST 2013


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/apm.c         |  1 +
 src/block.c       |  1 +
 src/bootsplash.c  |  1 +
 src/clock.c       |  1 +
 src/disk.c        |  1 +
 src/fw/coreboot.c |  1 +
 src/fw/csm.c      |  1 +
 src/fw/smp.c      |  1 +
 src/hw/ahci.c     |  1 +
 src/hw/ata.c      |  1 +
 src/hw/floppy.c   |  1 +
 src/hw/megasas.c  |  1 +
 src/hw/pci.c      |  1 +
 src/hw/ps2port.c  |  1 +
 src/hw/ramdisk.c  |  1 +
 src/hw/timer.c    |  1 +
 src/hw/usb.h      |  2 +-
 src/kbd.c         |  1 +
 src/misc.c        |  1 +
 src/mouse.c       |  1 +
 src/optionroms.c  |  1 +
 src/output.c      |  1 +
 src/pmm.c         |  1 +
 src/resume.c      |  1 +
 src/serial.c      |  1 +
 src/stacks.c      |  1 +
 src/string.c      |  2 +-
 src/util.h        | 28 +---------------------------
 28 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/apm.c b/src/apm.c
index 211424c..32d1f4b 100644
--- a/src/apm.c
+++ b/src/apm.c
@@ -13,6 +13,7 @@
 #include "biosvar.h" // GET_GLOBAL
 #include "fw/paravirt.h" // runningOnQEMU
 #include "fw/acpi.h" // acpi_pm_ctl
+#include "stacks.h" // yield_toirq
 
 static void
 out_str(const char *str_cs)
diff --git a/src/block.c b/src/block.c
index c6e4167..9cfd7dd 100644
--- a/src/block.c
+++ b/src/block.c
@@ -13,6 +13,7 @@
 #include "hw/ahci.h" // process_ahci_op
 #include "hw/virtio-blk.h" // process_virtio_blk_op
 #include "hw/blockcmd.h" // cdb_*
+#include "stacks.h" // stack_hop
 #include "string.h" // checksum
 
 u8 FloppyCount VARFSEG;
diff --git a/src/bootsplash.c b/src/bootsplash.c
index f4f8ea9..340839b 100644
--- a/src/bootsplash.c
+++ b/src/bootsplash.c
@@ -13,6 +13,7 @@
 #include "vbe.h" // struct vbe_info
 #include "bmp.h" // bmp_alloc
 #include "fw/smbios.h" // display_uuid
+#include "stacks.h" // call16_int
 #include "string.h" // memset
 
 
diff --git a/src/clock.c b/src/clock.c
index fc91db7..6b27aa9 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -14,6 +14,7 @@
 #include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_GLOBAL
 #include "hw/usb-hid.h" // usb_check_event
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 // RTC register flags
diff --git a/src/disk.c b/src/disk.c
index fd80588..2d335e6 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -13,6 +13,7 @@
 #include "bregs.h" // struct bregs
 #include "hw/pci.h" // pci_bdf_to_bus
 #include "hw/ata.h" // ATA_CB_DC
+#include "stacks.h" // call16_int
 #include "string.h" // memset
 
 
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 6da90b5..c67a62b 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -15,6 +15,7 @@
 #include "acpi.h" // find_acpi_features
 #include "hw/pci.h" // pci_probe_devices
 #include "paravirt.h" // PlatformRunningOn
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 
diff --git a/src/fw/csm.c b/src/fw/csm.c
index 4a78bac..81159b3 100644
--- a/src/fw/csm.c
+++ b/src/fw/csm.c
@@ -17,6 +17,7 @@
 #include "boot.h"
 #include "smbios.h"
 #include "hw/pic.h"
+#include "stacks.h" // wait_threads
 
 struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16);
 
diff --git a/src/fw/smp.c b/src/fw/smp.c
index a8504ab..1906255 100644
--- a/src/fw/smp.c
+++ b/src/fw/smp.c
@@ -8,6 +8,7 @@
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_*
 #include "hw/cmos.h" // CMOS_BIOS_SMP_COUNT
+#include "stacks.h" // yield
 #include "x86.h" // wrmsr
 
 #define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index 2435b83..6f56cb1 100644
--- a/src/hw/ahci.c
+++ b/src/hw/ahci.c
@@ -16,6 +16,7 @@
 #include "ata.h" // ATA_CB_STAT
 #include "ahci.h" // CDB_CMD_READ_10
 #include "blockcmd.h" // CDB_CMD_READ_10
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 #define AHCI_REQUEST_TIMEOUT 32000 // 32 seconds max for IDE ops
diff --git a/src/hw/ata.c b/src/hw/ata.c
index 705e106..5e9b905 100644
--- a/src/hw/ata.c
+++ b/src/hw/ata.c
@@ -19,6 +19,7 @@
 #include "disk.h" // struct ata_s
 #include "ata.h" // ATA_CB_STAT
 #include "blockcmd.h" // CDB_CMD_READ_10
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 #define IDE_TIMEOUT 32000 //32 seconds max for IDE ops
diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index ae66bc0..c051f54 100644
--- a/src/hw/floppy.c
+++ b/src/hw/floppy.c
@@ -16,6 +16,7 @@
 #include "boot.h" // boot_add_floppy
 #include "pci.h" // pci_to_bdf
 #include "pci_ids.h" // PCI_CLASS_BRIDGE_ISA
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 #define FLOPPY_SIZE_CODE 0x02 // 512 byte sectors
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index 144fb84..19ed1b4 100644
--- a/src/hw/megasas.c
+++ b/src/hw/megasas.c
@@ -19,6 +19,7 @@
 #include "boot.h" // bootprio_find_scsi_device
 #include "blockcmd.h" // scsi_drive_setup
 #include "disk.h"
+#include "stacks.h" // yield
 #include "string.h" // memset
 
 #define MFI_DB 0x0 // Doorbell
diff --git a/src/hw/pci.c b/src/hw/pci.c
index 7fdde2a..295a26d 100644
--- a/src/hw/pci.c
+++ b/src/hw/pci.c
@@ -12,6 +12,7 @@
 #include "farptr.h" // MAKE_FLATPTR
 #include "pci_regs.h" // PCI_VENDOR_ID
 #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA
+#include "stacks.h" // call32
 #include "string.h" // memset
 #include "x86.h" // readl
 
diff --git a/src/hw/ps2port.c b/src/hw/ps2port.c
index 4b6c5df..6fd0c3a 100644
--- a/src/hw/ps2port.c
+++ b/src/hw/ps2port.c
@@ -10,6 +10,7 @@
 #include "biosvar.h" // GET_LOW
 #include "ps2port.h" // ps2_kbd_command
 #include "pic.h" // pic_eoi1
+#include "stacks.h" // yield
 
 
 /****************************************************************
diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c
index 6e730bf..cd517e7 100644
--- a/src/hw/ramdisk.c
+++ b/src/hw/ramdisk.c
@@ -10,6 +10,7 @@
 #include "biosvar.h" // GET_GLOBAL
 #include "bregs.h" // struct bregs
 #include "boot.h" // boot_add_floppy
+#include "stacks.h" // call16_int
 #include "string.h" // memset
 
 void
diff --git a/src/hw/timer.c b/src/hw/timer.c
index 2547639..56c4eca 100644
--- a/src/hw/timer.c
+++ b/src/hw/timer.c
@@ -9,6 +9,7 @@
 #include "ioport.h" // PORT_PIT_MODE
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_LOW
+#include "stacks.h" // yield
 #include "x86.h" // cpuid
 
 // Bits for PORT_PS2_CTRLB
diff --git a/src/hw/usb.h b/src/hw/usb.h
index a43e829..1ac86c7 100644
--- a/src/hw/usb.h
+++ b/src/hw/usb.h
@@ -2,7 +2,7 @@
 #ifndef __USB_H
 #define __USB_H
 
-#include "util.h" // struct mutex_s
+#include "stacks.h" // struct mutex_s
 
 // Information on a USB end point.
 struct usb_pipe {
diff --git a/src/kbd.c b/src/kbd.c
index 2257565..4302a05 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -11,6 +11,7 @@
 #include "bregs.h" // struct bregs
 #include "hw/ps2port.h" // ps2_kbd_command
 #include "hw/usb-hid.h" // usb_kbd_command
+#include "stacks.h" // stack_hop
 #include "string.h" // memset
 
 // Bit definitions for BDA kbd_flag[012]
diff --git a/src/misc.c b/src/misc.c
index 8074234..642bbb1 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -9,6 +9,7 @@
 #include "biosvar.h" // GET_BDA
 #include "util.h" // debug_enter
 #include "hw/pic.h" // enable_hwirq
+#include "stacks.h" // call16_int
 #include "string.h" // memset
 
 
diff --git a/src/mouse.c b/src/mouse.c
index 5a7ae0a..8e8374c 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -10,6 +10,7 @@
 #include "bregs.h" // struct bregs
 #include "hw/ps2port.h" // ps2_mouse_command
 #include "hw/usb-hid.h" // usb_mouse_command
+#include "stacks.h" // stack_hop
 
 void
 mouse_init(void)
diff --git a/src/optionroms.c b/src/optionroms.c
index 8288e5f..cc6083b 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -14,6 +14,7 @@
 #include "hw/pci_ids.h" // PCI_CLASS_DISPLAY_VGA
 #include "boot.h" // IPL
 #include "optionroms.h" // struct rom_header
+#include "stacks.h" // farcall16big
 #include "string.h" // memset
 
 
diff --git a/src/output.c b/src/output.c
index 918a6ed..b5d7ae0 100644
--- a/src/output.c
+++ b/src/output.c
@@ -12,6 +12,7 @@
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
 #include "fw/paravirt.h" // PlatformRunningOn
+#include "stacks.h" // call16_int
 #include "string.h" // memset
 
 struct putcinfo {
diff --git a/src/pmm.c b/src/pmm.c
index fef343b..cd6ee89 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -11,6 +11,7 @@
 #include "biosvar.h" // GET_BDA
 #include "optionroms.h" // OPTION_ROM_ALIGN
 #include "list.h" // hlist_node
+#include "stacks.h" // wait_preempt
 #include "string.h" // memset
 #include "x86.h" // __ffs
 
diff --git a/src/resume.c b/src/resume.c
index 7fb4a75..892c76c 100644
--- a/src/resume.c
+++ b/src/resume.c
@@ -13,6 +13,7 @@
 #include "hw/ps2port.h" // i8042_reboot
 #include "hw/pci.h" // pci_reboot
 #include "hw/cmos.h" // inb_cmos
+#include "stacks.h" // farcall16big
 #include "string.h" // memset
 
 // Indicator if POST phase has been run.
diff --git a/src/serial.c b/src/serial.c
index b4a0a53..8fd3067 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -8,6 +8,7 @@
 #include "biosvar.h" // SET_BDA
 #include "util.h" // debug_enter
 #include "bregs.h" // struct bregs
+#include "stacks.h" // yield
 
 
 /****************************************************************
diff --git a/src/stacks.c b/src/stacks.c
index ac75497..b499872 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -8,6 +8,7 @@
 #include "util.h" // dprintf
 #include "bregs.h" // CR0_PE
 #include "list.h" // hlist_node
+#include "stacks.h" // struct mutex_s
 
 
 /****************************************************************
diff --git a/src/string.c b/src/string.c
index 5f2dede..574c13e 100644
--- a/src/string.c
+++ b/src/string.c
@@ -4,7 +4,7 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "util.h" // yield
+#include "stacks.h" // yield
 #include "string.h" // memcpy
 #include "farptr.h" // SET_SEG
 
diff --git a/src/util.h b/src/util.h
index 230db10..0492e39 100644
--- a/src/util.h
+++ b/src/util.h
@@ -4,33 +4,6 @@
 
 #include "types.h" // u32
 
-// stacks.c
-extern u8 ExtraStack[], *StackPos;
-u32 stack_hop(u32 eax, u32 edx, void *func);
-u32 stack_hop_back(u32 eax, u32 edx, void *func);
-u32 call32(void *func, u32 eax, u32 errret);
-struct bregs;
-inline void farcall16(struct bregs *callregs);
-inline void farcall16big(struct bregs *callregs);
-inline void __call16_int(struct bregs *callregs, u16 offset);
-#define call16_int(nr, callregs) do {                           \
-        extern void irq_trampoline_ ##nr ();                    \
-        __call16_int((callregs), (u32)&irq_trampoline_ ##nr );  \
-    } while (0)
-extern struct thread_info MainThread;
-struct thread_info *getCurThread(void);
-void yield(void);
-void yield_toirq(void);
-void run_thread(void (*func)(void*), void *data);
-void wait_threads(void);
-struct mutex_s { u32 isLocked; };
-void mutex_lock(struct mutex_s *mutex);
-void mutex_unlock(struct mutex_s *mutex);
-void start_preempt(void);
-void finish_preempt(void);
-int wait_preempt(void);
-void check_preempt(void);
-
 // output.c
 extern u16 DebugOutputPort;
 void debug_serial_preinit(void);
@@ -44,6 +17,7 @@ char * znprintf(size_t size, const char *fmt, ...)
     __attribute__ ((format (printf, 2, 3)));
 void __dprintf(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2)));
+struct bregs;
 void __debug_enter(struct bregs *regs, const char *fname);
 void __debug_isr(const char *fname);
 void __debug_stub(struct bregs *regs, int lineno, const char *fname);
-- 
1.8.3.1




More information about the SeaBIOS mailing list