Rename VAR16_32 to VAR16VISIBLE.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 9 Sep 2009 13:51:31 +0000 (09:51 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 9 Sep 2009 13:51:31 +0000 (09:51 -0400)
Sometimes VAR16_32 is used to export a definition to assembler, so
    clarify its naming.

12 files changed:
README
src/ata.c
src/block.c
src/clock.c
src/floppy.c
src/misc.c
src/pirtable.c
src/pnpbios.c
src/smp.c
src/system.c
src/types.h
src/vgahooks.c

diff --git a/README b/README
index ea734fd496844a599973f75d92f51f456f3af09a..8f1bd2081b0433b4b335c639c96f1b0e702d81a3 100644 (file)
--- a/README
+++ b/README
@@ -118,17 +118,17 @@ macros (GET/SET_GLOBAL, GET/SET_BDA, and GET/SET_EBDA) are available
 to simplify these accesses.
 
 Global variables defined in the C code can be read in 16bit mode if
-the variable declaration is marked with VAR16, VAR16_32, VAR16EXPORT,
-or VAR16FIXED.  The GET_GLOBAL macro will then allow read access to
-the variable.  Global variables are stored in the 0xf000 segment, and
-their values are persistent across soft resets.  Because the f-segment
-is marked read-only during run-time, the 16bit code is not permitted
-to change the value of 16bit variables (use of the SET_GLOBAL macro
-from 16bit mode will cause a link error).  Code running in 32bit mode
-can not access variables with VAR16, but can access variables marked
-with VAR16_32, VAR16EXPORT, VAR16FIXED, or with no marking at all.
-The 32bit code can use the GET/SET_GLOBAL macros, but they are not
-required.
+the variable declaration is marked with VAR16, VAR16VISIBLE,
+VAR16EXPORT, or VAR16FIXED.  The GET_GLOBAL macro will then allow read
+access to the variable.  Global variables are stored in the 0xf000
+segment, and their values are persistent across soft resets.  Because
+the f-segment is marked read-only during run-time, the 16bit code is
+not permitted to change the value of 16bit variables (use of the
+SET_GLOBAL macro from 16bit mode will cause a link error).  Code
+running in 32bit mode can not access variables with VAR16, but can
+access variables marked with VAR16VISIBLE, VAR16EXPORT, VAR16FIXED, or
+with no marking at all.  The 32bit code can use the GET/SET_GLOBAL
+macros, but they are not required.
 
 
 GCC 16 bit stack limitations:
index c82e8a3e308fb17292823d4de6c880f094b5cf1f..98d114159fda800072da2b01e0f4ecb760157d51 100644 (file)
--- a/src/ata.c
+++ b/src/ata.c
@@ -23,7 +23,7 @@
 
 #define IDE_TIMEOUT 32000 //32 seconds max for IDE ops
 
-struct ata_channel_s ATA_channels[CONFIG_MAX_ATA_INTERFACES] VAR16_32;
+struct ata_channel_s ATA_channels[CONFIG_MAX_ATA_INTERFACES] VAR16VISIBLE;
 
 
 /****************************************************************
index aa341a23d0c53cc5e7ddd9382d195070cf7744d3..c96daaf610daceb3f807ade43c7f5ee49be53a18 100644 (file)
@@ -11,7 +11,7 @@
 #include "util.h" // dprintf
 #include "ata.h" // process_ata_op
 
-struct drives_s Drives VAR16_32;
+struct drives_s Drives VAR16VISIBLE;
 
 
 /****************************************************************
@@ -280,6 +280,7 @@ send_disk_op(struct disk_op_s *op)
 {
     if (! CONFIG_DRIVES)
         return -1;
+    ASSERT16();
 
     return stack_hop((u32)op, GET_SEG(SS), 0, __send_disk_op);
 }
index 55b8f9596110abb06c478560f17ddf8dc787ea34..c95f0a142ebb4b7ac4d8c0e0650b91065ded0048 100644 (file)
@@ -56,7 +56,7 @@
 #define PIT_TICK_RATE 1193182 // Underlying HZ of PIT
 #define CALIBRATE_COUNT 0x800 // Approx 1.7ms
 
-u32 cpu_khz VAR16_32;
+u32 cpu_khz VAR16VISIBLE;
 
 static void
 calibrate_tsc()
index a71c9eba59cf1c67ad0075e591a75fbed61e45fa..3d8d07d386c3fc21effcc6cbe1923f0f23ba9328 100644 (file)
@@ -26,7 +26,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 VAR16_32 = {
+struct floppy_ext_dbt_s diskette_param_table2 VAR16VISIBLE = {
     .dbt = {
         .specify1       = 0xAF, // step rate 12ms, head unload 240ms
         .specify2       = 0x02, // head load time 4ms, DMA used
@@ -68,7 +68,7 @@ struct floppyinfo_s {
     u8 media_state;
 };
 
-struct floppyinfo_s FloppyInfo[] VAR16_32 = {
+struct floppyinfo_s FloppyInfo[] VAR16VISIBLE = {
     // Unknown
     { {0, 0, 0}, 0x00, 0x00},
     // 1 - 360KB, 5.25" - 2 heads, 40 tracks, 9 sectors
index 2d702a48198167cdf6cce9b4542f1239d267c317..b12e860eae2f70c2297cd7401b1aba4fd69c897d 100644 (file)
 #include "pic.h" // enable_hwirq
 
 // Amount of continuous ram under 4Gig
-u32 RamSize VAR16_32;
+u32 RamSize VAR16VISIBLE;
 // Amount of continuous ram >4Gig
 u64 RamSizeOver4G;
 // Space for bios tables built an run-time.
-char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VAR16_32;
+char BiosTableSpace[CONFIG_MAX_BIOSTABLE] __aligned(MALLOC_MIN_ALIGN) VAR16VISIBLE;
 
 
 /****************************************************************
@@ -134,23 +134,23 @@ struct descloc_s {
 } PACKED;
 
 // Real mode IDT descriptor
-struct descloc_s rmode_IDT_info VAR16_32 = {
+struct descloc_s rmode_IDT_info VAR16VISIBLE = {
     .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 VAR16_32;
+u8 dummy_IDT VAR16VISIBLE;
 
 // Protected mode IDT descriptor
-struct descloc_s pmode_IDT_info VAR16_32 = {
+struct descloc_s pmode_IDT_info VAR16VISIBLE = {
     .length = sizeof(dummy_IDT) - 1,
     .addr = (u32)MAKE_FLATPTR(SEG_BIOS, &dummy_IDT),
 };
 
 // GDT
-u64 rombios32_gdt[] VAR16_32 __aligned(8) = {
+u64 rombios32_gdt[] VAR16VISIBLE __aligned(8) = {
     // First entry can't be used.
     0x0000000000000000LL,
     // 32 bit flat code segment (SEG32_MODE32_CS)
@@ -168,7 +168,7 @@ u64 rombios32_gdt[] VAR16_32 __aligned(8) = {
 };
 
 // GDT descriptor
-struct descloc_s rombios32_gdt_48 VAR16_32 = {
+struct descloc_s rombios32_gdt_48 VAR16VISIBLE = {
     .length = sizeof(rombios32_gdt) - 1,
     .addr = (u32)MAKE_FLATPTR(SEG_BIOS, rombios32_gdt),
 };
index a83d4f7eaf4545b26ce76b30a46eb41000d8104d..18d3ff5133bf9fd7f78fbfc20ca8b31dff775e3e 100644 (file)
@@ -9,7 +9,7 @@
 #include "util.h" // checksum
 #include "biosvar.h" // SET_EBDA
 
-u16 PirOffset VAR16_32;
+u16 PirOffset VAR16VISIBLE;
 
 struct pir_table {
     struct pir_header pir;
index 7d9ece509bb261c4e9c1d505802e33aacc89bffb..4e7abc69785f0d0c6bc62f65efcf10b767633748 100644 (file)
@@ -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) VAR16_32 = " $PnP";
+char pnp_string[] __aligned(2) VAR16VISIBLE = " $PnP";
 #endif
 
 #define FUNCTION_NOT_SUPPORTED 0x82
index 49e5631ed8c6c0b88834ce1ea310ac402d519ac0..44a7929b743e471d05f674e877da81c8cd2cae1d 100644 (file)
--- a/src/smp.c
+++ b/src/smp.c
@@ -45,8 +45,8 @@ static inline u8 readb(const void *addr)
     return *(volatile const u8 *)addr;
 }
 
-struct { u32 ecx, eax, edx; } smp_mtrr[16] VAR16_32;
-u32 smp_mtrr_count VAR16_32;
+struct { u32 ecx, eax, edx; } smp_mtrr[16] VAR16VISIBLE;
+u32 smp_mtrr_count VAR16VISIBLE;
 
 void
 wrmsr_smp(u32 index, u64 val)
@@ -60,7 +60,7 @@ wrmsr_smp(u32 index, u64 val)
     smp_mtrr_count++;
 }
 
-u32 CountCPUs VAR16_32;
+u32 CountCPUs VAR16VISIBLE;
 extern void smp_ap_boot_code();
 ASM16(
     "  .global smp_ap_boot_code\n"
index 8236cf0f47afb6b0a6a6f81b93f95a401d77b3aa..a9f271eeee6ca5b27a943c793c848b268f806a20 100644 (file)
@@ -247,8 +247,8 @@ handle_15e801(struct bregs *regs)
 }
 
 // Info on e820 map location and size.
-struct e820entry e820_list[CONFIG_MAX_E820] VAR16_32;
-int e820_count VAR16_32;
+struct e820entry e820_list[CONFIG_MAX_E820] VAR16VISIBLE;
+int e820_count VAR16VISIBLE;
 
 static void
 handle_15e820(struct bregs *regs)
index 215b666a8a9149b3be02f70081d484f6a6792d2d..7edd8093ba230a8e767adda64de80491a02120ff 100644 (file)
@@ -42,9 +42,9 @@ union u64_u32_u {
 # define VISIBLE32
 // Designate a variable as (only) visible to 16bit code.
 # define VAR16 __section(".data16." UNIQSEC)
-// Designate a variable as visible to both 32bit and 16bit code.
-# define VAR16_32 VAR16 __VISIBLE
-// Designate a variable visible externally.
+// 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))
@@ -58,9 +58,9 @@ union u64_u32_u {
 # define VISIBLE16
 # define VISIBLE32 __VISIBLE
 # define VAR16 __section(".discard.var16." UNIQSEC)
-# define VAR16_32 VAR16 __VISIBLE __weak
-# define VAR16EXPORT VAR16_32
-# define VAR16FIXED(addr) VAR16_32
+# define VAR16VISIBLE VAR16 __VISIBLE __weak
+# define VAR16EXPORT VAR16VISIBLE
+# define VAR16FIXED(addr) VAR16VISIBLE
 # define VAR32VISIBLE __VISIBLE
 # define ASM16(code)
 # define ASM32(code) __ASM(code)
index ddeb1d31d7bf210a23a6d348c19fd12cae0771be..701e83cc613229ba1f587c95292e57b558338a5f 100644 (file)
@@ -13,9 +13,9 @@
 #include "config.h" // CONFIG_*
 
 // The Bus/Dev/Fn of the primary VGA device.
-int VGAbdf VAR16_32;
+int VGAbdf VAR16VISIBLE;
 // Coreboot board detected.
-int CBmainboard VAR16_32;
+int CBmainboard VAR16VISIBLE;
 
 static void
 handle_155fXX(struct bregs *regs)