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