FreeBSD Bugzilla – Attachment 188440 Details for
Bug 224008
UBLDR doesn't save registers correctly in start.S
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Save and Restore U-Boot registers.
arm_ubldr.patch (text/plain), 1.48 KB, created by
Duane
on 2017-11-30 23:03:46 UTC
(
hide
)
Description:
Save and Restore U-Boot registers.
Filename:
MIME Type:
Creator:
Duane
Created:
2017-11-30 23:03:46 UTC
Size:
1.48 KB
patch
obsolete
>--- sys/boot/arm/uboot/start.S.orig 2017-11-30 17:56:42.838794000 +1100 >+++ sys/boot/arm/uboot/start.S 2017-12-01 09:42:37.028786000 +1100 >@@ -45,6 +45,10 @@ > orr ip, ip, #(CPU_CONTROL_AFLT_ENABLE) > mcr p15, 0, ip, c1, c0, 0 > #endif >+ >+ /* Save the arguments and return register before calling self_reloc */ >+ push {r0, r1, r9, lr} >+ > /* > * Do self-relocation when the weak external symbol _DYNAMIC is non-NULL. > * When linked as a dynamic relocatable file, the linker automatically >@@ -61,20 +65,31 @@ > addne r1, r1, r0 /* r1 = dynamic section physaddr. */ > blne _C_LABEL(self_reloc) /* Do reloc if _DYNAMIC is non-NULL. */ > >+ /* Restore saved arguments */ >+ pop {r0, r1, r9, lr} >+ > /* Hint where to look for the API signature */ > ldr ip, =uboot_address > str sp, [ip] > >- /* Save U-Boot's r8 and r9 */ >+ /* Save U-Boot's r8 and r9 for syscall trampoline */ > ldr ip, =saved_regs >- str r8, [ip, #0] >- str r9, [ip, #4] >+ str r8, [ip, #0] /* old gd pointer (use to hold lr) */ >+ str r9, [ip, #4] /* new gd pointer */ > > /* >- * Start loader. This is basically a tail-recursion call; if main() >- * returns, it returns to u-boot (which reports the value returned r0). >+ * Start loader. Save return address first (r8 is available from >+ * trampoline save). > */ >- b main >+ mov r8, lr >+ bl main >+ mov lr, r8 >+ >+ /* Restore U-Boot environment */ >+ ldr ip, =saved_regs >+ ldr r8, [ip, #0] >+ ldr r9, [ip, #4] >+ mov pc, lr > > /* > * Data for self-relocation, in the text segment for pc-rel access.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 224008
: 188440