patch-2.4.0-test7 linux/arch/arm/boot/compressed/head-netwinder.S

Next file: linux/arch/arm/boot/compressed/head-sa1100.S
Previous file: linux/arch/arm/boot/compressed/head-l7200.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/arch/arm/boot/compressed/head-netwinder.S linux/arch/arm/boot/compressed/head-netwinder.S
@@ -1,15 +1,24 @@
+#define K(a,b,c)	((a) << 24 | (b) << 12 | (c))
+
 		.section	".start", #alloc, #execinstr
 
+		/*
+		 * check to see if we are running from the correct address.
+		 * If not, we move ourselves in a two stage process.  Firstly,
+		 * we copy the start of the kernel (which includes this code)
+		 * to 0x8000, and then jump to this code to continue with the
+		 * rest (since this code will get overwritten).
+		 */
 		adr	r2, 1f
-		ldmdb	r2, {r7, r8}
+		ldmdb	r2, {r9, r10}
 		and	r3, r2, #0xc000
-		teq	r3, #0x8000
-		beq	2f
+		teq	r3, #0x8000	@ correctly located?
+		beq	2f		@ skip this code
 		bic	r3, r2, #0xc000
 		orr	r3, r3, #0x8000
-		mov	r0, r3
-		mov	r4, #64
-		sub	r5, r8, r7
+		mov	r0, r3		@ new address if '1'
+		mov	r4, #64		@ number of bytes to copy
+		sub	r5, r10, r9	@ total number of bytes to copy
 		b	1f
 
 		.word	_start
@@ -17,15 +26,16 @@
 
 1:
 		.rept	4
-		ldmia	r2!, {r6, r7, r8, r9}
-		stmia	r3!, {r6, r7, r8, r9}
+		ldmia	r2!, {r6, r9, r10, r11}
+		stmia	r3!, {r6, r9, r10, r11}
 		.endr
 		subs	r4, r4, #64
 		bcs	1b
-		movs	r4, r5
-		mov	r5, #0
-		mov	r1, #5		@ only here to fix NeTTroms which dont set r1
-		movne	pc, r0
-
-		mov	r0, #0
+		movs	r4, r5		@ remaining length
+		mov	r5, #0		@ no more to copy
+		movne	pc, r0		@ jump back to 1 (in the newly copied
+					@ code)
+		mov	r7, #5		@ only here to fix NeTTroms which dont
+		mov	r8, #2 << 24		@ scheduled for removal in 2.5.xx
+		orr	r8, r8, #5 << 12
 2:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)