diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-09-09 09:51:31 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-09-09 09:51:31 -0400 |
commit | 372e071ed4b6a66fb371cf13b6f6d14ddd00837a (patch) | |
tree | a5c939b039cd417a82288ae327fb5df6944887d3 | |
parent | 141436b5b253039436d46f0cf883fabd2822367e (diff) | |
download | seabios-372e071ed4b6a66fb371cf13b6f6d14ddd00837a.tar.gz |
Rename VAR16_32 to VAR16VISIBLE.
Sometimes VAR16_32 is used to export a definition to assembler, so
clarify its naming.
-rw-r--r-- | README | 22 | ||||
-rw-r--r-- | src/ata.c | 2 | ||||
-rw-r--r-- | src/block.c | 3 | ||||
-rw-r--r-- | src/clock.c | 2 | ||||
-rw-r--r-- | src/floppy.c | 4 | ||||
-rw-r--r-- | src/misc.c | 14 | ||||
-rw-r--r-- | src/pirtable.c | 2 | ||||
-rw-r--r-- | src/pnpbios.c | 2 | ||||
-rw-r--r-- | src/smp.c | 6 | ||||
-rw-r--r-- | src/system.c | 4 | ||||
-rw-r--r-- | src/types.h | 12 | ||||
-rw-r--r-- | src/vgahooks.c | 4 |
12 files changed, 39 insertions, 38 deletions
@@ -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: @@ -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; /**************************************************************** diff --git a/src/block.c b/src/block.c index aa341a23..c96daaf6 100644 --- a/src/block.c +++ b/src/block.c @@ -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); } diff --git a/src/clock.c b/src/clock.c index 55b8f959..c95f0a14 100644 --- a/src/clock.c +++ b/src/clock.c @@ -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() diff --git a/src/floppy.c b/src/floppy.c index a71c9eba..3d8d07d3 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -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 @@ -11,11 +11,11 @@ #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), }; diff --git a/src/pirtable.c b/src/pirtable.c index a83d4f7e..18d3ff51 100644 --- a/src/pirtable.c +++ b/src/pirtable.c @@ -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; diff --git a/src/pnpbios.c b/src/pnpbios.c index 7d9ece50..4e7abc69 100644 --- a/src/pnpbios.c +++ b/src/pnpbios.c @@ -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 @@ -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" diff --git a/src/system.c b/src/system.c index 8236cf0f..a9f271ee 100644 --- a/src/system.c +++ b/src/system.c @@ -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) diff --git a/src/types.h b/src/types.h index 215b666a..7edd8093 100644 --- a/src/types.h +++ b/src/types.h @@ -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) diff --git a/src/vgahooks.c b/src/vgahooks.c index ddeb1d31..701e83cc 100644 --- a/src/vgahooks.c +++ b/src/vgahooks.c @@ -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) |