mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 05:37:54 -06:00
command: Fix handling of buffer passing in args[] on 64bit mcu
If the buffer pointer can't fit in a uint32_t then pass a relative buffer offset instead. This fixes buffer handling on 64bit linux mcus. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
473828ca6a
commit
a560432041
4 changed files with 17 additions and 0 deletions
|
@ -18,12 +18,16 @@ static uint8_t next_sequence = MESSAGE_DEST;
|
|||
static uint32_t
|
||||
command_encode_ptr(void *p)
|
||||
{
|
||||
if (sizeof(size_t) > sizeof(uint32_t))
|
||||
return p - console_receive_buffer();
|
||||
return (size_t)p;
|
||||
}
|
||||
|
||||
void *
|
||||
command_decode_ptr(uint32_t v)
|
||||
{
|
||||
if (sizeof(size_t) > sizeof(uint32_t))
|
||||
return console_receive_buffer() + v;
|
||||
return (void*)(size_t)v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue