k_stack: make it 64-bit compatible
The k_stack data type cannot be u32_t on a 64-bit system as it is
often used to store pointers. Let's define a dedicated type for stack
data values, namely stack_data_t, which can be adjusted accordingly.
For now it is defined to uintptr_t which is the integer type large
enough to hold a pointer, meaning it is equivalent to u32_t on 32-bit
systems and u64_t on 64-bit systems.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
diff --git a/kernel/mailbox.c b/kernel/mailbox.c
index 22190f8..4f61599 100644
--- a/kernel/mailbox.c
+++ b/kernel/mailbox.c
@@ -32,13 +32,13 @@
/* allocate an asynchronous message descriptor */
static inline void mbox_async_alloc(struct k_mbox_async **async)
{
- (void)k_stack_pop(&async_msg_free, (u32_t *)async, K_FOREVER);
+ (void)k_stack_pop(&async_msg_free, (stack_data_t *)async, K_FOREVER);
}
/* free an asynchronous message descriptor */
static inline void mbox_async_free(struct k_mbox_async *async)
{
- k_stack_push(&async_msg_free, (u32_t)async);
+ k_stack_push(&async_msg_free, (stack_data_t)async);
}
#endif /* CONFIG_NUM_MBOX_ASYNC_MSGS > 0 */
@@ -77,7 +77,7 @@
for (i = 0; i < CONFIG_NUM_MBOX_ASYNC_MSGS; i++) {
z_init_thread_base(&async_msg[i].thread, 0, _THREAD_DUMMY, 0);
- k_stack_push(&async_msg_free, (u32_t)&async_msg[i]);
+ k_stack_push(&async_msg_free, (stack_data_t)&async_msg[i]);
}
#endif /* CONFIG_NUM_MBOX_ASYNC_MSGS > 0 */