mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
core: 64 bit compatibility
Only minor changes are required to make the kernel 64 bit compatible. Most of the changes are either DEBUG/printf formatting or different types for void pointer casting. The only other change is the type of the `data` member in priority_queue_node_t, as `data` must be able to store a pointer. For current architectures, the assumption `sizeof(unsigned int) == sizeof(void *)` holds, but not for 64 bit. Therefore, the type is changed to `uintptr_t', which has the same size for the current architectures, but can also store a pointer in 64 bits.
This commit is contained in:
parent
f7d018c355
commit
cb83a2ea8a
@ -32,7 +32,7 @@ extern "C" {
|
||||
typedef struct priority_queue_node {
|
||||
struct priority_queue_node *next; /**< next queue node */
|
||||
uint32_t priority; /**< queue node priority */
|
||||
unsigned int data; /**< queue node data */
|
||||
uintptr_t data; /**< queue node data */
|
||||
} priority_queue_node_t;
|
||||
|
||||
/**
|
||||
|
||||
@ -78,14 +78,14 @@ void priority_queue_print(priority_queue_t *root)
|
||||
printf("queue:\n");
|
||||
|
||||
for (priority_queue_node_t *node = root->first; node; node = node->next) {
|
||||
printf("Data: %u Priority: %lu\n", node->data,
|
||||
(unsigned long)node->priority);
|
||||
printf("Data: %" PRIuPTR " Priority: %" PRIu32 "\n", node->data,
|
||||
node->priority);
|
||||
}
|
||||
}
|
||||
|
||||
void priority_queue_print_node(priority_queue_node_t *node)
|
||||
{
|
||||
printf("Data: %u Priority: %lu Next: %u\n", (unsigned int)node->data,
|
||||
(unsigned long)node->priority, (unsigned int)node->next);
|
||||
printf("Data: %" PRIuPTR " Priority: %" PRIu32 " Next: %p\n", node->data,
|
||||
node->priority, (void *)node->next);
|
||||
}
|
||||
#endif
|
||||
|
||||
12
core/mbox.c
12
core/mbox.c
@ -64,8 +64,8 @@ int _mbox_put(mbox_t *mbox, msg_t *msg, int blocking)
|
||||
list_node_t *next = list_remove_head(&mbox->readers);
|
||||
|
||||
if (next) {
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08x: _tryput(): "
|
||||
"there's a waiter.\n", thread_getpid(), (unsigned)mbox);
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08" PRIxPTR ": _tryput(): "
|
||||
"there's a waiter.\n", thread_getpid(), (uintptr_t)mbox);
|
||||
thread_t *thread =
|
||||
container_of((clist_node_t *)next, thread_t, rq_entry);
|
||||
*(msg_t *)thread->wait_data = *msg;
|
||||
@ -84,8 +84,8 @@ int _mbox_put(mbox_t *mbox, msg_t *msg, int blocking)
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08x: _tryput(): "
|
||||
"queued message.\n", thread_getpid(), (unsigned)mbox);
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08" PRIxPTR ": _tryput(): "
|
||||
"queued message.\n", thread_getpid(), (uintptr_t)mbox);
|
||||
msg->sender_pid = thread_getpid();
|
||||
/* copy msg into queue */
|
||||
mbox->msg_array[cib_put_unsafe(&mbox->cib)] = *msg;
|
||||
@ -99,8 +99,8 @@ int _mbox_get(mbox_t *mbox, msg_t *msg, int blocking)
|
||||
unsigned irqstate = irq_disable();
|
||||
|
||||
if (cib_avail(&mbox->cib)) {
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08x: _tryget(): "
|
||||
"got queued message.\n", thread_getpid(), (unsigned)mbox);
|
||||
DEBUG("mbox: Thread %" PRIkernel_pid " mbox 0x%08" PRIxPTR ": _tryget(): "
|
||||
"got queued message.\n", thread_getpid(), (uintptr_t)mbox);
|
||||
/* copy msg from queue */
|
||||
*msg = mbox->msg_array[cib_get_unsafe(&mbox->cib)];
|
||||
list_node_t *next = list_remove_head(&mbox->writers);
|
||||
|
||||
@ -29,7 +29,7 @@ static inline int __attribute__((always_inline)) _thread_flags_wake(
|
||||
thread_t *thread)
|
||||
{
|
||||
unsigned wakeup;
|
||||
thread_flags_t mask = (uint16_t)(unsigned)thread->wait_data;
|
||||
thread_flags_t mask = (uint16_t)(uintptr_t)thread->wait_data;
|
||||
|
||||
switch (thread->status) {
|
||||
case STATUS_FLAG_BLOCKED_ANY:
|
||||
@ -76,7 +76,7 @@ static void _thread_flags_wait(thread_flags_t mask, thread_t *thread,
|
||||
"_thread_flags_wait: me->flags=0x%08x me->mask=0x%08x. going blocked.\n",
|
||||
(unsigned)thread->flags, (unsigned)mask);
|
||||
|
||||
thread->wait_data = (void *)(unsigned)mask;
|
||||
thread->wait_data = (void *)(uintptr_t)mask;
|
||||
sched_set_status(thread, threadstate);
|
||||
irq_restore(irqstate);
|
||||
thread_yield_higher();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user