]> xenbits.xensource.com Git - seabios.git/commitdiff
Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.
authorKevin O'Connor <kevin@koconnor.net>
Tue, 19 Feb 2013 04:36:03 +0000 (23:36 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 19 Feb 2013 04:36:03 +0000 (23:36 -0500)
Convert all users of the alternative variable exports to VARFSEG.
There isn't a significant distinction between the existing types of
exports, so it's simpler to just use one type going forward.

The new VARFSEG declaration is only emitting when in 32bit mode, so
update and move some variables as needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
25 files changed:
Makefile
src/block.c
src/cdrom.c
src/clock.c
src/csm.c
src/floppy.c
src/memmap.c
src/memmap.h
src/misc.c
src/output.c
src/paravirt.c
src/paravirt.h
src/pci.c
src/pcibios.c
src/pirtable.c
src/pmm.c
src/pnpbios.c
src/resume.c
src/smp.c
src/stacks.c
src/system.c
src/types.h
src/usb-hid.c
src/vgahooks.c
vgasrc/vgabios.c

index ab9ca0e75719535261feeea4541679fc979045ba..1ce2f79c7c63b978c2fcfe47bf9e910e881b9c4d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,15 +8,15 @@
 OUT=out/
 
 # Source files
-SRCBOTH=misc.c stacks.c pmm.c output.c util.c block.c floppy.c ata.c mouse.c \
+SRCBOTH=misc.c stacks.c output.c util.c block.c floppy.c ata.c mouse.c \
     kbd.c pci.c serial.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \
-    pnpbios.c pirtable.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
+    pnpbios.c vgahooks.c ramdisk.c pcibios.c blockcmd.c \
     usb.c usb-uhci.c usb-ohci.c usb-ehci.c usb-hid.c usb-msc.c \
     virtio-ring.c virtio-pci.c virtio-blk.c virtio-scsi.c apm.c ahci.c \
     usb-uas.c lsi-scsi.c esp-scsi.c megasas.c
 SRC16=$(SRCBOTH) system.c disk.c font.c
-SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
-    acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
+SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c pmm.c coreboot.c boot.c \
+    acpi.c smm.c mptable.c pirtable.c smbios.c pciinit.c optionroms.c mtrr.c \
     lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c \
     biostables.c xen.c bmp.c romfile.c csm.c
 SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
index c202f5ae99ba19f3a0220f07e3d4400cd6033efa..9ea4ca7449824786b852c79209560bdcedfece73 100644 (file)
 #include "virtio-blk.h" // process_virtio_blk_op
 #include "blockcmd.h" // cdb_*
 
-u8 FloppyCount VAR16VISIBLE;
+u8 FloppyCount VARFSEG;
 u8 CDCount;
-struct drive_s *IDMap[3][CONFIG_MAX_EXTDRIVE] VAR16VISIBLE;
-u8 *bounce_buf_fl VAR16VISIBLE;
+struct drive_s *IDMap[3][CONFIG_MAX_EXTDRIVE] VARFSEG;
+u8 *bounce_buf_fl VARFSEG;
 struct dpte_s DefaultDPTE VARLOW;
 
 struct drive_s *
index 81b97f79b3a1b757caad7f06e675977510d8e172..01eb87a4773a545aaff18dc8ef5f903e49fb8e50 100644 (file)
@@ -21,7 +21,7 @@ u8 CDRom_locks[CONFIG_MAX_EXTDRIVE] VARLOW;
  ****************************************************************/
 
 struct cdemu_s CDEmu VARLOW;
-struct drive_s *cdemu_drive_gf VAR16VISIBLE;
+struct drive_s *cdemu_drive_gf VARFSEG;
 
 static int
 cdemu_read(struct disk_op_s *op)
index 708d413f2d8698d630cb564454dea64524fa9bc4..79b18f91a383e3fa426fea26e026485f07215fec 100644 (file)
 
 #define CALIBRATE_COUNT 0x800   // Approx 1.7ms
 
-u32 cpu_khz VAR16VISIBLE;
-u8 no_tsc VAR16VISIBLE;
+u32 cpu_khz VARFSEG;
+u8 no_tsc VARFSEG;
 
-u16 pmtimer_ioport VAR16VISIBLE;
+u16 pmtimer_ioport VARFSEG;
 u32 pmtimer_wraps VARLOW;
 u32 pmtimer_last VARLOW;
 
index b5d8b541dfa3e187bc8cde3a496532e5f9eade9e..8882ee5ef8c8c789a6e0655c25bb66af04b98ff2 100644 (file)
--- a/src/csm.c
+++ b/src/csm.c
@@ -18,9 +18,9 @@
 #include "smbios.h"
 #include "pic.h"
 
-struct rsdp_descriptor VAR32FLATVISIBLE __aligned(16) csm_rsdp;
+struct rsdp_descriptor csm_rsdp VARFSEG __aligned(16);
 
-EFI_COMPATIBILITY16_TABLE csm_compat_table VAR32FLATVISIBLE __aligned(16) = {
+EFI_COMPATIBILITY16_TABLE csm_compat_table VARFSEG __aligned(16) = {
     .Signature = 0x24454649,
     .TableChecksum = 0 /* Filled in by checkrom.py */,
     .TableLength = sizeof(csm_compat_table),
index 2887e78aeea74804cf794248477bd30db5c5d1fd..d73e4ae8258f377d892309bbf78faaf1fd448cb4 100644 (file)
@@ -28,7 +28,7 @@
 // Since no provisions are made for multiple drive types, most
 // values in this table are ignored.  I set parameters for 1.44M
 // floppy here
-struct floppy_ext_dbt_s diskette_param_table2 VAR16VISIBLE = {
+struct floppy_ext_dbt_s diskette_param_table2 VARFSEG = {
     .dbt = {
         .specify1       = 0xAF, // step rate 12ms, head unload 240ms
         .specify2       = 0x02, // head load time 4ms, DMA used
@@ -55,7 +55,7 @@ struct floppyinfo_s {
     u8 media_state;
 };
 
-struct floppyinfo_s FloppyInfo[] VAR16VISIBLE = {
+struct floppyinfo_s FloppyInfo[] VARFSEG = {
     // Unknown
     { {0, 0, 0}, 0x00, 0x00},
     // 1 - 360KB, 5.25" - 2 heads, 40 tracks, 9 sectors
index 29ca64403377cdda03e0225b0faa92b3f2856ba4..f029ce2496ac16670bbee3affc71fd9a7b05f73d 100644 (file)
  * e820 memory map
  ****************************************************************/
 
+// Info on e820 map location and size.
+struct e820entry e820_list[CONFIG_MAX_E820] VARFSEG;
+int e820_count VARFSEG;
+
 // Remove an entry from the e820_list.
 static void
 remove_e820(int i)
index 783a04228f809a6525ebd58f211c33871bea9fdf..7bda56e2b87dfa782b563048f1a59afafb89babe 100644 (file)
@@ -22,11 +22,8 @@ void memmap_prepboot(void);
 // A typical OS page size
 #define PAGE_SIZE 4096
 
-// e820 map storage (defined in system.c)
+// e820 map storage
 extern struct e820entry e820_list[];
 extern int e820_count;
 
-// Space for exported bios tables (defined in misc.c)
-extern char BiosTableSpace[];
-
 #endif // e820map.h
index 05d0cf582da3aff25a94ae688dd78d1d61321d7e..fb7aad44581b0ad0774570af23a0e836a2d5283c 100644 (file)
 #include "pic.h" // enable_hwirq
 
 // Amount of continuous ram under 4Gig
-u32 RamSize VAR16VISIBLE;
+u32 RamSize VARFSEG;
 // Amount of continuous ram >4Gig
 u64 RamSizeOver4G;
-// Space for bios tables built an run-time.
-char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VAR16VISIBLE;
-// Type of emulator platform.
-int PlatformRunningOn VAR16VISIBLE;
 
 
 /****************************************************************
@@ -133,23 +129,23 @@ struct bios_config_table_s BIOS_CONFIG_TABLE VAR16FIXED(0xe6f5) = {
  ****************************************************************/
 
 // Real mode IDT descriptor
-struct descloc_s rmode_IDT_info VAR16VISIBLE = {
+struct descloc_s rmode_IDT_info VARFSEG = {
     .length = sizeof(struct rmode_IVT) - 1,
     .addr = (u32)MAKE_FLATPTR(SEG_IVT, 0),
 };
 
 // Dummy IDT that forces a machine shutdown if an irq happens in
 // protected mode.
-u8 dummy_IDT VAR16VISIBLE;
+u8 dummy_IDT VARFSEG;
 
 // Protected mode IDT descriptor
-struct descloc_s pmode_IDT_info VAR16VISIBLE = {
+struct descloc_s pmode_IDT_info VARFSEG = {
     .length = sizeof(dummy_IDT) - 1,
-    .addr = (u32)MAKE_FLATPTR(SEG_BIOS, &dummy_IDT),
+    .addr = (u32)&dummy_IDT,
 };
 
 // GDT
-u64 rombios32_gdt[] VAR16VISIBLE __aligned(8) = {
+u64 rombios32_gdt[] VARFSEG __aligned(8) = {
     // First entry can't be used.
     0x0000000000000000LL,
     // 32 bit flat code segment (SEG32_MODE32_CS)
@@ -167,9 +163,9 @@ u64 rombios32_gdt[] VAR16VISIBLE __aligned(8) = {
 };
 
 // GDT descriptor
-struct descloc_s rombios32_gdt_48 VAR16VISIBLE = {
+struct descloc_s rombios32_gdt_48 VARFSEG = {
     .length = sizeof(rombios32_gdt) - 1,
-    .addr = (u32)MAKE_FLATPTR(SEG_BIOS, rombios32_gdt),
+    .addr = (u32)rombios32_gdt,
 };
 
 
index e623d37cd1fc27f8d69ef1c8ca0e6aae654c97c5..79c3adac9e5187e10c5d7b5c34e3611475f850cc 100644 (file)
@@ -23,7 +23,7 @@ struct putcinfo {
 
 #define DEBUG_TIMEOUT 100000
 
-u16 DebugOutputPort VAR16VISIBLE = 0x402;
+u16 DebugOutputPort VARFSEG = 0x402;
 
 void
 debug_serial_preinit(void)
index f76b47f3264147494c3d027fc2108b19714d9a77..9ea3dd535d1f17976e06e8d3d02d68c06a869249 100644 (file)
@@ -21,6 +21,9 @@
 #include "pci.h" // create_pirtable
 #include "xen.h" // xen_biostable_setup
 
+// Type of emulator platform.
+int PlatformRunningOn VARFSEG;
+
 /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
  * should be used to determine that a VM is running under KVM.
  */
index 96b35ba76084387529b78b5de04de7fac009b60f..72377317dbbc6ce5024a8bec1c5fe834a8f0b6be 100644 (file)
@@ -9,7 +9,6 @@
 #define PF_XEN      (1<<1)
 #define PF_KVM      (1<<2)
 
-// misc.c
 extern int PlatformRunningOn;
 
 static inline int runningOnQEMU(void) {
index 071c3025b5467ebeb5c3dc266200f7de8bcc9e5c..4f6a6fab7a7b4ac6b60189598c78c4a0f4c4dbaa 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -86,7 +86,7 @@ pci_next(int bdf, int bus)
 }
 
 struct pci_device *PCIDevices;
-int MaxPCIBus VAR16VISIBLE;
+int MaxPCIBus VARFSEG;
 
 // Check if PCI is available at all
 int
index f084fa1086971563e9cfdfedb3cf59cf6c9e7555..0f3ec5bc6623de2abb2b7a3845a4787bdba63c9c 100644 (file)
@@ -223,7 +223,7 @@ struct bios32_s {
     u8 reserved[5];
 } PACKED;
 
-struct bios32_s BIOS32HEADER __aligned(16) VAR16EXPORT = {
+struct bios32_s BIOS32HEADER __aligned(16) VARFSEG = {
     .signature = 0x5f32335f, // _32_
     .length = sizeof(BIOS32HEADER) / 16,
 };
index 8b7979165a918694681a2e74353addd08b5f1f61..02e2a678a6c479fef65e647ec1fc8bb7dc0d2835 100644 (file)
@@ -9,7 +9,7 @@
 #include "config.h" // CONFIG_*
 #include "util.h" // checksum
 
-struct pir_header *PirAddr VAR16VISIBLE;
+struct pir_header *PirAddr VARFSEG;
 
 struct pir_table {
     struct pir_header pir;
@@ -18,7 +18,7 @@ struct pir_table {
 
 extern struct pir_table PIR_TABLE;
 #if CONFIG_PIRTABLE
-struct pir_table PIR_TABLE __aligned(16) VAR16EXPORT = {
+struct pir_table PIR_TABLE __aligned(16) VARFSEG = {
     .pir = {
         .version = 0x0100,
         .size = sizeof(struct pir_table),
index 790177ec9a52295c64297bde712fdc87deb58c9f..8944baecec4bfe18251ab37d865b50e5b741fb8d 100644 (file)
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -216,6 +216,9 @@ rom_confirm(u32 size)
  * Setup
  ****************************************************************/
 
+// Space for bios tables built an run-time.
+char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VARFSEG;
+
 void
 malloc_preinit(void)
 {
@@ -457,7 +460,7 @@ extern struct pmmheader PMMHEADER;
 #define PMM_SIGNATURE 0x4d4d5024 // $PMM
 
 #if CONFIG_PMM
-struct pmmheader PMMHEADER __aligned(16) VAR16EXPORT = {
+struct pmmheader PMMHEADER __aligned(16) VARFSEG = {
     .signature = PMM_SIGNATURE,
     .version = 0x01,
     .length = sizeof(PMMHEADER),
index c8bc8f44579209d1577adadfc58467d030947354..fddcc816603891e729669a25ef254d6dd3f7c721 100644 (file)
@@ -28,7 +28,7 @@ extern struct pnpheader PNPHEADER;
 extern char pnp_string[];
 
 #if CONFIG_PNPBIOS
-struct pnpheader PNPHEADER __aligned(16) VAR16EXPORT = {
+struct pnpheader PNPHEADER __aligned(16) VARFSEG = {
     .signature = PNP_SIGNATURE,
     .version = 0x10,
     .length = sizeof(PNPHEADER),
@@ -41,7 +41,7 @@ struct pnpheader PNPHEADER __aligned(16) VAR16EXPORT = {
 // We need a copy of this string in the 0xf000 segment, but we are not
 // actually a PnP BIOS, so make sure it is *not* aligned, so OSes will
 // not see it if they scan.
-char pnp_string[] __aligned(2) VAR16VISIBLE = " $PnP";
+char pnp_string[] __aligned(2) VARFSEG = " $PnP";
 #endif
 
 #define FUNCTION_NOT_SUPPORTED 0x82
index adc359405045205cc7c3ea3263cb0196861e098b..b30d62eb1025fcee935f61a73df0ff6d5bd4b8b8 100644 (file)
@@ -15,7 +15,7 @@
 #include "cmos.h" // inb_cmos
 
 // Indicator if POST phase has been run.
-int HaveRunPost VAR16VISIBLE;
+int HaveRunPost VARFSEG;
 
 // Reset DMA controller
 void
index f971647a991d414532fdb5797b0b35bfbae5f671..0dfec290ea514ae67e3ef4fd0145c665fd5fdc2f 100644 (file)
--- a/src/smp.c
+++ b/src/smp.c
@@ -16,8 +16,8 @@
 
 #define APIC_ENABLED 0x0100
 
-struct { u32 ecx, eax, edx; } smp_mtrr[32] VAR16VISIBLE;
-u32 smp_mtrr_count VAR16VISIBLE;
+struct { u32 ecx, eax, edx; } smp_mtrr[32] VARFSEG;
+u32 smp_mtrr_count VARFSEG;
 
 void
 wrmsr_smp(u32 index, u64 val)
@@ -33,10 +33,10 @@ wrmsr_smp(u32 index, u64 val)
     smp_mtrr_count++;
 }
 
-u32 CountCPUs VAR16VISIBLE;
-u32 MaxCountCPUs VAR16VISIBLE;
+u32 CountCPUs VARFSEG;
+u32 MaxCountCPUs VARFSEG;
 // 256 bits for the found APIC IDs
-u32 FoundAPICIDs[256/32] VAR16VISIBLE;
+u32 FoundAPICIDs[256/32] VARFSEG;
 extern void smp_ap_boot_code(void);
 ASM16(
     "  .global smp_ap_boot_code\n"
index 93da7b51525b8a8b65bb71056f684c4658e3faca..7423939e000248f4ac9b7a70552a020008a2d290 100644 (file)
@@ -243,7 +243,7 @@ struct thread_info {
     void *stackpos;
     struct thread_info **pprev;
 };
-struct thread_info VAR32FLATVISIBLE MainThread = {
+struct thread_info MainThread VARFSEG = {
     &MainThread, NULL, &MainThread.next
 };
 #define THREADSTACKSIZE 4096
@@ -424,7 +424,7 @@ mutex_unlock(struct mutex_s *mutex)
  * Thread preemption
  ****************************************************************/
 
-int VAR16VISIBLE CanPreempt;
+int CanPreempt VARFSEG;
 static u32 PreemptCount;
 
 // Turn on RTC irqs and arrange for them to check the 32bit threads.
index 6658e22b84d3c59c17c7b7fc60f425facbb8f3b6..dc1dd7d61402511a2eb22080a9ec6e144b4ccafa 100644 (file)
@@ -290,10 +290,6 @@ handle_15e801(struct bregs *regs)
     set_success(regs);
 }
 
-// Info on e820 map location and size.
-struct e820entry e820_list[CONFIG_MAX_E820] VAR16VISIBLE;
-int e820_count VAR16VISIBLE;
-
 static void
 handle_15e820(struct bregs *regs)
 {
index ce0f081815169f58739ee2499344ce85ff42448a..4df1476282205df7d109df9b9830e3191b2b7ce6 100644 (file)
@@ -51,16 +51,10 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 # define VISIBLE32SEG
 // Designate a variable as (only) visible to 16bit code.
 # define VAR16 __section(".data16." UNIQSEC)
-// Designate a variable as visible to 16bit, 32bit, and assembler code.
-# define VAR16VISIBLE VAR16 __VISIBLE
-// Designate a variable as externally visible (in addition to all internal code).
-# define VAR16EXPORT __section(".data16.export." UNIQSEC) __VISIBLE
 // Designate a variable at a specific 16bit address
 # define VAR16FIXED(addr) __aligned(1) __VISIBLE __section(".fixedaddr." __stringify(addr))
 // Designate a variable as (only) visible to 32bit segmented code.
 # define VAR32SEG __section(".discard.var32seg." UNIQSEC)
-// Designate a 32bit variable also available in 16bit "big real" mode.
-# define VAR32FLATVISIBLE __section(".discard.var32flat." UNIQSEC) __VISIBLE __weak
 // Designate a variable as visible and located in the e-segment.
 # define VARLOW __section(".discard.varlow." UNIQSEC) __VISIBLE __weak
 // Designate a variable as visible and located in the f-segment.
@@ -79,11 +73,8 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 # define VISIBLE32INIT
 # define VISIBLE32SEG __VISIBLE
 # define VAR16 __section(".discard.var16." UNIQSEC)
-# define VAR16VISIBLE VAR16 __VISIBLE __weak
-# define VAR16EXPORT VAR16VISIBLE
-# define VAR16FIXED(addr) VAR16VISIBLE
+# define VAR16FIXED(addr) VAR16 __VISIBLE __weak
 # define VAR32SEG __section(".data32seg." UNIQSEC)
-# define VAR32FLATVISIBLE __section(".discard.var32flat." UNIQSEC) __VISIBLE __weak
 # define VARLOW __section(".discard.varlow." UNIQSEC) __VISIBLE __weak
 # define VARFSEG __section(".discard.varfseg." UNIQSEC) __VISIBLE __weak
 # define ASM16(code)
@@ -97,11 +88,8 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 # define VISIBLE32INIT __section(".text.init." UNIQSEC) __VISIBLE
 # define VISIBLE32SEG
 # define VAR16 __section(".discard.var16." UNIQSEC)
-# define VAR16VISIBLE VAR16 __VISIBLE __weak
-# define VAR16EXPORT VAR16VISIBLE
-# define VAR16FIXED(addr) VAR16VISIBLE
+# define VAR16FIXED(addr) VAR16 __VISIBLE __weak
 # define VAR32SEG __section(".discard.var32seg." UNIQSEC)
-# define VAR32FLATVISIBLE __section(".data.runtime." UNIQSEC) __VISIBLE
 # define VARLOW __section(".data.varlow." UNIQSEC) __VISIBLE
 # define VARFSEG __section(".data.varfseg." UNIQSEC) __VISIBLE
 # define ASM16(code)
index 0d5f371093de3094e7ff9021530d0e6f809ac8e7..deb3ea54dd84ae5a64d0ea7343a459f6e6442682 100644 (file)
@@ -11,8 +11,8 @@
 #include "biosvar.h" // GET_GLOBAL
 #include "ps2port.h" // ATKBD_CMD_GETID
 
-struct usb_pipe *keyboard_pipe VAR16VISIBLE;
-struct usb_pipe *mouse_pipe VAR16VISIBLE;
+struct usb_pipe *keyboard_pipe VARFSEG;
+struct usb_pipe *mouse_pipe VARFSEG;
 
 
 /****************************************************************
index 20a2e2e2947bd7f48ac822b5adac0322f23d2a3c..c9a444886545ba5b69d36b6c5a57a2b6eed241bb 100644 (file)
@@ -15,7 +15,7 @@
 #define VH_VIA 1
 #define VH_INTEL 2
 
-int VGAHookHandlerType VAR16VISIBLE;
+int VGAHookHandlerType VARFSEG;
 
 static void
 handle_155fXX(struct bregs *regs)
@@ -28,7 +28,7 @@ handle_155fXX(struct bregs *regs)
  * Via hooks
  ****************************************************************/
 
-int ViaFBsize VAR16VISIBLE, ViaRamSpeed VAR16VISIBLE;
+int ViaFBsize VARFSEG, ViaRamSpeed VARFSEG;
 
 static void
 via_155f01(struct bregs *regs)
@@ -167,7 +167,7 @@ via_setup(struct pci_device *pci)
  * Intel VGA hooks
  ****************************************************************/
 
-u8 IntelDisplayType VAR16VISIBLE, IntelDisplayId VAR16VISIBLE;
+u8 IntelDisplayType VARFSEG, IntelDisplayId VARFSEG;
 
 static void
 intel_155f35(struct bregs *regs)
index 3e26e324333906033ca80e85484035f6bd41d99b..6abe6395114b7592df2f1e5e62e182a0a6e840d9 100644 (file)
@@ -37,7 +37,7 @@ struct VideoParam_s video_param_table[29] VAR16;
  * PCI Data
  ****************************************************************/
 
-struct pci_data rom_pci_data VAR16VISIBLE = {
+struct pci_data rom_pci_data VAR16 VISIBLE16 = {
     .signature = PCI_ROM_SIGNATURE,
     .vendor = CONFIG_VGA_VID,
     .device = CONFIG_VGA_DID,