* already puts a few entries in the table. */ li r0,__got2_entries@sectoff@l la
r3,GOT(_GOT2_TABLE_)
lwz r11,GOT(_GOT2_TABLE_) mtctr
r0
sub r11,r3,r11
addi r3,r3,-4
1: lwzu r0,4(r3) cmpwi r0,0
beq- 2f add r0,r0,r11
stw r0,0(r3)
2: bdnz 1b
#ifndef CONFIG_NAND_SPL /*
* Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ li
r0,__fixup_entries@sectoff@l
lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0
mtctr
r0
46
addi r3,r3,-4
beq 4f
3: lwzu r4,4(r3) lwzux
r0,r4,r11
add r0,r0,r11 stw r10,0(r3) stw r0,0(r4) bdnz 3b
4: #endif
clear_bss: /*
* Now clear BSS segment */
lwz r3,GOT(__bss_start) #if defined(CONFIG_HYMOD) /*
* For HYMOD - the environment is the very last item in flash. * The real .bss stops just before environment starts, so only * clear up to that point. *
* taken from mods for FADS board
*/
47
lwz r4,GOT(environment)
#else
lwz r4,GOT(_end)
#endif cmplw 0, r3, r4
beq 6f
li
r0, 0 5: stw r0, 0(r3) addi r3, r3, 4 cmplw 0, r3, r4
bne 5b
6: mr r3, r9 /* Global Data pointer mr r4, r10
/* Destination Address bl
board_init_r
这其中的代码留下后面分析。 3.2.2 board_init_r
void board_init_r (gd_t *id, ulong dest_addr) {
*/ */
48
char *s; bd_t *bd; ulong malloc_start;
ulong flash_size;
gd = id; /* initialize RAM version of global data 好方法,又将这个变量地址改变了*/ bd = gd->bd;
gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
/* The Malloc area is immediately below the monitor copy in DRAM */
malloc_start = dest_addr - TOTAL_MALLOC_LEN;// malloc_start=0x07fae000-520KB
serial_initialize();
debug (\ //dest_addr=0x07fae000 WATCHDOG_RESET ();
/*
* Setup trap handlers */
trap_init (dest_addr);
49
monitor_flash_len = (ulong)&__init_end - dest_addr;
WATCHDOG_RESET ();
#if defined(CONFIG_SYS_DELAYED_ICACHE) || defined(CONFIG_MPC83xx)
icache_enable (); /* it's time to enable the instruction cache */
#endif asm (\
mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
#if !defined(CONFIG_SYS_NO_FLASH) puts (\
if ((flash_size = flash_init ()) > 0) {
print_size (flash_size, \
} else { puts (failed); hang ();
}
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE; /* update start of FLASH memory
*/
50