projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Include <mware/pgm.h> explicitly for non-Harvard archs.
[bertos.git]
/
kern
/
switch_avr.S
diff --git
a/kern/switch_avr.S
b/kern/switch_avr.S
index 266a77e4bd1ed08a39e27e00d99b028d0f26cb53..84fa14d3287af07337649412ce29d9a2e8bd3233 100755
(executable)
--- a/
kern/switch_avr.S
+++ b/
kern/switch_avr.S
@@
-3,7
+3,7
@@
* <!--
* Copyright 2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
* <!--
* Copyright 2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
- *
All Rights Reserved
.
+ *
This file is part of DevLib - See devlib/README for information
.
* -->
*
* \brief AVR context switch
* -->
*
* \brief AVR context switch
@@
-16,10
+16,18
@@
#include <avr/io.h>
#include <avr/io.h>
+/*
+ * NOTE: At each change of this function affecting proc.c
+ * (i.e. arguments, data stored in the stack) bump up version
+ * number in asm_switch_version().
+ */
+
/* void asm_switch_context(void **new_sp, void **save_sp) */
.globl asm_switch_context
asm_switch_context:
/* void asm_switch_context(void **new_sp, void **save_sp) */
.globl asm_switch_context
asm_switch_context:
+ in r0,SREG-__SFR_OFFSET
+ push r0
; push r0 caller-save
; push r1 caller-save
push r2
; push r0 caller-save
; push r1 caller-save
push r2
@@
-98,5
+106,16
@@
asm_switch_context:
pop r2
; pop r1 caller-save
; pop r0 caller-save
pop r2
; pop r1 caller-save
; pop r0 caller-save
+ pop r0
+ out SREG-__SFR_OFFSET,r0
+
+ ret
+
+/* int asm_switch_version(void) */
+.globl asm_switch_version
+asm_switch_version:
+ ldi r24,lo8(1)
+ ldi r25,hi8(1)
ret
ret
+