diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-16 15:29:27 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-16 15:29:27 +0000 |
commit | 5bca785c9461c4c456ff2070ba6eb53079e0f4c0 (patch) | |
tree | 7ae1e5817890f60ad56a43a472bdc28baf4d3431 /nuttx/arch/avr/src/at90usb | |
parent | bd39911fb9424b42273b2a924c615c553ff8d744 (diff) | |
download | px4-nuttx-5bca785c9461c4c456ff2070ba6eb53079e0f4c0.tar.gz px4-nuttx-5bca785c9461c4c456ff2070ba6eb53079e0f4c0.tar.bz2 px4-nuttx-5bca785c9461c4c456ff2070ba6eb53079e0f4c0.zip |
Fix off-by-one stack pointer reference
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3712 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/avr/src/at90usb')
-rwxr-xr-x | nuttx/arch/avr/src/at90usb/at90usb_exceptions.S | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_exceptions.S b/nuttx/arch/avr/src/at90usb/at90usb_exceptions.S index 90d9cbac3..44b607033 100755 --- a/nuttx/arch/avr/src/at90usb/at90usb_exceptions.S +++ b/nuttx/arch/avr/src/at90usb/at90usb_exceptions.S @@ -129,12 +129,13 @@ excpt_common: * the push operation post-decrements -- need to REVISIT this). */ - in r16, _SFR_IO_ADDR(SPL) /* Get the save structure pointer in a Call-saved register pair */ - in r17, _SFR_IO_ADDR(SPH) /* (Careful, push post-decrements) */ - movw r22, r16 /* Pass register save structure as the parameter 2 */ + in r28, _SFR_IO_ADDR(SPL) /* Get the save structure pointer in a Call-saved register pair */ + in r29, _SFR_IO_ADDR(SPH) /* Pointer can be obtained from the stack pointer */ + adiw r28, 1 /* Remembering that push post-decrements */ + movw r22, r28 /* Pass register save structure as the parameter 2 */ USE_INTSTACK rx, ry, rz /* Switch to the interrupt stack */ call up_doirq /* Dispatch the interrupt */ - RESTORE_STACK rx, ry /* - Undo the operations of USE_INTSTACK */ + RESTORE_STACK rx, ry /* Undo the operations of USE_INTSTACK */ /* up_doiq returns with r24-r25 equal to the new save structure. If no context * switch occurred, this will be the same as the value passed to it in r22-23. @@ -142,8 +143,8 @@ excpt_common: * stack frame, but at a register save area inside of the new task's TCB. */ - cp r16, r24 - cpc r17, r25 + cp r28, r24 + cpc r29, r25 breq .Lnoswitch /* A context switch has occurred, jump to up_fullcontextrestore with r24, r25 |