Date: Mon, 1 Nov 2010 21:04:23 +0000 (UTC) From: Olivier Houchard <cognet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214648 - head/sys/arm/arm Message-ID: <201011012104.oA1L4NfX089088@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cognet Date: Mon Nov 1 21:04:23 2010 New Revision: 214648 URL: http://svn.freebsd.org/changeset/base/214648 Log: Try to be a little smart at guessing where _start is located in flash, instead of relying on a binutils bug. Reported by: dim Modified: head/sys/arm/arm/elf_trampoline.c Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Mon Nov 1 20:20:31 2010 (r214647) +++ head/sys/arm/arm/elf_trampoline.c Mon Nov 1 21:04:23 2010 (r214648) @@ -159,7 +159,7 @@ _startC(void) #if defined(FLASHADDR) && defined(LOADERRAMADDR) unsigned int pc; - __asm __volatile("adr %0, _start\n" + __asm __volatile("mov %0, pc\n" : "=r" (pc)); if ((FLASHADDR > LOADERRAMADDR && pc >= FLASHADDR) || (FLASHADDR < LOADERRAMADDR && pc < LOADERRAMADDR)) { @@ -173,11 +173,13 @@ _startC(void) */ unsigned int target_addr; unsigned int tmp_sp; + uint32_t src_addr = (uint32_t)&_start - PHYSADDR + FLASHADDR + + (pc - FLASHADDR - ((uint32_t)&_startC - PHYSADDR)) & 0xfffff000; target_addr = (unsigned int)&_start - PHYSADDR + LOADERRAMADDR; tmp_sp = target_addr + 0x100000 + (unsigned int)&_end - (unsigned int)&_start; - memcpy((char *)target_addr, (char *)pc, + memcpy((char *)target_addr, (char *)src_addr, (unsigned int)&_end - (unsigned int)&_start); /* Temporary set the sp and jump to the new location. */ __asm __volatile(
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011012104.oA1L4NfX089088>