/* Provided by linker script */
extern char __boot_fn_start;
extern char __boot_fn_end;
+extern char etext;
-void RelocatedProgMode(unsigned long where, unsigned baud)
+void RelocatedProgMode(unsigned baud)
{
- void (*ProgMode_ptr)(unsigned baud);
- unsigned long reloc_offs=where-(unsigned long)&__boot_fn_start;
size_t reloc_size=&__boot_fn_end-&__boot_fn_start;
- ProgMode_ptr=&ProgMode;
- ProgMode_ptr=(__u8*)ProgMode_ptr+reloc_offs;
- memcpy((char*)where,&__boot_fn_start,reloc_size);
+ memcpy(&__boot_fn_start,&etext,reloc_size);
/*deb_wr_hex((long)ProgMode_ptr,8);*/
- (*ProgMode_ptr)(baud);
+ ProgMode(baud);
}
if((__u8*)&__boot_fn_start<(__u8*)0xffb000) {
/* If we are not in the internal RAM, copy and run us from
* there */
- RelocatedProgMode(0xffb000,HIT_LOAD_BAUD);
+ RelocatedProgMode(HIT_LOAD_BAUD);
}
else
ProgMode(HIT_LOAD_BAUD);