X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=kern%2Fswitch_avr.S;h=84fa14d3287af07337649412ce29d9a2e8bd3233;hb=1b38e2c9925d6ec7fc50b327fc46d490f20d7ee0;hp=266a77e4bd1ed08a39e27e00d99b028d0f26cb53;hpb=1cc167e20f21d2e81527ca47ccd4a21a6198f86f;p=bertos.git diff --git a/kern/switch_avr.S b/kern/switch_avr.S old mode 100755 new mode 100644 index 266a77e4..84fa14d3 --- a/kern/switch_avr.S +++ b/kern/switch_avr.S @@ -3,7 +3,7 @@ * * * \brief AVR context switch @@ -16,10 +16,18 @@ #include +/* + * 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: + in r0,SREG-__SFR_OFFSET + push r0 ; 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 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 +