From 1492708bbf9d44f2b0435b0ee5d9d037deeb9961 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 8 Nov 2008 19:07:49 -0500 Subject: [PATCH] Move 32bit segment defines from romlayout.S to config.h. This moves the 32bit segment names next to the real-mode segment names. Also, renames them to be more consistent. --- src/config.h | 8 +++++++- src/romlayout.S | 23 +++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/config.h b/src/config.h index 39a796d..354adcf 100644 --- a/src/config.h +++ b/src/config.h @@ -95,11 +95,17 @@ // Start of fixed addresses in 0xf0000 segment. #define BUILD_START_FIXED 0xe050 -// Important 16-bit segments +// Important real-mode segments #define SEG_BIOS 0xf000 #define SEG_EBDA 0x9fc0 #define SEG_BDA 0x0000 +// Segment definitions in 32bit mode. +#define SEG32_MODE32_CS (2 << 3) // 0x10 +#define SEG32_MODE32_DS (3 << 3) // 0x18 +#define SEG32_MODE16_CS (4 << 3) // 0x20 +#define SEG32_MODE16_DS (5 << 3) // 0x28 + // Debugging levels. If non-zero and CONFIG_DEBUG_LEVEL is greater // than the specified value, then the corresponding irq handler will // report every enter event. diff --git a/src/romlayout.S b/src/romlayout.S index dabee9a..e9ea067 100644 --- a/src/romlayout.S +++ b/src/romlayout.S @@ -7,11 +7,6 @@ #include "config.h" -#define PROTECTED_MODE_CS (2 << 3) // 0x10 -#define PROTECTED_MODE_DS (3 << 3) // 0x18 -#define REAL_MODE_CS (4 << 3) // 0x20 -#define REAL_MODE_DS (5 << 3) // 0x28 - /**************************************************************** * Include of 16bit C code @@ -164,12 +159,12 @@ transition32: movl %eax, %cr0 // start protected mode code - ljmpl $PROTECTED_MODE_CS, $(BUILD_BIOS_ADDR + 1f) + ljmpl $SEG32_MODE32_CS, $(BUILD_BIOS_ADDR + 1f) .code32 1: // init data segments - movl $PROTECTED_MODE_DS, %eax + movl $SEG32_MODE32_DS, %eax movw %ax, %ds movw %ax, %es movw %ax, %ss @@ -187,12 +182,12 @@ __call16_from32: pushl %eax // Jump to 16bit mode - ljmpw $REAL_MODE_CS, $1f + ljmpw $SEG32_MODE16_CS, $1f .code16gcc 1: // restore data segment limits to 0xffff - movw $REAL_MODE_DS, %ax + movw $SEG32_MODE16_DS, %ax movw %ax, %ds movw %ax, %es movw %ax, %ss @@ -319,7 +314,7 @@ post32: lidtl (BUILD_BIOS_ADDR + pmode_IDT_info) lgdtl (BUILD_BIOS_ADDR + rombios32_gdt_48) movl $BUILD_STACK_ADDR, %esp - ljmpl $PROTECTED_MODE_CS, $_code32__start + ljmpl $SEG32_MODE32_CS, $_code32__start .code16gcc @@ -369,13 +364,13 @@ rombios32_gdt_48: rombios32_gdt: .word 0, 0, 0, 0 .word 0, 0, 0, 0 - // 32 bit flat code segment (PROTECTED_MODE_CS) + // 32 bit flat code segment (SEG32_MODE32_CS) .word 0xffff, 0, 0x9b00, 0x00cf - // 32 bit flat data segment (PROTECTED_MODE_DS) + // 32 bit flat data segment (SEG32_MODE32_DS) .word 0xffff, 0, 0x9300, 0x00cf - // 16 bit code segment base=0xf0000 limit=0xffff (REAL_MODE_CS) + // 16 bit code segment base=0xf0000 limit=0xffff (SEG32_MODE16_CS) .word 0xffff, 0, 0x9b0f, 0x0000 - // 16 bit data segment base=0x0 limit=0xffff (REAL_MODE_DS) + // 16 bit data segment base=0x0 limit=0xffff (SEG32_MODE16_DS) .word 0xffff, 0, 0x9300, 0x0000 // We need a copy of this string in the 0xf000 segment, but we are not -- 2.25.1