summaryrefslogtreecommitdiff
path: root/src/device/oprom/realmode
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2019-10-25 08:09:33 +0200
committerAaron Durbin <adurbin@chromium.org>2019-10-29 19:41:19 +0000
commit776da0872efcc58543afbe32fc55202521ef0014 (patch)
tree8c7d4a952693a77634267779293a2458e51fdd84 /src/device/oprom/realmode
parent5f2576089fca9b5b7c00d1dde1223d80fe9c9e2f (diff)
arch/x86/*.S: use defines instead of hardcoded values
As preparation for x86_64 clean the assembly code and introduce arch/ram_segs.h similar to existing arch/rom_segs.h. Replace open coded segment values with the defines from the new header. Change-Id: Ib006cd4df59951335506b8153e9347450ec3403e Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36321 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/device/oprom/realmode')
-rw-r--r--src/device/oprom/realmode/x86_asm.S26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/device/oprom/realmode/x86_asm.S b/src/device/oprom/realmode/x86_asm.S
index 8c9e12b143..d68fdc5fca 100644
--- a/src/device/oprom/realmode/x86_asm.S
+++ b/src/device/oprom/realmode/x86_asm.S
@@ -14,6 +14,8 @@
#define REALMODE_BASE 0x600
#define RELOCATED(x) (x - __realmode_code + REALMODE_BASE)
+#include <arch/ram_segs.h>
+
/* CR0 bits */
#define PE (1 << 0)
@@ -106,7 +108,7 @@ __realmode_call:
movl %eax, __registers + 20 /* edi */
/* Activate the right segment descriptor real mode. */
- ljmp $0x28, $RELOCATED(1f)
+ ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
1:
.code16
/* 16 bit code from here on... */
@@ -116,7 +118,7 @@ __realmode_call:
* configurations (limits, writability, etc.) once
* protected mode is turned off.
*/
- mov $0x30, %ax
+ mov $RAM_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -186,10 +188,10 @@ __lcall_instr = RELOCATED(.)
/* Now that we are in protected mode
* jump to a 32 bit code segment.
*/
- ljmpl $0x10, $RELOCATED(1f)
+ ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $0x18, %ax
+ mov $RAM_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -242,7 +244,7 @@ __realmode_interrupt:
movl %eax, __registers + 20 /* edi */
/* This configures CS properly for real mode. */
- ljmp $0x28, $RELOCATED(1f)
+ ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
1:
.code16 /* 16 bit code from here on... */
@@ -250,7 +252,7 @@ __realmode_interrupt:
* descriptors. They will retain these configurations (limits,
* writability, etc.) once protected mode is turned off.
*/
- mov $0x30, %ax
+ mov $RAM_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -314,10 +316,10 @@ __intXX_instr = RELOCATED(.)
movl %eax, %cr0
/* Now that we are in protected mode jump to a 32-bit code segment. */
- ljmpl $0x10, $RELOCATED(1f)
+ ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $0x18, %ax
+ mov $RAM_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -363,10 +365,10 @@ __interrupt_handler_16bit = RELOCATED(.)
movl %eax, %cr0
/* ... and jump to a 32 bit code segment. */
- ljmpl $0x10, $RELOCATED(1f)
+ ljmpl $RAM_CODE_SEG, $RELOCATED(1f)
1:
.code32
- mov $0x18, %ax
+ mov $RAM_DATA_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
@@ -380,14 +382,14 @@ __interrupt_handler_16bit = RELOCATED(.)
call *%eax
/* Now return to real mode ... */
- ljmp $0x28, $RELOCATED(1f)
+ ljmp $RAM_CODE16_SEG, $RELOCATED(1f)
1:
.code16
/* Load the segment registers with properly configured segment
* descriptors. They will retain these configurations (limits,
* writability, etc.) once protected mode is turned off.
*/
- mov $0x30, %ax
+ mov $RAM_DATA16_SEG, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs