diff --git a/arch/avr/src/avr/excptmacros.h b/arch/avr/src/avr/excptmacros.h index dcfa8c4e547..a6046abf873 100644 --- a/arch/avr/src/avr/excptmacros.h +++ b/arch/avr/src/avr/excptmacros.h @@ -465,7 +465,7 @@ #if AVR_PC_SIZE <= 16 adiw r28, REG_PC0 #else - adiw r28, REG_PC2 + adiw r28, (REG_PC2+1) /* Will pre-decrement this on use */ #endif /* Fetch and set the new stack pointer */ @@ -490,14 +490,11 @@ push r24 /* Push PC0 and PC1 on the stack (PC1 then PC0) */ push r25 #else - ld r25, y /* Load PC2 (r25) */ - subi r28,1 + ld r25, -y /* Load PC2 (r25) */ push r25 - ld r25, y /* Load PC1 (r25) */ - subi r28,1 + ld r25, -y /* Load PC1 (r25) */ push r25 - ld r25, y /* Load PC0 (r25) */ - subi r28,1 + ld r25, -y /* Load PC0 (r25) */ push r25 #endif