2 * FreeRTOS Kernel V10.1.0
\r
3 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
6 * this software and associated documentation files (the "Software"), to deal in
\r
7 * the Software without restriction, including without limitation the rights to
\r
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
9 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
10 * subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in all
\r
13 * copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 * http://www.FreeRTOS.org
\r
23 * http://aws.amazon.com/freertos
\r
25 * 1 tab == 4 spaces!
\r
28 .extern ulTopOfSystemStack
\r
29 .extern ulInterruptNesting
\r
31 /*-----------------------------------------------------------*/
\r
33 .macro portFREERTOS_INTERRUPT_ENTRY
\r
35 /* Save general purpose registers. */
\r
38 /* If ulInterruptNesting is zero the rest of the task context will need
\r
39 saving and a stack switch might be required. */
\r
40 movl ulInterruptNesting, %eax
\r
44 /* Interrupts are not nested, so save the rest of the task context. */
\r
45 .if configSUPPORT_FPU == 1
\r
47 /* If the task has a buffer allocated to save the FPU context then
\r
48 save the FPU context now. */
\r
49 movl pucPortTaskFPUContextBuffer, %eax
\r
52 fnsave ( %eax ) /* Save FLOP context into ucTempFPUBuffer array. */
\r
56 /* Save the address of the FPU context, if any. */
\r
57 push pucPortTaskFPUContextBuffer
\r
59 .endif /* configSUPPORT_FPU */
\r
62 movl pxCurrentTCB, %eax
\r
64 /* Stack location is first item in the TCB. */
\r
67 /* Switch stacks. */
\r
68 movl ulTopOfSystemStack, %esp
\r
72 /* Increment nesting count. */
\r
73 add $1, ulInterruptNesting
\r
76 /*-----------------------------------------------------------*/
\r
78 .macro portINTERRUPT_EPILOGUE
\r
81 sub $1, ulInterruptNesting
\r
83 /* If the nesting has unwound to zero. */
\r
84 movl ulInterruptNesting, %eax
\r
88 /* If a yield was requested then select a new TCB now. */
\r
89 movl ulPortYieldPending, %eax
\r
92 movl $0, ulPortYieldPending
\r
93 call vTaskSwitchContext
\r
96 /* Stack location is first item in the TCB. */
\r
97 movl pxCurrentTCB, %eax
\r
100 .if configSUPPORT_FPU == 1
\r
102 /* Restore address of task's FPU context buffer. */
\r
103 pop pucPortTaskFPUContextBuffer
\r
105 /* If the task has a buffer allocated in which its FPU context is saved,
\r
106 then restore it now. */
\r
107 movl pucPortTaskFPUContextBuffer, %eax
\r
118 /*-----------------------------------------------------------*/
\r
120 .macro portFREERTOS_INTERRUPT_EXIT
\r
122 portINTERRUPT_EPILOGUE
\r
124 movl $0x00, (0xFEE000B0)
\r