summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-17 18:33:35 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-17 18:33:35 +0000
commitb4404843ec23902f3a26e86a643fb1e916e232a6 (patch)
treea63c8f4f626451cc2d3a9bd39f3f5ed2c3ac5b83 /cpukit
parentDummy entries for toolchain compatibility (diff)
downloadrtems-b4404843ec23902f3a26e86a643fb1e916e232a6.tar.bz2
2009-07-17 Josh Switnicki <josh.switnicki@utoronto.ca>
*cpu_asm.S: implemented _CPU_Context_Restore by adding tags to restore section of context switch. Fixed bug in _CPU_Context_Switch. The wrong registers were being used for pointer to running task Context_Control struct.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/cpu/avr/ChangeLog7
-rw-r--r--cpukit/score/cpu/avr/cpu.c5
-rw-r--r--cpukit/score/cpu/avr/cpu_asm.S41
3 files changed, 30 insertions, 23 deletions
diff --git a/cpukit/score/cpu/avr/ChangeLog b/cpukit/score/cpu/avr/ChangeLog
index 51ea845efc..1a767983e6 100644
--- a/cpukit/score/cpu/avr/ChangeLog
+++ b/cpukit/score/cpu/avr/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-17 Josh Switnicki <josh.switnicki@utoronto.ca>
+
+ *cpu_asm.S: implemented _CPU_Context_Restore by adding tags to
+ restore section of context switch.
+ Fixed bug in _CPU_Context_Switch. The wrong registers were being
+ used for pointer to running task Context_Control struct.
+
2009-07-09 Josh Switnicki <josh.switnicki@utoronto.ca>
* cpu_asm.S: Fixed bug in _CPU_Context_Switch. The wrong registers
diff --git a/cpukit/score/cpu/avr/cpu.c b/cpukit/score/cpu/avr/cpu.c
index b966da8e2b..95d0ef828b 100644
--- a/cpukit/score/cpu/avr/cpu.c
+++ b/cpukit/score/cpu/avr/cpu.c
@@ -75,6 +75,11 @@ void _CPU_Context_Initialize(
_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 );
+#if 0
+ printk("");
+ printk("the_context = 0x%x\n", the_context);
+ 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 51ecf6e560..03b94410d3 100644
--- a/cpukit/score/cpu/avr/cpu_asm.S
+++ b/cpukit/score/cpu/avr/cpu_asm.S
@@ -34,8 +34,6 @@
#define ret_lo r24
#define ret_hi r25
-
-
PUBLIC( setjmp )
SYM( setjmp ):
@@ -127,10 +125,6 @@ _U(longjmp):
-
-
-
-
/*
* _CPU_Context_save_fp_context
*
@@ -205,18 +199,19 @@ SYM(_CPU_Context_restore_fp):
* NO_CPU Specific Information:
*
* XXX document implementation including references if appropriate
-
-*/
-
-
-
+ void _CPU_Context_switch(
+ Context_Control *run,
+ Context_Control *heir
+);
+*/
PUBLIC(_CPU_Context_switch)
-
SYM(_CPU_Context_switch):
mov r26, r24
mov r27, r25
+ mov r24, r22
+ mov r25, r23
st X+, r2
st X+, r3
st X+, r4
@@ -236,16 +231,17 @@ SYM(_CPU_Context_switch):
st X+, r28
st X+, r29
st X+, r29
- lds r25,0x5f /*load sreg*/
- st X+, r25
- lds r25,0x5d /*spl*/
- st X+, r25
- lds r25,0x5e /*sph*/
+ lds r23,0x5f /*load sreg*/
+ st X+, r23
+ lds r23,0x5d /*spl*/
+ st X+, r23
+ lds r23,0x5e /*sph*/
+ PUBLIC(_CPU_Context_restore)
-restore:
- mov r26,r22
- mov r27,r23
+SYM(_CPU_Context_restore):
+ mov r26,r24
+ mov r27,r25
ld r2, X+
ld r3, X+
ld r4, X+
@@ -305,14 +301,14 @@ void _CPU_Context_restore(
printk( "AVR _CPU_Context_restore\n" );
}
*/
-
+/*
PUBLIC(_CPU_Context_restore)
SYM(_CPU_Context_restore):
//call printk("AVR _CPU_Context_restore\n")
ret
-
+*/
/* void __ISR_Handler()
*
@@ -393,4 +389,3 @@ void _ISR_Handler(void)
SYM(_ISR_Handler):
ret
-