svn commit: r356878 - head/stand/powerpc/uboot
Brandon Bergren
bdragon at FreeBSD.org
Sun Jan 19 04:13:20 UTC 2020
Author: bdragon
Date: Sun Jan 19 04:13:19 2020
New Revision: 356878
URL: https://svnweb.freebsd.org/changeset/base/356878
Log:
[PowerPC] Fix 32-bit ubldr calling convention
Due to the way u-boot for 32-bit powerpc is compiled, the interrupt code
assumes that the GOT pointer (r30) on u-boot is always intact.
When making syscalls to u-boot, ensure that we have restored r30 like we
found it before we enable interrupts to prevent u-boot from crashing if a
timer interrupt was pending.
This fixes ubldr on e500 qemu (assuming you have recompiled qemu's u-boot
with API support!)
Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23258
Modified:
head/stand/powerpc/uboot/start.S
Modified: head/stand/powerpc/uboot/start.S
==============================================================================
--- head/stand/powerpc/uboot/start.S Sun Jan 19 02:48:56 2020 (r356877)
+++ head/stand/powerpc/uboot/start.S Sun Jan 19 04:13:19 2020 (r356878)
@@ -38,10 +38,11 @@ _start:
lis %r11, uboot_address at ha
addi %r11, %r11, uboot_address at l
stw %r1, 0(%r11)
- /* Save U-Boot's r14 */
+ /* Save U-Boot's r14 and r30 */
lis %r11, saved_regs at ha
addi %r11, %r11, saved_regs at l
stw %r14, 0(%r11)
+ stw %r30, 4(%r11)
/* Disable interrupts */
mfmsr %r11
andi. %r11, %r11, ~0x8000 at l
@@ -52,14 +53,16 @@ _start:
* syscall()
*/
ENTRY(syscall)
- stwu %r1, -16(%r1)
+ stwu %r1, -32(%r1)
mflr %r0
stw %r14, 8(%r1)
- stw %r0, 20(%r1)
- /* Restore U-Boot's r14 */
+ stw %r30, 12(%r1)
+ stw %r0, 36(%r1)
+ /* Restore U-Boot's r14 and r30 */
lis %r11, saved_regs at ha
addi %r11, %r11, saved_regs at l
lwz %r14, 0(%r11)
+ lwz %r30, 4(%r11)
/* Enable interrupts */
mfmsr %r11
ori %r11, %r11, 0x8000 at l
@@ -79,6 +82,7 @@ ENTRY(syscall)
lwz %r0, 4(%r11)
mtlr %r0
lwz %r14, 8(%r1)
+ lwz %r30, 12(%r1)
mr %r1, %r11
blr
@@ -90,5 +94,6 @@ GLOBAL(syscall_ptr)
.long 0
GLOBAL(saved_regs)
.long 0 /* R14 */
+ .long 0 /* R30 */
GLOBAL(uboot_address)
.long 0
More information about the svn-src-all
mailing list