diff options
author | Graeme Russ <graeme.russ@gmail.com> | 2009-02-24 21:14:56 +1100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-03-20 22:39:13 +0100 |
commit | e17ee157ca9ff0d4cc5841d06c4b70c1603df29c (patch) | |
tree | b86269e5e8d1b944250fdf4b98d3bed066ba7f92 /cpu | |
parent | 8c63d47651f77d9fb887cad433370b866eb0a193 (diff) | |
download | bootable_bootloader_goldelico_gta04-e17ee157ca9ff0d4cc5841d06c4b70c1603df29c.zip bootable_bootloader_goldelico_gta04-e17ee157ca9ff0d4cc5841d06c4b70c1603df29c.tar.gz bootable_bootloader_goldelico_gta04-e17ee157ca9ff0d4cc5841d06c4b70c1603df29c.tar.bz2 |
Add basic relocation to i386 port
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/i386/interrupts.c | 4 | ||||
-rw-r--r-- | cpu/i386/start.S | 41 |
2 files changed, 43 insertions, 2 deletions
diff --git a/cpu/i386/interrupts.c b/cpu/i386/interrupts.c index 026a21b..063ea42 100644 --- a/cpu/i386/interrupts.c +++ b/cpu/i386/interrupts.c @@ -53,8 +53,8 @@ asm ("idt_ptr:\n" void set_vector(u8 intnum, void *routine) { - idt[intnum].base_high = (u16)((u32)(routine)>>16); - idt[intnum].base_low = (u16)((u32)(routine)&0xffff); + idt[intnum].base_high = (u16)((u32)(routine + gd->reloc_off) >> 16); + idt[intnum].base_low = (u16)((u32)(routine + gd->reloc_off) & 0xffff); } diff --git a/cpu/i386/start.S b/cpu/i386/start.S index b6175b1..59089ef 100644 --- a/cpu/i386/start.S +++ b/cpu/i386/start.S @@ -173,7 +173,41 @@ bss_fail: jmp die bss_ok: +#ifndef CONFIG_SKIP_RELOCATE_UBOOT + /* indicate progress */ + movw $0x06, %ax + movl $.progress6, %ebp + jmp show_boot_progress_asm +.progress6: + + /* copy text section to ram, size must be 4-byte aligned */ + movl $CONFIG_SYS_BL_START_RAM, %edi /* destination address */ + movl $TEXT_BASE, %esi /* source address */ + movl $_i386boot_text_size, %ecx /* number of bytes to copy */ + movl %ecx, %eax + andl $3, %eax + jz text_copy /* Already 4-byte aligned */ + subl $4, %eax /* Add extra bytes to size */ + addl %eax, %ecx +text_copy: + shrl $2, %ecx /* copy 4 byte each time */ + cld + cmpl $0, %ecx + je text_ok +text_segment: + movsl + loop text_segment + jmp text_ok +text_fail: + /* indicate (lack of) progress */ + movw $0x86, %ax + movl $.progress5a, %ebp + jmp show_boot_progress_asm +.progress5a: + jmp die +text_ok: +#endif wbinvd @@ -183,7 +217,14 @@ bss_ok: jmp show_boot_progress_asm .progress4: +#ifndef CONFIG_SKIP_RELOCATE_UBOOT + /* Jump to the RAM copy of start_i386boot */ + movl $start_i386boot, %ebp + addl $(CONFIG_SYS_BL_START_RAM - TEXT_BASE), %ebp + call *%ebp /* Enter, U-boot! */ +#else call start_i386boot /* Enter, U-boot! */ +#endif /* indicate (lack of) progress */ movw $0x85, %ax |