diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-09-14 19:10:40 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-09-18 20:48:34 -0400 |
commit | fa9c66a6560a5009302aff22602ffa3e955726d9 (patch) | |
tree | 55215b572a47412f5eefb884517e6b71aaf9ee68 /src | |
parent | 0ac5e9e0fc84032c99d9be6c4903afb2d616c97f (diff) | |
download | seabios-fa9c66a6560a5009302aff22602ffa3e955726d9.tar.gz |
Rename util.c to string.c and introduce string.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
55 files changed, 98 insertions, 44 deletions
diff --git a/src/block.c b/src/block.c index 74c64970..c6e4167e 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; @@ -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)) @@ -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 bd91102f..f4f8ea90 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 94265b04..0d3fa1f5 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 cc962e47..fc91db77 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 @@ -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 fcf11ea0..8abd205f 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 beb0bed3..cd58ff91 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 126649a2..6da90b58 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 0093bee5..4a78bacc 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 47fe53d4..ecc618a5 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 a68e3a19..2be42811 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 ca32d431..ee8d5dd0 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 57fb48f2..d66d21ba 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 767c6eae..45cfcafd 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 93fb57fd..f80b42b9 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 3a1a7998..8ca1e83c 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 6e21bff7..f181e5ff 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 e2729a97..297351a8 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 e319aa96..705e106e 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 5cd4eb0e..6f79cc59 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 42a790f9..49c74ffd 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 37b70924..ae66bc0c 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 cebe9674..0563fab4 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 f4eeba07..144fb840 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 d1115a47..7fdde2a5 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 b9da2ad3..6e730bfe 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 333679e4..bb02293a 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 0b55d15d..5bef26fb 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 7b2524d4..d5cf1b45 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 c1806ff1..0febcca7 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 31693896..c205d7f8 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 d8f9b1e1..4716d985 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 647359e5..40265552 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 6c0cd74b..761e64fa 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 4b9ad0ac..6a164630 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 4de1255f..06f7b60c 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; @@ -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)) @@ -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 d617b818..ab1bcadb 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 /**************************************************************** @@ -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 ffa426dc..8288e5fa 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 8b63d9ab..918a6edb 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 43eb5471..5b242c94 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); @@ -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 fddcc816..e67425f3 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; @@ -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 5323d7ea..7fb4a759 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 ea71d1f0..f19f756a 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 ee59b135..5f2dede9 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 00000000..7c4c5ee9 --- /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 5269ccf9..af31db7d 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 @@ -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 83d5a74b..99170149 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 |