Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a408329 authored by Paul Mackerras's avatar Paul Mackerras
Browse files

powerpc: Fix bug caused by negation of 64-bit reloc_offset value



Although both ppc32 and ppc64 have a reloc_offset function, the ppc64
one produced the opposite sign to the ppc32 one.  This standardizes
on the ppc32 sign and fixes the merged 64-bit code to account for that.

Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 4a288563
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -1385,7 +1385,7 @@ _STATIC(__boot_from_prom)
	addi	r2,r2,0x4000
	addi	r2,r2,0x4000


	/* Relocate the TOC from a virt addr to a real addr */
	/* Relocate the TOC from a virt addr to a real addr */
	sub	r2,r2,r3
	add	r2,r2,r3


	/* Restore parameters */
	/* Restore parameters */
	mr	r3,r31
	mr	r3,r31
@@ -1424,7 +1424,7 @@ _STATIC(__after_prom_start)
	li	r3,0			/* target addr */
	li	r3,0			/* target addr */


	// XXX FIXME: Use phys returned by OF (r30)
	// XXX FIXME: Use phys returned by OF (r30)
	sub	r4,r27,r26 		/* source addr			 */
	add	r4,r27,r26 		/* source addr			 */
					/* current address of _start	 */
					/* current address of _start	 */
					/*   i.e. where we are running	 */
					/*   i.e. where we are running	 */
					/*	the source addr		 */
					/*	the source addr		 */
@@ -1444,7 +1444,7 @@ _STATIC(__after_prom_start)
	bctr
	bctr


4:	LOADADDR(r5,klimit)
4:	LOADADDR(r5,klimit)
	sub	r5,r5,r26
	add	r5,r5,r26
	ld	r5,0(r5)		/* get the value of klimit */
	ld	r5,0(r5)		/* get the value of klimit */
	sub	r5,r5,r27
	sub	r5,r5,r27
	bl	.copy_and_flush		/* copy the rest */
	bl	.copy_and_flush		/* copy the rest */
@@ -1703,7 +1703,7 @@ _STATIC(start_here_multiplatform)
	/* kernel but are still running in real mode. */
	/* kernel but are still running in real mode. */


	LOADADDR(r3,init_thread_union)
	LOADADDR(r3,init_thread_union)
	sub	r3,r3,r26
	add	r3,r3,r26


	/* set up a stack pointer (physical address) */
	/* set up a stack pointer (physical address) */
	addi	r1,r3,THREAD_SIZE
	addi	r1,r3,THREAD_SIZE
@@ -1714,12 +1714,12 @@ _STATIC(start_here_multiplatform)
	LOADADDR(r2,__toc_start)
	LOADADDR(r2,__toc_start)
	addi	r2,r2,0x4000
	addi	r2,r2,0x4000
	addi	r2,r2,0x4000
	addi	r2,r2,0x4000
	sub	r2,r2,r26
	add	r2,r2,r26


	LOADADDR(r3,cpu_specs)
	LOADADDR(r3,cpu_specs)
	sub	r3,r3,r26
	add	r3,r3,r26
	LOADADDR(r4,cur_cpu_spec)
	LOADADDR(r4,cur_cpu_spec)
	sub	r4,r4,r26
	add	r4,r4,r26
	mr	r5,r26
	mr	r5,r26
	bl	.identify_cpu
	bl	.identify_cpu


@@ -1735,13 +1735,13 @@ _STATIC(start_here_multiplatform)
	 * code
	 * code
	 */
	 */
	LOADADDR(r27, boot_cpuid)
	LOADADDR(r27, boot_cpuid)
	sub	r27,r27,r26
	add	r27,r27,r26
	lwz	r27,0(r27)
	lwz	r27,0(r27)


	LOADADDR(r24, paca) 		/* Get base vaddr of paca array	 */
	LOADADDR(r24, paca) 		/* Get base vaddr of paca array	 */
	mulli	r13,r27,PACA_SIZE	/* Calculate vaddr of right paca */
	mulli	r13,r27,PACA_SIZE	/* Calculate vaddr of right paca */
	add	r13,r13,r24		/* for this processor.		 */
	add	r13,r13,r24		/* for this processor.		 */
	sub	r13,r13,r26		/* convert to physical addr	 */
	add	r13,r13,r26		/* convert to physical addr	 */
	mtspr	SPRN_SPRG3,r13		/* PPPBBB: Temp... -Peter */
	mtspr	SPRN_SPRG3,r13		/* PPPBBB: Temp... -Peter */
	
	
	/* Do very early kernel initializations, including initial hash table,
	/* Do very early kernel initializations, including initial hash table,
@@ -1781,7 +1781,7 @@ _STATIC(start_here_multiplatform)
	andi.	r3,r3,PLATFORM_LPAR
	andi.	r3,r3,PLATFORM_LPAR
	bne	98f			/* branch if result is !0  */
	bne	98f			/* branch if result is !0  */
	LOADADDR(r6,_SDR1)		/* Only if NOT LPAR */
	LOADADDR(r6,_SDR1)		/* Only if NOT LPAR */
	sub	r6,r6,r26
	add	r6,r6,r26
	ld	r6,0(r6)		/* get the value of _SDR1 */
	ld	r6,0(r6)		/* get the value of _SDR1 */
	mtspr	SPRN_SDR1,r6			/* set the htab location  */
	mtspr	SPRN_SDR1,r6			/* set the htab location  */
98: 
98: 
+1 −1
Original line number Original line Diff line number Diff line
@@ -2019,7 +2019,7 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
	 * On pSeries and BPA, copy the CPU hold code
	 * On pSeries and BPA, copy the CPU hold code
	 */
	 */
       	if (RELOC(of_platform) & (PLATFORM_PSERIES | PLATFORM_BPA))
       	if (RELOC(of_platform) & (PLATFORM_PSERIES | PLATFORM_BPA))
       		copy_and_flush(0, KERNELBASE - offset, 0x100, 0);
       		copy_and_flush(0, KERNELBASE + offset, 0x100, 0);
#endif
#endif


	/*
	/*