2 * FreeRTOS Kernel V11.2.0
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 .extern ulTopOfSystemStack
30 .extern ulInterruptNesting
32 /*-----------------------------------------------------------*/
34 .macro portFREERTOS_INTERRUPT_ENTRY
36 /* Save general purpose registers. */
39 /* If ulInterruptNesting is zero the rest of the task context will need
40 saving and a stack switch might be required. */
41 movl ulInterruptNesting, %eax
45 /* Interrupts are not nested, so save the rest of the task context. */
46 .if configSUPPORT_FPU == 1
48 /* If the task has a buffer allocated to save the FPU context then
49 save the FPU context now. */
50 movl pucPortTaskFPUContextBuffer, %eax
53 fnsave ( %eax ) /* Save FLOP context into ucTempFPUBuffer array. */
57 /* Save the address of the FPU context, if any. */
58 push pucPortTaskFPUContextBuffer
60 .endif /* configSUPPORT_FPU */
63 movl pxCurrentTCB, %eax
65 /* Stack location is first item in the TCB. */
69 movl ulTopOfSystemStack, %esp
73 /* Increment nesting count. */
74 add $1, ulInterruptNesting
77 /*-----------------------------------------------------------*/
79 .macro portINTERRUPT_EPILOGUE
82 sub $1, ulInterruptNesting
84 /* If the nesting has unwound to zero. */
85 movl ulInterruptNesting, %eax
89 /* If a yield was requested then select a new TCB now. */
90 movl ulPortYieldPending, %eax
93 movl $0, ulPortYieldPending
94 call vTaskSwitchContext
97 /* Stack location is first item in the TCB. */
98 movl pxCurrentTCB, %eax
101 .if configSUPPORT_FPU == 1
103 /* Restore address of task's FPU context buffer. */
104 pop pucPortTaskFPUContextBuffer
106 /* If the task has a buffer allocated in which its FPU context is saved,
107 then restore it now. */
108 movl pucPortTaskFPUContextBuffer, %eax
119 /*-----------------------------------------------------------*/
121 .macro portFREERTOS_INTERRUPT_EXIT
123 portINTERRUPT_EPILOGUE
125 movl $0x00, (0xFEE000B0)