Back out part of previous commit

This commit is contained in:
Gregory Nutt 2016-06-13 14:44:28 -06:00
parent 93e7b5d7a0
commit fd57fde659

View File

@ -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 */