On Sat, Nov 16, 2013 at 01:45:31AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> > Now the problem is to do anything useful hard disk is needed and
> > default u-boot for versatileqemu does not seem to offer any support (or
> > may be it is qemu -M versatilepb). Were you successful in running arm
> > port under qemu?
> > 
> I didn't do netboot but concatenated with u-boot. It worked to similar
> extent as what you describe. Another promising board is vexpress but I
> had problems with MMC support in u-boot don't remember what it was exactly.

I have been looking at this today together with Ian Campbell at the
mini Debconf-UK. Commit c9cd02c cleans up the uboot syscall interface,
but unfortunately it also corrupts the stack for va_arg passing.
It is only evident when passing a sufficient number of arguments, which
I think is only triggered by the disk accesses.

Patch attached, verified on Ian's qemu vexpress, which he may be posting
some updates on later.

/
    Leif
>From 7d317fc56bb7c5e54b85caa9f749075f4e5bfaf2 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindh...@linaro.org>
Date: Sat, 16 Nov 2013 12:15:53 +0000
Subject: [PATCH] arm: fix u-boot port syscall interface va_arg handling

Commit c9cd02c broke the u-boot syscall API for va_args that spill over
to the stack, causing the disk support to stop working. This patch
resolves the problem, while keeping the new, cleaner transition_space
handling.
---
 ChangeLog                          |  5 +++++
 grub-core/kern/arm/uboot/startup.S | 11 -----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d502f8..91c0534 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-16  Leif Lindholm <leif.lindh...@linaro.org>
+
+	* grub-core/kern/arm/uboot/startup.S: fix grub_uboot_syscall va_arg
+	handling
+
 2013-11-15  Vladimir Serbinenko  <phco...@gmail.com>
 
 	Replace libgcc version of ctz with our own.
diff --git a/grub-core/kern/arm/uboot/startup.S b/grub-core/kern/arm/uboot/startup.S
index f54b14b..ce3415c 100644
--- a/grub-core/kern/arm/uboot/startup.S
+++ b/grub-core/kern/arm/uboot/startup.S
@@ -130,15 +130,8 @@ FUNCTION(codestart)
 FUNCTION(grub_uboot_syscall)
 	str     r8, transition_space
 	str     lr, transition_space + 4
-	str     r9, transition_space + 8
-	str     sp, transition_space + 12
-
-	sub     sp, sp, #0x20
-	lsr     sp, sp, #3
-	lsl     sp, sp, #3
 
 	ldr	r8, gd_backup
-	ldr	r9, gd_backup + 4
 
 	mov	lr, pc
 	ldr	pc, grub_uboot_syscall_ptr
@@ -146,8 +139,6 @@ FUNCTION(grub_uboot_syscall)
 
 	ldr     r8, transition_space
 	ldr     lr, transition_space + 4
-	ldr     r9, transition_space + 8
-	ldr     sp, transition_space + 12
 
 	bx	lr
 	
@@ -179,8 +170,6 @@ entry_state:		@ backup for U-Boot context
 transition_space:	
 	.long	0	@ r8
 	.long	0	@ lr
-	.long	0	@ r9
-	.long	0	@ sp
 
 VARIABLE(grub_uboot_syscall_ptr)
 	.long	0	@
-- 
1.8.4.rc3

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to