From e48ed6a980c10f15386fe01c85127ec614681165 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 13 Nov 2019 12:52:00 -0800 Subject: [PATCH] kernel: use uintptr_t for kobject data This has to be wide enough to store a pointer. Signed-off-by: Andrew Boie --- include/kernel.h | 2 +- kernel/thread.c | 2 +- scripts/elf_helper.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/kernel.h b/include/kernel.h index 31745af668e..b4153ff5f9c 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -172,7 +172,7 @@ struct _k_object { u8_t perms[CONFIG_MAX_THREAD_BYTES]; u8_t type; u8_t flags; - u32_t data; + uintptr_t data; } __packed __aligned(4); struct _k_object_assignment { diff --git a/kernel/thread.c b/kernel/thread.c index 920d3e5b69c..1a2ac59271c 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -623,7 +623,7 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread, * allocated for alignment constraints */ Z_OOPS(Z_SYSCALL_VERIFY_MSG(total_size <= stack_object->data, - "stack size %u is too big, max is %u", + "stack size %u is too big, max is %lu", total_size, stack_object->data)); /* User threads may only create other user threads and they can't diff --git a/scripts/elf_helper.py b/scripts/elf_helper.py index ad01d13687d..48adb54bf20 100644 --- a/scripts/elf_helper.py +++ b/scripts/elf_helper.py @@ -71,10 +71,10 @@ class KobjectInstance: self.data = thread_counter thread_counter = thread_counter + 1 elif self.type_obj.name == "sys_mutex": - self.data = "(u32_t)(&kernel_mutexes[%d])" % sys_mutex_counter + self.data = "(uintptr_t)(&kernel_mutexes[%d])" % sys_mutex_counter sys_mutex_counter += 1 elif self.type_obj.name == "k_futex": - self.data = "(u32_t)(&futex_data[%d])" % futex_counter + self.data = "(uintptr_t)(&futex_data[%d])" % futex_counter futex_counter += 1 else: self.data = 0