PHYSADDR

Tim Kientzle kientzle at freebsd.org
Thu Feb 28 06:27:11 UTC 2013


Starting to look at what is needed for a Generic ARM kernel.
There's a lot here; I sincerely hope I'm not the only one… ;-)

First up:  Can we get rid of PHYSADDR?

I think we can always compute it at runtime from PC.

For example, I think this works in several places:
   and r0, pc, #0xF0000000

And I've found at least one reference that I think can be simply
eliminated:

Index: arm/elf_trampoline.c
===================================================================
--- arm/elf_trampoline.c	(revision 247250)
+++ arm/elf_trampoline.c	(working copy)
@@ -169,7 +169,7 @@
 void
 _startC(void)
 {
-	int physaddr = KERNPHYSADDR;
+	unsigned int physaddr = (unsigned int)&_start & 0xfffff000;
 	int tmp1;
 	unsigned int sp = ((unsigned int)&_end & ~3) + 4;
 #if defined(FLASHADDR) && defined(LOADERRAMADDR)
@@ -189,10 +189,9 @@
 		 */
 		unsigned int target_addr;
 		unsigned int tmp_sp;
-		uint32_t src_addr = (uint32_t)&_start - PHYSADDR + FLASHADDR
-		    + (pc - FLASHADDR - ((uint32_t)&_startC - PHYSADDR)) & 0xfffff000;
+		uint32_t src_addr = (uint32_t)&_start;
 
-		target_addr = (unsigned int)&_start - PHYSADDR + LOADERRAMADDR;
+		target_addr = (unsigned int)&_start - (pc & 0xf0000000) + LOADERRAMADDR;
 		tmp_sp = target_addr + 0x100000 +
 		    (unsigned int)&_end - (unsigned int)&_start;
 		memcpy((char *)target_addr, (char *)src_addr,


Tim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20130227/5023de43/attachment.sig>


More information about the freebsd-arm mailing list