// 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.
#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
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
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
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
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