Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Paul Mackerras <paulus@samba.org>

+11 -11
+10 -10
arch/powerpc/kernel/head_64.S
··· 1385 1385 addi r2,r2,0x4000 1386 1386 1387 1387 /* Relocate the TOC from a virt addr to a real addr */ 1388 - sub r2,r2,r3 1388 + add r2,r2,r3 1389 1389 1390 1390 /* Restore parameters */ 1391 1391 mr r3,r31 ··· 1424 1424 li r3,0 /* target addr */ 1425 1425 1426 1426 // XXX FIXME: Use phys returned by OF (r30) 1427 - sub r4,r27,r26 /* source addr */ 1427 + add r4,r27,r26 /* source addr */ 1428 1428 /* current address of _start */ 1429 1429 /* i.e. where we are running */ 1430 1430 /* the source addr */ ··· 1444 1444 bctr 1445 1445 1446 1446 4: LOADADDR(r5,klimit) 1447 - sub r5,r5,r26 1447 + add r5,r5,r26 1448 1448 ld r5,0(r5) /* get the value of klimit */ 1449 1449 sub r5,r5,r27 1450 1450 bl .copy_and_flush /* copy the rest */ ··· 1703 1703 /* kernel but are still running in real mode. */ 1704 1704 1705 1705 LOADADDR(r3,init_thread_union) 1706 - sub r3,r3,r26 1706 + add r3,r3,r26 1707 1707 1708 1708 /* set up a stack pointer (physical address) */ 1709 1709 addi r1,r3,THREAD_SIZE ··· 1714 1714 LOADADDR(r2,__toc_start) 1715 1715 addi r2,r2,0x4000 1716 1716 addi r2,r2,0x4000 1717 - sub r2,r2,r26 1717 + add r2,r2,r26 1718 1718 1719 1719 LOADADDR(r3,cpu_specs) 1720 - sub r3,r3,r26 1720 + add r3,r3,r26 1721 1721 LOADADDR(r4,cur_cpu_spec) 1722 - sub r4,r4,r26 1722 + add r4,r4,r26 1723 1723 mr r5,r26 1724 1724 bl .identify_cpu 1725 1725 ··· 1735 1735 * code 1736 1736 */ 1737 1737 LOADADDR(r27, boot_cpuid) 1738 - sub r27,r27,r26 1738 + add r27,r27,r26 1739 1739 lwz r27,0(r27) 1740 1740 1741 1741 LOADADDR(r24, paca) /* Get base vaddr of paca array */ 1742 1742 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */ 1743 1743 add r13,r13,r24 /* for this processor. */ 1744 - sub r13,r13,r26 /* convert to physical addr */ 1744 + add r13,r13,r26 /* convert to physical addr */ 1745 1745 mtspr SPRN_SPRG3,r13 /* PPPBBB: Temp... -Peter */ 1746 1746 1747 1747 /* Do very early kernel initializations, including initial hash table, ··· 1781 1781 andi. r3,r3,PLATFORM_LPAR 1782 1782 bne 98f /* branch if result is !0 */ 1783 1783 LOADADDR(r6,_SDR1) /* Only if NOT LPAR */ 1784 - sub r6,r6,r26 1784 + add r6,r6,r26 1785 1785 ld r6,0(r6) /* get the value of _SDR1 */ 1786 1786 mtspr SPRN_SDR1,r6 /* set the htab location */ 1787 1787 98:
+1 -1
arch/powerpc/kernel/prom_init.c
··· 2019 2019 * On pSeries and BPA, copy the CPU hold code 2020 2020 */ 2021 2021 if (RELOC(of_platform) & (PLATFORM_PSERIES | PLATFORM_BPA)) 2022 - copy_and_flush(0, KERNELBASE - offset, 0x100, 0); 2022 + copy_and_flush(0, KERNELBASE + offset, 0x100, 0); 2023 2023 #endif 2024 2024 2025 2025 /*