diff options
-rw-r--r-- | examples/api/Makefile | 4 | ||||
-rw-r--r-- | examples/api/crt0.S | 35 | ||||
-rw-r--r-- | examples/api/demo.c | 9 | ||||
-rw-r--r-- | examples/api/glue.c | 4 |
4 files changed, 29 insertions, 23 deletions
diff --git a/examples/api/Makefile b/examples/api/Makefile index ca4eb1f71ad..ec1643e4875 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -9,8 +9,12 @@ ifeq ($(ARCH),powerpc) LOAD_ADDR = 0x40000 endif ifeq ($(ARCH),arm) +ifdef CONFIG_64BIT +LOAD_ADDR = 0x40400000 +else LOAD_ADDR = 0x1000000 endif +endif ifeq ($(ARCH),mips) ifdef CONFIG_64BIT LOAD_ADDR = 0xffffffff80200000 diff --git a/examples/api/crt0.S b/examples/api/crt0.S index 06f6d1f9ad4..f1b88ed8a3d 100644 --- a/examples/api/crt0.S +++ b/examples/api/crt0.S @@ -24,7 +24,7 @@ syscall: mtctr %r11 bctr -#elif defined(CONFIG_ARM) +#elif defined(CONFIG_ARM) && !defined(CONFIG_ARM64) .text .globl _start @@ -33,26 +33,27 @@ _start: str sp, [ip] b main -#elif defined(CONFIG_ARM64) - - .text - .globl _start -_start: - ldr ip0, =search_hint - str sp_el2, [ip0] - b main - - .globl syscall + .globl syscall syscall: - ldr ip0, =syscall_ptr - ldr pc_el2, [ip0] + ldr ip, =syscall_ptr + 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 ip, =syscall_ptr - ldr pc, [ip] + ldr x16, =syscall_ptr + ldr x16, [x16] + br x16 #elif defined(CONFIG_MIPS) #include <asm/asm.h> @@ -83,6 +84,8 @@ return_addr: #error No support for this arch! #endif +.section .data + .globl syscall_ptr syscall_ptr: .align 8 @@ -90,4 +93,4 @@ syscall_ptr: .globl search_hint search_hint: - .long 0 + .long 0 diff --git a/examples/api/demo.c b/examples/api/demo.c index 677d13b307a..9a55f76c504 100644 --- a/examples/api/demo.c +++ b/examples/api/demo.c @@ -43,12 +43,11 @@ int main(int argc, char *const argv[]) if (sig->version > API_SIG_VERSION) return -3; - printf("API signature found @%x\n", (unsigned int)sig); + printf("API signature found @%p\n", sig); test_dump_sig(sig); printf("\n*** Consumer API test ***\n"); - printf("syscall ptr 0x%08x@%08x\n", (unsigned int)syscall_ptr, - (unsigned int)&syscall_ptr); + printf("syscall ptr 0x%p@%p\n", syscall_ptr, &syscall_ptr); /* console activities */ ub_putc('B'); @@ -203,7 +202,7 @@ void test_dump_sig(struct api_signature *sig) printf("signature:\n"); printf(" version\t= %d\n", sig->version); 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) @@ -296,7 +295,7 @@ void test_dump_di(int handle) struct device_info *di = ub_dev_get(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); if (di->type == DEV_TYP_NET) { diff --git a/examples/api/glue.c b/examples/api/glue.c index 0aaa82bccb2..478f7b6cfb4 100644 --- a/examples/api/glue.c +++ b/examples/api/glue.c @@ -41,8 +41,8 @@ static int valid_sig(struct api_signature *sig) int api_search_sig(struct api_signature **sig) { unsigned char *sp; - uint32_t search_start = 0; - uint32_t search_end = 0; + uintptr_t search_start = 0; + uintptr_t search_end = 0; if (sig == NULL) return 0; |