From fd57fde65971d63b72030efe8fc3232e03a8f69c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 13 Jun 2016 14:44:28 -0600 Subject: [PATCH] Back out part of previous commit --- arch/avr/src/avr/up_initialstate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/avr/src/avr/up_initialstate.c b/arch/avr/src/avr/up_initialstate.c index 8ce4ad029e..057054d437 100644 --- a/arch/avr/src/avr/up_initialstate.c +++ b/arch/avr/src/avr/up_initialstate.c @@ -79,18 +79,18 @@ void up_initial_state(struct tcb_s *tcb) /* Set the initial stack pointer to the "base" of the allocated stack */ - xcp->regs[REG_SPH] = (uint8_t)((uintptr_t)tcb->adj_stack_ptr >> 8); - xcp->regs[REG_SPL] = (uint8_t)((uintptr_t)tcb->adj_stack_ptr & 0xff); + xcp->regs[REG_SPH] = (uint8_t)((uint16_t)tcb->adj_stack_ptr >> 8); + xcp->regs[REG_SPL] = (uint8_t)((uint16_t)tcb->adj_stack_ptr & 0xff); /* Save the task entry point */ #if !defined(REG_PC2) - xcp->regs[REG_PC0] = (uint8_t)((uintptr_t)tcb->start >> 8); - xcp->regs[REG_PC1] = (uint8_t)((uintptr_t)tcb->start & 0xff); + xcp->regs[REG_PC0] = (uint8_t)((uint16_t)tcb->start >> 8); + xcp->regs[REG_PC1] = (uint8_t)((uint16_t)tcb->start & 0xff); #else - xcp->regs[REG_PC0] = (uint8_t)((uintptr_t)tcb->start >> 16); - xcp->regs[REG_PC1] = (uint8_t)((uintptr_t)tcb->start >> 8); - xcp->regs[REG_PC2] = (uint8_t)((uintptr_t)tcb->start & 0xff); + xcp->regs[REG_PC0] = (uint8_t)((uint32_t)tcb->start >> 16); + xcp->regs[REG_PC1] = (uint8_t)((uint32_t)tcb->start >> 8); + xcp->regs[REG_PC2] = (uint8_t)((uint32_t)tcb->start & 0xff); #endif /* Enable or disable interrupts, based on user configuration */