2009-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>

* cpu.c, cpu_asm.S: Unsuccessful attempt to fix.
This commit is contained in:
Joel Sherrill
2009-07-23 17:40:06 +00:00
parent 4e4f06bbbe
commit 3da35a18e5
3 changed files with 32 additions and 10 deletions

View File

@@ -1,3 +1,7 @@
2009-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* cpu.c, cpu_asm.S: Unsuccessful attempt to fix.
2009-07-17 Josh Switnicki <josh.switnicki@utoronto.ca> 2009-07-17 Josh Switnicki <josh.switnicki@utoronto.ca>
*cpu_asm.S: implemented _CPU_Context_Restore by adding tags to *cpu_asm.S: implemented _CPU_Context_Restore by adding tags to

View File

@@ -69,16 +69,34 @@ void _CPU_Context_Initialize(
bool is_fp bool is_fp
) )
{ {
uint16_t _stack; //declare helper variable uint16_t stack;
_stack = (uint16_t) (stack_base) + (uint16_t) (size); //calc stack pointer uint16_t start;
the_context->stack_pointer = _stack - 2; //save stack pointer (- 2 bytes) uint16_t *tmpsp;
_CPU_Push(_stack, (uint16_t)(entry_point)); //push entry point onto context stack
the_context->status = 0; //init status to zero /* calc stack high end */
if (new_level == TRUE) _CPU_ISR_Enable( 0 ); stack = (uint16_t) (stack_base) + (uint16_t) (size);
/* calc stack pointer initial value */
stack -= 2;
the_context->stack_pointer = stack;
tmpsp = (uint16_t *) stack;
start = (uint16_t) entry_point;
*tmpsp = start;
#if 0 #if 0
printk(""); tmpsp[0] = start & 0xff;
printk("the_context = 0x%x\n", the_context); tmpsp[1] = (start >> 8) & 0xff;
printk("sp = 0x%x\n\n",_stack); #endif
/* FIXME on level */
if (new_level) the_context->status = 0;
else the_context->status = 0;
#if 1
printk("");
printk("the_context = 0x%x\n", the_context);
printk("entry = 0x%x\n", entry_point);
printk("sp = 0x%x\n\n",stack);
#endif #endif
} }

View File

@@ -240,7 +240,7 @@ SYM(_CPU_Context_switch):
PUBLIC(_CPU_Context_restore) PUBLIC(_CPU_Context_restore)
SYM(_CPU_Context_restore): SYM(_CPU_Context_restore):
mov r26,r24 mov r26,r24 /* R26/27 are X */
mov r27,r25 mov r27,r25
ld r2, X+ ld r2, X+
ld r3, X+ ld r3, X+