mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-29 02:58:17 +00:00
Merge patch series "examples: fix building on arm64"
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> says:
Commit f9886bc60f42 ("Added arm64 assembly for examples/api crt0") added
the arm64 architecture but the code does not even build.
With the changes the 'demo' program runs on qemu_arm64_defconfig using
setenv autostart no
dhcp demo
setenv autostart yes
bootelf $loadaddr
Link: https://lore.kernel.org/r/20241103053551.52715-1-heinrich.schuchardt@canonical.com
This commit is contained in:
commit
2b14d12067
@ -9,8 +9,12 @@ ifeq ($(ARCH),powerpc)
|
|||||||
LOAD_ADDR = 0x40000
|
LOAD_ADDR = 0x40000
|
||||||
endif
|
endif
|
||||||
ifeq ($(ARCH),arm)
|
ifeq ($(ARCH),arm)
|
||||||
|
ifdef CONFIG_64BIT
|
||||||
|
LOAD_ADDR = 0x40400000
|
||||||
|
else
|
||||||
LOAD_ADDR = 0x1000000
|
LOAD_ADDR = 0x1000000
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
ifeq ($(ARCH),mips)
|
ifeq ($(ARCH),mips)
|
||||||
ifdef CONFIG_64BIT
|
ifdef CONFIG_64BIT
|
||||||
LOAD_ADDR = 0xffffffff80200000
|
LOAD_ADDR = 0xffffffff80200000
|
||||||
|
|||||||
@ -24,7 +24,7 @@ syscall:
|
|||||||
mtctr %r11
|
mtctr %r11
|
||||||
bctr
|
bctr
|
||||||
|
|
||||||
#elif defined(CONFIG_ARM)
|
#elif defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.globl _start
|
.globl _start
|
||||||
@ -33,27 +33,28 @@ _start:
|
|||||||
str sp, [ip]
|
str sp, [ip]
|
||||||
b main
|
b main
|
||||||
|
|
||||||
#elif defined(CONFIG_ARM64)
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl _start
|
|
||||||
_start:
|
|
||||||
ldr ip0, =search_hint
|
|
||||||
str sp_el2, [ip0]
|
|
||||||
b main
|
|
||||||
|
|
||||||
|
|
||||||
.globl syscall
|
|
||||||
syscall:
|
|
||||||
ldr ip0, =syscall_ptr
|
|
||||||
ldr pc_el2, [ip0]
|
|
||||||
|
|
||||||
|
|
||||||
.globl syscall
|
.globl syscall
|
||||||
syscall:
|
syscall:
|
||||||
ldr ip, =syscall_ptr
|
ldr ip, =syscall_ptr
|
||||||
ldr pc, [ip]
|
ldr pc, [ip]
|
||||||
|
|
||||||
|
#elif defined(CONFIG_ARM64)
|
||||||
|
|
||||||
|
.text
|
||||||
|
.globl _start
|
||||||
|
_start:
|
||||||
|
ldr x17, =search_hint
|
||||||
|
mov x16, sp
|
||||||
|
str x16, [x17]
|
||||||
|
b main
|
||||||
|
|
||||||
|
.globl syscall
|
||||||
|
syscall:
|
||||||
|
ldr x16, =syscall_ptr
|
||||||
|
ldr x16, [x16]
|
||||||
|
br x16
|
||||||
|
|
||||||
#elif defined(CONFIG_MIPS)
|
#elif defined(CONFIG_MIPS)
|
||||||
#include <asm/asm.h>
|
#include <asm/asm.h>
|
||||||
.text
|
.text
|
||||||
@ -83,6 +84,8 @@ return_addr:
|
|||||||
#error No support for this arch!
|
#error No support for this arch!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
|
||||||
.globl syscall_ptr
|
.globl syscall_ptr
|
||||||
syscall_ptr:
|
syscall_ptr:
|
||||||
.align 8
|
.align 8
|
||||||
@ -90,4 +93,4 @@ syscall_ptr:
|
|||||||
|
|
||||||
.globl search_hint
|
.globl search_hint
|
||||||
search_hint:
|
search_hint:
|
||||||
.long 0
|
.long 0
|
||||||
|
|||||||
@ -43,12 +43,11 @@ int main(int argc, char *const argv[])
|
|||||||
if (sig->version > API_SIG_VERSION)
|
if (sig->version > API_SIG_VERSION)
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
printf("API signature found @%x\n", (unsigned int)sig);
|
printf("API signature found @%p\n", sig);
|
||||||
test_dump_sig(sig);
|
test_dump_sig(sig);
|
||||||
|
|
||||||
printf("\n*** Consumer API test ***\n");
|
printf("\n*** Consumer API test ***\n");
|
||||||
printf("syscall ptr 0x%08x@%08x\n", (unsigned int)syscall_ptr,
|
printf("syscall ptr 0x%p@%p\n", syscall_ptr, &syscall_ptr);
|
||||||
(unsigned int)&syscall_ptr);
|
|
||||||
|
|
||||||
/* console activities */
|
/* console activities */
|
||||||
ub_putc('B');
|
ub_putc('B');
|
||||||
@ -203,7 +202,7 @@ void test_dump_sig(struct api_signature *sig)
|
|||||||
printf("signature:\n");
|
printf("signature:\n");
|
||||||
printf(" version\t= %d\n", sig->version);
|
printf(" version\t= %d\n", sig->version);
|
||||||
printf(" checksum\t= 0x%08x\n", sig->checksum);
|
printf(" checksum\t= 0x%08x\n", sig->checksum);
|
||||||
printf(" sc entry\t= 0x%08x\n", (unsigned int)sig->syscall);
|
printf(" sc entry\t= 0x%p\n", sig->syscall);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_dump_si(struct sys_info *si)
|
void test_dump_si(struct sys_info *si)
|
||||||
@ -296,7 +295,7 @@ void test_dump_di(int handle)
|
|||||||
struct device_info *di = ub_dev_get(handle);
|
struct device_info *di = ub_dev_get(handle);
|
||||||
|
|
||||||
printf("device info (%d):\n", handle);
|
printf("device info (%d):\n", handle);
|
||||||
printf(" cookie\t= 0x%08x\n", (uint32_t)di->cookie);
|
printf(" cookie\t= 0x%p\n", di->cookie);
|
||||||
printf(" type\t\t= 0x%08x\n", di->type);
|
printf(" type\t\t= 0x%08x\n", di->type);
|
||||||
|
|
||||||
if (di->type == DEV_TYP_NET) {
|
if (di->type == DEV_TYP_NET) {
|
||||||
|
|||||||
@ -41,8 +41,8 @@ static int valid_sig(struct api_signature *sig)
|
|||||||
int api_search_sig(struct api_signature **sig)
|
int api_search_sig(struct api_signature **sig)
|
||||||
{
|
{
|
||||||
unsigned char *sp;
|
unsigned char *sp;
|
||||||
uint32_t search_start = 0;
|
uintptr_t search_start = 0;
|
||||||
uint32_t search_end = 0;
|
uintptr_t search_end = 0;
|
||||||
|
|
||||||
if (sig == NULL)
|
if (sig == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user