summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-23 17:40:06 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-23 17:40:06 +0000
commit3da35a18e5679d0ce2a34c8c78d29ce63a24cb87 (patch)
treeb71bdc615fb209597736a496ef324afaea391214 /cpukit
parent2009-07-23 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-3da35a18e5679d0ce2a34c8c78d29ce63a24cb87.tar.bz2
2009-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* cpu.c, cpu_asm.S: Unsuccessful attempt to fix.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/cpu/avr/ChangeLog4
-rw-r--r--cpukit/score/cpu/avr/cpu.c36
-rw-r--r--cpukit/score/cpu/avr/cpu_asm.S2
3 files changed, 32 insertions, 10 deletions
diff --git a/cpukit/score/cpu/avr/ChangeLog b/cpukit/score/cpu/avr/ChangeLog
index 1a767983e6..2a36794e38 100644
--- a/cpukit/score/cpu/avr/ChangeLog
+++ b/cpukit/score/cpu/avr/ChangeLog
@@ -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>
*cpu_asm.S: implemented _CPU_Context_Restore by adding tags to
diff --git a/cpukit/score/cpu/avr/cpu.c b/cpukit/score/cpu/avr/cpu.c
index 95d0ef828b..8fe4c0e421 100644
--- a/cpukit/score/cpu/avr/cpu.c
+++ b/cpukit/score/cpu/avr/cpu.c
@@ -69,16 +69,34 @@ void _CPU_Context_Initialize(
bool is_fp
)
{
- uint16_t _stack; //declare helper variable
- _stack = (uint16_t) (stack_base) + (uint16_t) (size); //calc stack pointer
- the_context->stack_pointer = _stack - 2; //save stack pointer (- 2 bytes)
- _CPU_Push(_stack, (uint16_t)(entry_point)); //push entry point onto context stack
- the_context->status = 0; //init status to zero
- if (new_level == TRUE) _CPU_ISR_Enable( 0 );
+ uint16_t stack;
+ uint16_t start;
+ uint16_t *tmpsp;
+
+ /* calc stack high end */
+ 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
- printk("");
- printk("the_context = 0x%x\n", the_context);
- printk("sp = 0x%x\n\n",_stack);
+ tmpsp[0] = start & 0xff;
+ tmpsp[1] = (start >> 8) & 0xff;
+#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
}
diff --git a/cpukit/score/cpu/avr/cpu_asm.S b/cpukit/score/cpu/avr/cpu_asm.S
index 03b94410d3..9e29d7157e 100644
--- a/cpukit/score/cpu/avr/cpu_asm.S
+++ b/cpukit/score/cpu/avr/cpu_asm.S
@@ -240,7 +240,7 @@ SYM(_CPU_Context_switch):
PUBLIC(_CPU_Context_restore)
SYM(_CPU_Context_restore):
- mov r26,r24
+ mov r26,r24 /* R26/27 are X */
mov r27,r25
ld r2, X+
ld r3, X+