diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-02-08 16:56:51 -0600 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-03-21 18:01:38 +0100 |
commit | a146d58ca0375a12f23dc5a4bd25adfa3423114f (patch) | |
tree | 874776d78835bf56ba66eba54e2558edd97645de /src/arch | |
parent | e8c866ad45d80de768c9422474449e171d133575 (diff) |
ramstage: prepare for relocation
The current ramstage code contains uses of symbols that cause issues
when the ramstage is relocatable. There are 2 scenarios resolved by this
patch:
1. Absolute symbols that are actually sizes/limits. The symbols are
problematic when relocating a program because there is no way to
distinguish a symbol that shouldn't be relocated and one that can.
The only way to handle these symbols is to write a program to post
process the relocations and keep a whitelist of ones that shouldn't
be relocated. I don't believe that is a route that should be taken
so fix the users of these sizes/limits encoded as absolute symbols
to calculate the size at runtime or dereference a variable in memory
containing the size/limit.
2. Absoulte symbols that were relocated to a fixed address. These
absolute symbols are generated by assembly files to be placed at a
fixed location. Again, these symbols are problematic because one
can't distinguish a symbol that can't be relocated. The symbols
are again resolved at runtime to allow for proper relocation.
For the symbols defining a size either use 2 symbols and calculate the
difference or provide a variable in memory containing the size.
Change-Id: I1ef2bfe6fd531308218bcaac5dcccabf8edf932c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2789
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/boot/acpi.c | 5 | ||||
-rw-r--r-- | src/arch/x86/boot/wakeup.S | 3 | ||||
-rw-r--r-- | src/arch/x86/lib/c_start.S | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index fc862f4088..327d175584 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -754,7 +754,8 @@ extern int lowmem_backup_size; void (*acpi_do_wakeup)(u32 vector, u32 backup_source, u32 backup_target, u32 backup_size) asmlinkage = (void *)WAKEUP_BASE; -extern unsigned char __wakeup, __wakeup_size; +extern unsigned char __wakeup; +extern unsigned int __wakeup_size; void acpi_jump_to_wakeup(void *vector) { @@ -776,7 +777,7 @@ void acpi_jump_to_wakeup(void *vector) #endif /* Copy wakeup trampoline in place. */ - memcpy((void *)WAKEUP_BASE, &__wakeup, (size_t)&__wakeup_size); + memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size); #if CONFIG_COLLECT_TIMESTAMPS timestamp_add_now(TS_ACPI_WAKE_JUMP); diff --git a/src/arch/x86/boot/wakeup.S b/src/arch/x86/boot/wakeup.S index d34c583a58..8748aa63aa 100644 --- a/src/arch/x86/boot/wakeup.S +++ b/src/arch/x86/boot/wakeup.S @@ -90,5 +90,6 @@ __wakeup_segment = RELOCATED(.) .word 0x0000 .globl __wakeup_size -__wakeup_size = ( . - __wakeup) +__wakeup_size: + .long . - __wakeup diff --git a/src/arch/x86/lib/c_start.S b/src/arch/x86/lib/c_start.S index 35bc26b789..762aa8c264 100644 --- a/src/arch/x86/lib/c_start.S +++ b/src/arch/x86/lib/c_start.S @@ -250,11 +250,10 @@ gdb_stub_breakpoint: #endif - .globl gdt, gdt_end, gdt_limit, idtarg + .globl gdt, gdt_end, idtarg -gdt_limit = gdt_end - gdt - 1 /* compute the table limit */ gdtaddr: - .word gdt_limit + .word gdt_end - gdt - 1 .long gdt /* we know the offset */ .data |