aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-09-14 19:10:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-09-18 20:48:34 -0400
commitfa9c66a6560a5009302aff22602ffa3e955726d9 (patch)
tree55215b572a47412f5eefb884517e6b71aaf9ee68
parent0ac5e9e0fc84032c99d9be6c4903afb2d616c97f (diff)
downloadseabios-fa9c66a6560a5009302aff22602ffa3e955726d9.tar.gz
Rename util.c to string.c and introduce string.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--Makefile6
-rw-r--r--src/block.c1
-rw-r--r--src/bmp.c5
-rw-r--r--src/boot.c1
-rw-r--r--src/bootsplash.c1
-rw-r--r--src/cdrom.c3
-rw-r--r--src/clock.c1
-rw-r--r--src/disk.c1
-rw-r--r--src/fw/acpi.c3
-rw-r--r--src/fw/biostables.c1
-rw-r--r--src/fw/coreboot.c1
-rw-r--r--src/fw/csm.c2
-rw-r--r--src/fw/mptable.c1
-rw-r--r--src/fw/paravirt.c1
-rw-r--r--src/fw/pciinit.c1
-rw-r--r--src/fw/pirtable.c3
-rw-r--r--src/fw/shadow.c3
-rw-r--r--src/fw/smbios.c1
-rw-r--r--src/fw/smm.c1
-rw-r--r--src/fw/xen.c1
-rw-r--r--src/hw/ahci.c1
-rw-r--r--src/hw/ata.c1
-rw-r--r--src/hw/blockcmd.c1
-rw-r--r--src/hw/esp-scsi.c1
-rw-r--r--src/hw/floppy.c1
-rw-r--r--src/hw/lsi-scsi.c1
-rw-r--r--src/hw/megasas.c1
-rw-r--r--src/hw/pci.c1
-rw-r--r--src/hw/ramdisk.c1
-rw-r--r--src/hw/usb-ehci.c1
-rw-r--r--src/hw/usb-hub.c1
-rw-r--r--src/hw/usb-msc.c1
-rw-r--r--src/hw/usb-ohci.c1
-rw-r--r--src/hw/usb-uas.c1
-rw-r--r--src/hw/usb-uhci.c1
-rw-r--r--src/hw/usb.c1
-rw-r--r--src/hw/virtio-blk.c1
-rw-r--r--src/hw/virtio-pci.c1
-rw-r--r--src/hw/virtio-scsi.c1
-rw-r--r--src/jpeg.c1
-rw-r--r--src/kbd.c1
-rw-r--r--src/memmap.c1
-rw-r--r--src/misc.c1
-rw-r--r--src/optionroms.c1
-rw-r--r--src/output.c1
-rw-r--r--src/pcibios.c1
-rw-r--r--src/pmm.c3
-rw-r--r--src/pnpbios.c3
-rw-r--r--src/post.c3
-rw-r--r--src/resume.c1
-rw-r--r--src/romfile.c1
-rw-r--r--src/string.c (renamed from src/util.c)10
-rw-r--r--src/string.h30
-rw-r--r--src/system.c3
-rw-r--r--src/util.h29
-rw-r--r--src/vgahooks.c1
-rw-r--r--vgasrc/clext.c1
-rw-r--r--vgasrc/geodevga.c2
-rw-r--r--vgasrc/stdvga.c2
-rw-r--r--vgasrc/stdvgamodes.c3
-rw-r--r--vgasrc/vbe.c1
-rw-r--r--vgasrc/vgabios.c3
-rw-r--r--vgasrc/vgafb.c3
63 files changed, 111 insertions, 52 deletions
diff --git a/Makefile b/Makefile
index 46df1c6..c824f0b 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
OUT=out/
# Source files
-SRCBOTH=misc.c stacks.c output.c util.c x86.c block.c cdrom.c mouse.c kbd.c \
+SRCBOTH=misc.c stacks.c output.c string.c x86.c block.c cdrom.c mouse.c kbd.c \
serial.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c apm.c \
fw/smp.c \
hw/pci.c hw/timer.c hw/pic.c hw/ps2port.c \
@@ -24,7 +24,7 @@ SRC32FLAT=$(SRCBOTH) post.c memmap.c pmm.c romfile.c optionroms.c \
fw/coreboot.c fw/lzmadecode.c fw/csm.c fw/biostables.c \
fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/mtrr.c fw/xen.c \
fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c
-SRC32SEG=util.c output.c pcibios.c apm.c stacks.c hw/pci.c
+SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c
DIRS=src src/hw src/fw vgasrc
# Default compiler flags
@@ -180,7 +180,7 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o scripts/checkrom.py
################ VGA build rules
# VGA src files
-SRCVGA=src/output.c src/util.c src/hw/pci.c \
+SRCVGA=src/output.c src/string.c src/hw/pci.c \
vgasrc/vgabios.c vgasrc/vgafb.c vgasrc/vgafonts.c vgasrc/vbe.c \
vgasrc/stdvga.c vgasrc/stdvgamodes.c vgasrc/stdvgaio.c \
vgasrc/clext.c vgasrc/bochsvga.c vgasrc/geodevga.c
diff --git a/src/block.c b/src/block.c
index 74c6497..c6e4167 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 "string.h" // checksum
u8 FloppyCount VARFSEG;
u8 CDCount;
diff --git a/src/bmp.c b/src/bmp.c
index 0d54efd..81be306 100644
--- a/src/bmp.c
+++ b/src/bmp.c
@@ -6,8 +6,9 @@
*
* This work is licensed under the terms of the GNU LGPLv3.
*/
-#include "util.h"
-#include "bmp.h"
+#include "util.h" // malloc_tmphigh
+#include "bmp.h" // struct bmp_decdata
+#include "string.h" // memcpy
#define bmp_load4byte(addr) (*(u32 *)(addr))
#define bmp_load2byte(addr) (*(u16 *)(addr))
diff --git a/src/boot.c b/src/boot.c
index 3542283..68a20d9 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -16,6 +16,7 @@
#include "hw/usb.h" // struct usbdevice_s
#include "fw/csm.h" // csm_bootprio_*
#include "list.h" // hlist_node
+#include "string.h" // memset
/****************************************************************
diff --git a/src/bootsplash.c b/src/bootsplash.c
index bd91102..f4f8ea9 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 "string.h" // memset
/****************************************************************
diff --git a/src/cdrom.c b/src/cdrom.c
index 94265b0..0d3fa1f 100644
--- a/src/cdrom.c
+++ b/src/cdrom.c
@@ -6,11 +6,12 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "disk.h" // cdrom_13
-#include "util.h" // memset
+#include "util.h" // dprintf
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
#include "hw/ata.h" // ATA_CMD_REQUEST_SENSE
#include "hw/blockcmd.h" // CDB_CMD_REQUEST_SENSE
+#include "string.h" // memset
// Locks for removable devices
u8 CDRom_locks[BUILD_MAX_EXTDRIVE] VARLOW;
diff --git a/src/clock.c b/src/clock.c
index cc962e4..fc91db7 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 "string.h" // memset
// RTC register flags
#define RTC_A_UIP 0x80
diff --git a/src/disk.c b/src/disk.c
index 78252b1..fd80588 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 "string.h" // memset
/****************************************************************
diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index fcf11ea..8abd205 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -6,7 +6,7 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "acpi.h" // struct rsdp_descriptor
-#include "util.h" // memcpy
+#include "util.h" // dprintf
#include "byteorder.h" // cpu_to_le16
#include "hw/pci.h" // pci_find_init_device
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
@@ -15,6 +15,7 @@
#include "config.h" // CONFIG_*
#include "paravirt.h" // RamSize
#include "dev-q35.h"
+#include "string.h" // memset
#include "x86.h" // readl
#include "src/fw/acpi-dsdt.hex"
diff --git a/src/fw/biostables.c b/src/fw/biostables.c
index beb0bed..cd58ff9 100644
--- a/src/fw/biostables.c
+++ b/src/fw/biostables.c
@@ -10,6 +10,7 @@
#include "acpi.h" // struct rsdp_descriptor
#include "mptable.h" // MPTABLE_SIGNATURE
#include "smbios.h" // struct smbios_entry_point
+#include "string.h" // memcpy
static void
copy_pir(void *pos)
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 126649a..6da90b5 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 "string.h" // memset
/****************************************************************
diff --git a/src/fw/csm.c b/src/fw/csm.c
index 0093bee..4a78bac 100644
--- a/src/fw/csm.c
+++ b/src/fw/csm.c
@@ -6,7 +6,7 @@
#include "config.h" // CONFIG_*
#include "csm.h"
-#include "util.h" // checksum
+#include "util.h" // dprintf
#include "bregs.h"
#include "optionroms.h"
#include "hw/pci.h"
diff --git a/src/fw/mptable.c b/src/fw/mptable.c
index 47fe53d..ecc618a 100644
--- a/src/fw/mptable.c
+++ b/src/fw/mptable.c
@@ -10,6 +10,7 @@
#include "mptable.h" // MPTABLE_SIGNATURE
#include "hw/pci.h"
#include "hw/pci_regs.h"
+#include "string.h" // memset
#include "x86.h" // cpuid
void
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c
index a68e3a1..2be4281 100644
--- a/src/fw/paravirt.c
+++ b/src/fw/paravirt.c
@@ -20,6 +20,7 @@
#include "mptable.h" // mptable_setup
#include "hw/pci.h" // create_pirtable
#include "xen.h" // xen_biostable_setup
+#include "string.h" // memset
#include "x86.h" // cpuid
// Amount of continuous ram under 4Gig
diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index ca32d43..ee8d5dd 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -16,6 +16,7 @@
#include "dev-q35.h" // Q35_HOST_BRIDGE_PCIEXBAR_ADDR
#include "list.h" // struct hlist_node
#include "acpi.h" // acpi_pm1a_cnt
+#include "string.h" // memset
#define PCI_DEVICE_MEM_MIN 0x1000
#define PCI_BRIDGE_IO_MIN 0x1000
diff --git a/src/fw/pirtable.c b/src/fw/pirtable.c
index 57fb48f..d66d21b 100644
--- a/src/fw/pirtable.c
+++ b/src/fw/pirtable.c
@@ -7,7 +7,8 @@
#include "hw/pci.h" // struct pir_header
#include "config.h" // CONFIG_*
-#include "util.h" // checksum
+#include "util.h" // dprintf
+#include "string.h" // checksum
struct pir_header *PirAddr VARFSEG;
diff --git a/src/fw/shadow.c b/src/fw/shadow.c
index 767c6ea..45cfcaf 100644
--- a/src/fw/shadow.c
+++ b/src/fw/shadow.c
@@ -5,13 +5,14 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // memcpy
+#include "util.h" // dprintf
#include "hw/pci.h" // pci_config_writeb
#include "config.h" // CONFIG_*
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "hw/pci_regs.h" // PCI_VENDOR_ID
#include "paravirt.h" // runningOnXen
#include "dev-q35.h" // PCI_VENDOR_ID_INTEL
+#include "string.h" // memset
#include "x86.h" // wbinvd
// On the emulators, the bios at 0xf0000 is also at 0xffff0000
diff --git a/src/fw/smbios.c b/src/fw/smbios.c
index 93fb57f..f80b42b 100644
--- a/src/fw/smbios.c
+++ b/src/fw/smbios.c
@@ -9,6 +9,7 @@
#include "config.h" // CONFIG_*
#include "paravirt.h" // RamSize
#include "smbios.h" // struct smbios_entry_point
+#include "string.h" // memset
#include "x86.h" // cpuid
struct smbios_entry_point *SMBiosAddr;
diff --git a/src/fw/smm.c b/src/fw/smm.c
index 3a1a799..8ca1e83 100644
--- a/src/fw/smm.c
+++ b/src/fw/smm.c
@@ -12,6 +12,7 @@
#include "ioport.h" // outb
#include "hw/pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "dev-q35.h"
+#include "string.h" // memcpy
#include "x86.h" // wbinvd
extern u8 smm_relocation_start, smm_relocation_end;
diff --git a/src/fw/xen.c b/src/fw/xen.c
index 6e21bff..f181e5f 100644
--- a/src/fw/xen.c
+++ b/src/fw/xen.c
@@ -11,6 +11,7 @@
#include "types.h" // ASM32FLAT
#include "util.h" // copy_acpi_rsdp
#include "acpi.h" // find_acpi_features
+#include "string.h" // memcpy
#include "x86.h" // cpuid
#define INFO_PHYSICAL_ADDRESS 0x00001000
diff --git a/src/hw/ahci.c b/src/hw/ahci.c
index e2729a9..297351a 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 "string.h" // memset
#define AHCI_REQUEST_TIMEOUT 32000 // 32 seconds max for IDE ops
#define AHCI_RESET_TIMEOUT 500 // 500 miliseconds
diff --git a/src/hw/ata.c b/src/hw/ata.c
index e319aa9..705e106 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 "string.h" // memset
#define IDE_TIMEOUT 32000 //32 seconds max for IDE ops
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 5cd4eb0..6f79cc5 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -19,6 +19,7 @@
#include "esp-scsi.h" // esp_scsi_cmd_data
#include "megasas.h" // megasas_cmd_data
#include "boot.h" // boot_add_hd
+#include "string.h" // memset
// Route command to low-level handler.
static int
diff --git a/src/hw/esp-scsi.c b/src/hw/esp-scsi.c
index 42a790f..49c74ff 100644
--- a/src/hw/esp-scsi.c
+++ b/src/hw/esp-scsi.c
@@ -20,6 +20,7 @@
#include "blockcmd.h" // scsi_drive_setup
#include "fw/paravirt.h" // runningOnQEMU
#include "disk.h"
+#include "string.h" // memset
#define ESP_TCLO 0x00
#define ESP_TCMID 0x04
diff --git a/src/hw/floppy.c b/src/hw/floppy.c
index 37b7092..ae66bc0 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 "string.h" // memset
#define FLOPPY_SIZE_CODE 0x02 // 512 byte sectors
#define FLOPPY_DATALEN 0xff // Not used - because size code is 0x02
diff --git a/src/hw/lsi-scsi.c b/src/hw/lsi-scsi.c
index cebe967..0563fab 100644
--- a/src/hw/lsi-scsi.c
+++ b/src/hw/lsi-scsi.c
@@ -20,6 +20,7 @@
#include "blockcmd.h" // scsi_drive_setup
#include "fw/paravirt.h" // runningOnQEMU
#include "disk.h"
+#include "string.h" // memset
#define LSI_REG_DSTAT 0x0c
#define LSI_REG_ISTAT0 0x14
diff --git a/src/hw/megasas.c b/src/hw/megasas.c
index f4eeba0..144fb84 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 "string.h" // memset
#define MFI_DB 0x0 // Doorbell
#define MFI_OMSG0 0x18 // Outbound message 0
diff --git a/src/hw/pci.c b/src/hw/pci.c
index d1115a4..7fdde2a 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 "string.h" // memset
#include "x86.h" // readl
void pci_config_writel(u16 bdf, u32 addr, u32 val)
diff --git a/src/hw/ramdisk.c b/src/hw/ramdisk.c
index b9da2ad..6e730bf 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 "string.h" // memset
void
ramdisk_setup(void)
diff --git a/src/hw/usb-ehci.c b/src/hw/usb-ehci.c
index 333679e..bb02293 100644
--- a/src/hw/usb-ehci.c
+++ b/src/hw/usb-ehci.c
@@ -15,6 +15,7 @@
#include "biosvar.h" // GET_LOWFLAT
#include "usb-uhci.h" // uhci_setup
#include "usb-ohci.h" // ohci_setup
+#include "string.h" // memset
#include "x86.h" // readl
struct usb_ehci_s {
diff --git a/src/hw/usb-hub.c b/src/hw/usb-hub.c
index 0b55d15..5bef26f 100644
--- a/src/hw/usb-hub.c
+++ b/src/hw/usb-hub.c
@@ -8,6 +8,7 @@
#include "config.h" // CONFIG_USB_HUB
#include "usb-hub.h" // struct usb_hub_descriptor
#include "usb.h" // struct usb_s
+#include "string.h" // memset
static int
get_hub_desc(struct usb_pipe *pipe, struct usb_hub_descriptor *desc)
diff --git a/src/hw/usb-msc.c b/src/hw/usb-msc.c
index 7b2524d..d5cf1b4 100644
--- a/src/hw/usb-msc.c
+++ b/src/hw/usb-msc.c
@@ -12,6 +12,7 @@
#include "blockcmd.h" // cdb_read
#include "disk.h" // DTYPE_USB
#include "boot.h" // bootprio_find_usb
+#include "string.h" // memset
struct usbdrive_s {
struct drive_s drive;
diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index c1806ff..0febcca 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -11,6 +11,7 @@
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
#include "usb.h" // struct usb_s
#include "biosvar.h" // GET_LOWFLAT
+#include "string.h" // memset
#include "x86.h" // readl
#define FIT (1 << 31)
diff --git a/src/hw/usb-uas.c b/src/hw/usb-uas.c
index 3169389..c205d7f 100644
--- a/src/hw/usb-uas.c
+++ b/src/hw/usb-uas.c
@@ -22,6 +22,7 @@
#include "disk.h" // DTYPE_UAS
#include "boot.h" // bootprio_find_usb
#include "usb-uas.h" // usb_uas_init
+#include "string.h" // memset
#define UAS_UI_COMMAND 0x01
#define UAS_UI_SENSE 0x03
diff --git a/src/hw/usb-uhci.c b/src/hw/usb-uhci.c
index d8f9b1e..4716d98 100644
--- a/src/hw/usb-uhci.c
+++ b/src/hw/usb-uhci.c
@@ -12,6 +12,7 @@
#include "pci_regs.h" // PCI_BASE_ADDRESS_4
#include "usb.h" // struct usb_s
#include "biosvar.h" // GET_LOWFLAT
+#include "string.h" // memset
struct usb_uhci_s {
struct usb_s usb;
diff --git a/src/hw/usb.c b/src/hw/usb.c
index 647359e..4026555 100644
--- a/src/hw/usb.c
+++ b/src/hw/usb.c
@@ -18,6 +18,7 @@
#include "usb-uas.h" // usb_uas_setup
#include "usb.h" // struct usb_s
#include "biosvar.h" // GET_GLOBAL
+#include "string.h" // memset
#include "x86.h" // __fls
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 6c0cd74..761e64f 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -18,6 +18,7 @@
#include "virtio-ring.h"
#include "virtio-blk.h"
#include "disk.h"
+#include "string.h" // memset
struct virtiodrive_s {
struct drive_s drive;
diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c
index 4b9ad0a..6a16463 100644
--- a/src/hw/virtio-pci.c
+++ b/src/hw/virtio-pci.c
@@ -21,6 +21,7 @@
#include "util.h" // dprintf
#include "pci.h" // pci_config_readl
#include "pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "string.h" // memset
int vp_find_vq(unsigned int ioaddr, int queue_index,
struct vring_virtqueue **p_vq)
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
index 4de1255..06f7b60 100644
--- a/src/hw/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
@@ -19,6 +19,7 @@
#include "virtio-ring.h"
#include "virtio-scsi.h"
#include "disk.h"
+#include "string.h" // memset
struct virtio_lun_s {
struct drive_s drive;
diff --git a/src/jpeg.c b/src/jpeg.c
index a96a9d7..e7fc337 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -42,6 +42,7 @@
#define __LITTLE_ENDIAN
#include "util.h"
#include "jpeg.h"
+#include "string.h"
#define ISHIFT 11
#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
diff --git a/src/kbd.c b/src/kbd.c
index 2e2ced7..2257565 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 "string.h" // memset
// Bit definitions for BDA kbd_flag[012]
#define KF0_RSHIFT (1<<0)
diff --git a/src/memmap.c b/src/memmap.c
index d617b81..ab1bcad 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -7,6 +7,7 @@
#include "memmap.h" // struct e820entry
#include "config.h" // BUILD_MAX_E820
#include "util.h" // dprintf.h
+#include "string.h" // memmove
/****************************************************************
diff --git a/src/misc.c b/src/misc.c
index 338c607..8074234 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 "string.h" // memset
/****************************************************************
diff --git a/src/optionroms.c b/src/optionroms.c
index ffa426d..8288e5f 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 "string.h" // memset
/****************************************************************
diff --git a/src/output.c b/src/output.c
index 8b63d9a..918a6ed 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 "string.h" // memset
struct putcinfo {
void (*func)(struct putcinfo *info, char c);
diff --git a/src/pcibios.c b/src/pcibios.c
index 43eb547..5b242c9 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -11,6 +11,7 @@
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_GLOBAL
#include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "string.h" // checksum
// romlayout.S
extern void entry_bios32(void);
diff --git a/src/pmm.c b/src/pmm.c
index c86d66f..fef343b 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -4,13 +4,14 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // checksum
+#include "util.h" // dprintf
#include "config.h" // BUILD_BIOS_ADDR
#include "memmap.h" // struct e820entry
#include "farptr.h" // GET_FARVAR
#include "biosvar.h" // GET_BDA
#include "optionroms.h" // OPTION_ROM_ALIGN
#include "list.h" // hlist_node
+#include "string.h" // memset
#include "x86.h" // __ffs
// Information on a reserved area.
diff --git a/src/pnpbios.c b/src/pnpbios.c
index fddcc81..e67425f 100644
--- a/src/pnpbios.c
+++ b/src/pnpbios.c
@@ -4,9 +4,10 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // checksum
+#include "util.h" // dprintf
#include "config.h" // BUILD_BIOS_ADDR
#include "farptr.h" // SET_FARVAR
+#include "string.h" // checksum
struct pnpheader {
u32 signature;
diff --git a/src/post.c b/src/post.c
index 7d6fbd2..f1cb8a8 100644
--- a/src/post.c
+++ b/src/post.c
@@ -7,7 +7,7 @@
#include "config.h" // CONFIG_*
#include "hw/cmos.h" // CMOS_*
-#include "util.h" // memset
+#include "util.h" // dprintf
#include "biosvar.h" // struct bios_data_area_s
#include "disk.h" // floppy_setup
#include "hw/ata.h" // ata_setup
@@ -26,6 +26,7 @@
#include "hw/esp-scsi.h" // esp_scsi_setup
#include "hw/megasas.h" // megasas_setup
#include "post.h" // interface_init
+#include "string.h" // memset
/****************************************************************
diff --git a/src/resume.c b/src/resume.c
index 5323d7e..7fb4a75 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 "string.h" // memset
// Indicator if POST phase has been run.
int HaveRunPost VARFSEG;
diff --git a/src/romfile.c b/src/romfile.c
index ea71d1f..f19f756 100644
--- a/src/romfile.c
+++ b/src/romfile.c
@@ -6,6 +6,7 @@
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
+#include "string.h" // memcmp
static struct romfile_s *RomfileRoot VARVERIFY32INIT;
diff --git a/src/util.c b/src/string.c
index ee59b13..5f2dede 100644
--- a/src/util.c
+++ b/src/string.c
@@ -1,12 +1,12 @@
-// Misc utility functions.
+// String manipulation functions.
//
-// Copyright (C) 2008,2009 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008-2013 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // call16
-#include "bregs.h" // struct bregs
-#include "config.h" // BUILD_STACK_ADDR
+#include "util.h" // yield
+#include "string.h" // memcpy
+#include "farptr.h" // SET_SEG
/****************************************************************
diff --git a/src/string.h b/src/string.h
new file mode 100644
index 0000000..7c4c5ee
--- /dev/null
+++ b/src/string.h
@@ -0,0 +1,30 @@
+// String manipulation function defs.
+#ifndef __STRING_H
+#define __STRING_H
+
+#include "types.h" // u32
+
+// string.c
+u8 checksum_far(u16 buf_seg, void *buf_far, u32 len);
+u8 checksum(void *buf, u32 len);
+size_t strlen(const char *s);
+int memcmp(const void *s1, const void *s2, size_t n);
+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 memset_fl(void *ptr, u8 val, size_t size);
+inline void memcpy_far(u16 d_seg, void *d_far
+ , u16 s_seg, const void *s_far, size_t len);
+void memcpy_fl(void *d_fl, const void *s_fl, size_t len);
+void *memcpy(void *d1, const void *s1, size_t len);
+#if MODESEGMENT == 0
+#define memcpy __builtin_memcpy
+#endif
+void iomemcpy(void *d, const void *s, u32 len);
+void *memmove(void *d, const void *s, size_t len);
+char *strtcpy(char *dest, const char *src, size_t len);
+char *strchr(const char *s, int c);
+void nullTrailingSpace(char *buf);
+
+#endif // string.h
diff --git a/src/system.c b/src/system.c
index 5269ccf..af31db7 100644
--- a/src/system.c
+++ b/src/system.c
@@ -5,12 +5,13 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "util.h" // memcpy_far
+#include "util.h" // debug_enter
#include "biosvar.h" // BIOS_CONFIG_TABLE
#include "ioport.h" // inb
#include "memmap.h" // E820_RAM
#include "hw/pic.h" // pic_reset
#include "bregs.h" // struct bregs
+#include "string.h" // memcpy_far
// Use PS2 System Control port A to set A20 enable
static inline u8
diff --git a/src/util.h b/src/util.h
index 4fa0939..230db10 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1,36 +1,9 @@
-// Basic x86 asm functions and function defs.
-//
-// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
-//
-// This file may be distributed under the terms of the GNU LGPLv3 license.
+// Misc function and variable declarations.
#ifndef __UTIL_H
#define __UTIL_H
#include "types.h" // u32
-// util.c
-u8 checksum_far(u16 buf_seg, void *buf_far, u32 len);
-u8 checksum(void *buf, u32 len);
-size_t strlen(const char *s);
-int memcmp(const void *s1, const void *s2, size_t n);
-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 memset_fl(void *ptr, u8 val, size_t size);
-inline void memcpy_far(u16 d_seg, void *d_far
- , u16 s_seg, const void *s_far, size_t len);
-void memcpy_fl(void *d_fl, const void *s_fl, size_t len);
-void *memcpy(void *d1, const void *s1, size_t len);
-#if MODESEGMENT == 0
-#define memcpy __builtin_memcpy
-#endif
-void iomemcpy(void *d, const void *s, u32 len);
-void *memmove(void *d, const void *s, size_t len);
-char *strtcpy(char *dest, const char *src, size_t len);
-char *strchr(const char *s, int c);
-void nullTrailingSpace(char *buf);
-
// stacks.c
extern u8 ExtraStack[], *StackPos;
u32 stack_hop(u32 eax, u32 edx, void *func);
diff --git a/src/vgahooks.c b/src/vgahooks.c
index 83d5a74..9917014 100644
--- a/src/vgahooks.c
+++ b/src/vgahooks.c
@@ -11,6 +11,7 @@
#include "hw/pci_ids.h" // PCI_VENDOR_ID_VIA
#include "util.h" // handle_155f
#include "config.h" // CONFIG_*
+#include "string.h" // strcmp
#define VH_VIA 1
#define VH_INTEL 2
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index 8377da1..6fc6337 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -13,6 +13,7 @@
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
+#include "string.h" // memset16_far
/****************************************************************
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c
index cdc9e44..4a63068 100644
--- a/vgasrc/geodevga.c
+++ b/vgasrc/geodevga.c
@@ -10,7 +10,7 @@
#include "farptr.h" // SET_FARVAR
#include "biosvar.h" // GET_BDA
#include "vgabios.h" // VGAREG_*
-#include "util.h" // memset
+#include "util.h" // dprintf
#include "stdvga.h" // stdvga_crtc_write
#include "hw/pci.h" // pci_config_readl
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c
index 3c92eec..baf8135 100644
--- a/vgasrc/stdvga.c
+++ b/vgasrc/stdvga.c
@@ -10,7 +10,7 @@
#include "ioport.h" // outb
#include "farptr.h" // SET_FARVAR
#include "biosvar.h" // GET_GLOBAL
-#include "util.h" // memcpy_far
+#include "string.h" // memset_far
/****************************************************************
diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index 1756ade..f22f82c 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -7,8 +7,9 @@
#include "vgabios.h" // struct VideoParamTableEntry_s
#include "biosvar.h" // GET_GLOBAL
-#include "util.h" // memcpy_far
+#include "util.h" // warn_internalerror
#include "stdvga.h" // stdvga_find_mode
+#include "string.h" // memcpy_far
/****************************************************************
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
index 2c08736..8595e69 100644
--- a/vgasrc/vbe.c
+++ b/vgasrc/vbe.c
@@ -13,6 +13,7 @@
#include "util.h" // dprintf
#include "biosvar.h" // GET_GLOBAL
#include "vgahw.h" // vgahw_set_mode
+#include "string.h" // memset_far
u32 VBE_total_memory VAR16 = 256 * 1024;
u32 VBE_capabilities VAR16;
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 506dd8d..12cd782 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -7,7 +7,7 @@
#include "bregs.h" // struct bregs
#include "biosvar.h" // GET_BDA
-#include "util.h" // memset
+#include "util.h" // dprintf
#include "vgabios.h" // calc_page_size
#include "optionroms.h" // struct pci_data
#include "config.h" // CONFIG_*
@@ -17,6 +17,7 @@
#include "vbe.h" // VBE_RETURN_STATUS_FAILED
#include "hw/pci.h" // pci_config_readw
#include "hw/pci_regs.h" // PCI_VENDOR_ID
+#include "string.h" // memset_far
// Standard Video Save Pointer Table
struct VideoSavePointer_s {
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index 3b2f367..1fa11b5 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -7,9 +7,10 @@
#include "vgabios.h" // vgafb_scroll
#include "biosvar.h" // GET_BDA
-#include "util.h" // memset_far
+#include "util.h" // dprintf
#include "byteorder.h" // cpu_to_be16
#include "stdvga.h" // stdvga_planar4_plane
+#include "string.h" // memset_far
/****************************************************************