diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/common/ports/AVR/chcore.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/os/common/ports/AVR/chcore.h b/os/common/ports/AVR/chcore.h index 8bbd89582..f749383b2 100644 --- a/os/common/ports/AVR/chcore.h +++ b/os/common/ports/AVR/chcore.h @@ -262,12 +262,12 @@ struct port_context { #define PORT_SETUP_CONTEXT(tp, wbase, wtop, pf, arg) { \
tp->ctx.sp = (struct port_intctx *)((uint8_t *)(wtop) - \
sizeof(struct port_intctx)); \
- tp->ctx.sp->r2 = (uint8_t)(pf); \
+ tp->ctx.sp->r2 = (uint8_t)(0xff & (uint16_t)pf); \
tp->ctx.sp->r3 = (uint8_t)((uint16_t)(pf) >> 8); \
- tp->ctx.sp->r4 = (uint8_t)(arg); \
+ tp->ctx.sp->r4 = (uint8_t)(0xff & (uint16_t)arg); \
tp->ctx.sp->r5 = (uint8_t)((uint16_t)(arg) >> 8); \
tp->ctx.sp->pcl = (uint16_t)_port_thread_start >> 8; \
- tp->ctx.sp->pch = (uint8_t)_port_thread_start; \
+ tp->ctx.sp->pch = (uint8_t)(0xff & (uint16_t)_port_thread_start); \
}
#endif /* !__AVR_3_BYTE_PC__ */
|