From 46da8a07ef7e136f0c7d98ead80a8c3b4ba3c366 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 26 Dec 2015 16:39:51 -0600 Subject: [PATCH] Costmetic changes from review of merge request --- arch/avr/src/avr/excptmacros.h | 36 +++++++++++++++-------------- arch/avr/src/avr/up_switchcontext.S | 3 +-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/arch/avr/src/avr/excptmacros.h b/arch/avr/src/avr/excptmacros.h index 1abc14273d2..de5e0094193 100644 --- a/arch/avr/src/avr/excptmacros.h +++ b/arch/avr/src/avr/excptmacros.h @@ -141,7 +141,7 @@ * * At completion: * Register state is saved on the stack; All registers are available for usage except sp and - * r24 which still contains the IRQ number as set by the HANDLER macro. + * r24 which still contains the IRQ number as set by the HANDLER macro. * ********************************************************************************************/ @@ -418,7 +418,7 @@ * On completion: * All registers restored except for the PC with now resides at the top of the new stack * so that ret can be used to switch to the new context. (ret, not reti, becaue ret - * will preserve the restored interrupt state). + * will preserve the restored interrupt state). * ********************************************************************************************/ @@ -514,22 +514,23 @@ ld r0, x+ - /* The following control flow split is required to eliminate non-atomic - interrupt_enable - return sequence. - - NOTE: since actual returning is handled by this macro it has been removed - from up_fullcontextrestore function (up_switchcontext.S) - */ + /* The following control flow split is required to eliminate non-atomic + * interrupt_enable - return sequence. + * + * NOTE: since actual returning is handled by this macro it has been removed + * from up_fullcontextrestore function (up_switchcontext.S) + */ + + /* If interrupts shall be enabled go to 'restore remaining and reti' code + * otherwise just do 'restore remaining and ret' + */ - /* if interrupts shall be enabled go to 'restore remaining and reti' code - otherwise just do 'restore remaining and ret' */ - ld r24, x+ bst r24, SREG_I brts go_reti /* Restore the status register, interrupts are disabled */ - + out _SFR_IO_ADDR(SREG), r24 /* Restore r24-r25 - The temporary and IRQ number registers */ @@ -547,20 +548,21 @@ ret go_reti: - /* restore the Status Register with interrupts disabled - and exit with reti (that will set the Interrupt Enable) */ - + /* restore the Status Register with interrupts disabled + * and exit with reti (that will set the Interrupt Enable) + */ + andi r24, ~(1 << SREG_I) out _SFR_IO_ADDR(SREG), r24 ld r25, x+ ld r24, x+ - pop r27 + pop r27 pop r26 reti - + .endm /******************************************************************************************** diff --git a/arch/avr/src/avr/up_switchcontext.S b/arch/avr/src/avr/up_switchcontext.S index da5f45e6171..0f13e232214 100755 --- a/arch/avr/src/avr/up_switchcontext.S +++ b/arch/avr/src/avr/up_switchcontext.S @@ -130,8 +130,7 @@ up_fullcontextrestore: TCB_RESTORE - /* Retruning from the function is handled in TCB_RESTORE */ + /* Returning from the function is handled in TCB_RESTORE */ .endfunc .end -