diff options
author | Graeme Russ | 2009-02-24 21:14:56 +1100 |
---|---|---|
committer | Wolfgang Denk | 2009-03-20 22:39:13 +0100 |
commit | e17ee157ca9ff0d4cc5841d06c4b70c1603df29c (patch) | |
tree | b86269e5e8d1b944250fdf4b98d3bed066ba7f92 /lib_i386 | |
parent | 8c63d47651f77d9fb887cad433370b866eb0a193 (diff) |
Add basic relocation to i386 port
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
Diffstat (limited to 'lib_i386')
-rw-r--r-- | lib_i386/board.c | 27 | ||||
-rw-r--r-- | lib_i386/interrupts.c | 4 | ||||
-rw-r--r-- | lib_i386/timer.c | 2 |
3 files changed, 30 insertions, 3 deletions
diff --git a/lib_i386/board.c b/lib_i386/board.c index 29683ee2695..e18dfa5bc44 100644 --- a/lib_i386/board.c +++ b/lib_i386/board.c @@ -225,6 +225,9 @@ void start_i386boot (void) static bd_t bd_data; init_fnc_t **init_fnc_ptr; +#ifndef CONFIG_SKIP_RELOCATE_UBOOT + cmd_tbl_t *p; +#endif show_boot_progress(0x21); gd = &gd_data; @@ -238,6 +241,10 @@ void start_i386boot (void) gd->baudrate = CONFIG_BAUDRATE; +#ifndef CONFIG_SKIP_RELOCATE_UBOOT + /* Need to set relocation offset here for interrupt initialization */ + gd->reloc_off = CONFIG_SYS_BL_START_RAM - TEXT_BASE; +#endif for (init_fnc_ptr = init_sequence, i=0; *init_fnc_ptr; ++init_fnc_ptr, i++) { show_boot_progress(0xa130|i); @@ -247,6 +254,26 @@ void start_i386boot (void) } show_boot_progress(0x23); +#ifndef CONFIG_SKIP_RELOCATE_UBOOT + for (p = &__u_boot_cmd_start; p != &__u_boot_cmd_end; p++) { + ulong addr; + addr = (ulong) (p->cmd) + gd->reloc_off; + p->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; + addr = (ulong)(p->name) + gd->reloc_off; + p->name = (char *)addr; + + if (p->usage != NULL) { + addr = (ulong)(p->usage) + gd->reloc_off; + p->usage = (char *)addr; + } + #ifdef CONFIG_SYS_LONGHELP + if (p->help != NULL) { + addr = (ulong)(p->help) + gd->reloc_off; + p->help = (char *)addr; + } + #endif + } +#endif /* configure available FLASH banks */ size = flash_init(); display_flash_config(size); diff --git a/lib_i386/interrupts.c b/lib_i386/interrupts.c index b0f84de4eb5..3f3613a2fba 100644 --- a/lib_i386/interrupts.c +++ b/lib_i386/interrupts.c @@ -70,12 +70,12 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg) if (irq_handlers[irq].handler != NULL) printf("irq_install_handler: 0x%08lx replacing 0x%08lx\n", - (ulong) handler, + (ulong) handler + gd->reloc_off, (ulong) irq_handlers[irq].handler); status = disable_interrupts (); - irq_handlers[irq].handler = handler; + irq_handlers[irq].handler = handler + gd->reloc_off; irq_handlers[irq].arg = arg; irq_handlers[irq].count = 0; diff --git a/lib_i386/timer.c b/lib_i386/timer.c index 5cb1f54fb56..58a0212ad96 100644 --- a/lib_i386/timer.c +++ b/lib_i386/timer.c @@ -51,7 +51,7 @@ int register_timer_isr (timer_fnc_t *isr_func) if (new_func == NULL) return 1; - new_func->isr_func = isr_func; + new_func->isr_func = isr_func + gd->reloc_off; new_func->next = NULL; /* |