[U-Boot] [PATCH 1/1] SPARC: fixes exported function stub for standalone applications. jmp ensures we get back to the location we came from, size(void *) make sure we get the function addresses correctly from the table (entry*4 instead of entry*1).

Daniel Hellstrom daniel at gaisler.com
Fri Sep 18 11:43:35 CEST 2009


Hello Wolfgang,

This patch fixes the SPARC support for standalone u-boot applications.

-------------------- SPARC/LEON3 --------------------
=> tftpboot 0x41000000 192.168.0.47:hello_world.bin
Using GRETH 10/100 device
TFTP from server 192.168.0.47; our IP address is 192.168.0.206
Filename 'hello_world.bin'.
Load address: 0x41000000
Loading: #
done
Bytes transferred = 1232 (4d0 hex)
=> go 41000008 hej
## Starting application at 0x41000008 ...
Example expects ABI version 5
Actual U-Boot ABI version 5
Hello World
argc = 2
argv[0] = "41000008"
argv[1] = "hej"
argv[2] = "<NULL>"
Hit any key to exit ...

## Application terminated, rc = 0x0
=>
-----------------------------------------------------


Best Regards,
Daniel Hellstrom






Signed-off-by: Daniel Hellstrom <daniel at gaisler.com>
---
 examples/standalone/stubs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 339bbf9..ce3371d 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -181,9 +181,9 @@ gd_t *global_data;
 "	or %%g1, %%g7, %%g1\n"				\
 "	ld [%%g1], %%g1\n"				\
 "	ld [%%g1 + %1], %%g1\n"				\
-"	call %%g1\n"					\
+"	jmp %%g1\n"					\
 "	nop\n"						\
-	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "g1" );
+	: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
 
 #else
 #error stubs definition missing for this architecture
-- 
1.5.4



More information about the U-Boot mailing list