]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
examples: make glue and demo code compatible with 64-bit
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 3 Nov 2024 05:35:51 +0000 (06:35 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 14 Nov 2024 16:51:07 +0000 (10:51 -0600)
Commit f9886bc60f42 ("Added arm64 assembly for examples/api crt0")
added a 64-bit target for the examples but did not adjust the demo
code to be 64-bit compatible.

Change variable size for pointers.
Use %p to print pointers.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
examples/api/demo.c
examples/api/glue.c

index 677d13b307a13e7701632abcbb5f0f926528b410..9a55f76c5045ad7711eeb4bf9db95a1e1b2fb1bc 100644 (file)
@@ -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) {
index 0aaa82bccb29278d5f4650ce89053bfe895afaa7..478f7b6cfb445fdf9803851b51d9a31cab898a26 100644 (file)
@@ -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;