|
26 | 26 | * |
27 | 27 | */ |
28 | 28 |
|
29 | | -.extern ulTopOfSystemStack |
30 | | - .extern ulInterruptNesting |
| 29 | + .extern ulTopOfSystemStack |
| 30 | + .extern ulInterruptNesting |
31 | 31 |
|
32 | 32 | /*-----------------------------------------------------------*/ |
33 | 33 |
|
34 | | - .macro portFREERTOS_INTERRUPT_ENTRY |
| 34 | +.macro portFREERTOS_INTERRUPT_ENTRY |
35 | 35 |
|
36 | | -/* Save general purpose registers. */ |
37 | | -pusha |
| 36 | + /* Save general purpose registers. */ |
| 37 | + pusha |
38 | 38 |
|
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 |
42 | | -test % eax, % eax |
43 | | -jne 2f |
| 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 |
| 42 | + test %eax, %eax |
| 43 | + jne 2f |
44 | 44 |
|
45 | | -/* Interrupts are not nested, so save the rest of the task context. */ |
46 | | - . |
| 45 | + /* Interrupts are not nested, so save the rest of the task context. */ |
| 46 | + .if configSUPPORT_FPU == 1 |
47 | 47 |
|
48 | | - 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 |
| 51 | + test %eax, %eax |
| 52 | + je 1f |
| 53 | + fnsave ( %eax ) /* Save FLOP context into ucTempFPUBuffer array. */ |
| 54 | + fwait |
49 | 55 |
|
50 | | -/* If the task has a buffer allocated to save the FPU context then |
51 | | - * save the FPU context now. */ |
52 | | -movl pucPortTaskFPUContextBuffer, % eax |
53 | | -test % eax, % eax |
54 | | -je 1f |
55 | | -fnsave( % eax ) /* Save FLOP context into ucTempFPUBuffer array. */ |
56 | | -fwait |
| 56 | + 1: |
| 57 | + /* Save the address of the FPU context, if any. */ |
| 58 | + push pucPortTaskFPUContextBuffer |
57 | 59 |
|
58 | | -1 : |
59 | | -/* Save the address of the FPU context, if any. */ |
60 | | -push pucPortTaskFPUContextBuffer |
| 60 | + .endif /* configSUPPORT_FPU */ |
61 | 61 |
|
62 | | - .endif /* configSUPPORT_FPU */ |
| 62 | + /* Find the TCB. */ |
| 63 | + movl pxCurrentTCB, %eax |
63 | 64 |
|
64 | | -/* Find the TCB. */ |
65 | | -movl pxCurrentTCB, % eax |
| 65 | + /* Stack location is first item in the TCB. */ |
| 66 | + movl %esp, (%eax) |
66 | 67 |
|
67 | | -/* Stack location is first item in the TCB. */ |
68 | | - movl % esp, ( % eax ) |
| 68 | + /* Switch stacks. */ |
| 69 | + movl ulTopOfSystemStack, %esp |
| 70 | + movl %esp, %ebp |
69 | 71 |
|
70 | | -/* Switch stacks. */ |
71 | | -movl ulTopOfSystemStack, % esp |
72 | | -movl % esp, % ebp |
| 72 | + 2: |
| 73 | + /* Increment nesting count. */ |
| 74 | + add $1, ulInterruptNesting |
73 | 75 |
|
74 | | -2 : |
75 | | -/* Increment nesting count. */ |
76 | | -add $1, ulInterruptNesting |
77 | | - |
78 | | - .endm |
| 76 | +.endm |
79 | 77 | /*-----------------------------------------------------------*/ |
80 | 78 |
|
81 | | - .macro portINTERRUPT_EPILOGUE |
82 | | - |
83 | | -cli |
84 | | -sub $1, ulInterruptNesting |
| 79 | +.macro portINTERRUPT_EPILOGUE |
85 | 80 |
|
86 | | -/* If the nesting has unwound to zero. */ |
87 | | -movl ulInterruptNesting, % eax |
88 | | - test % eax, % eax |
89 | | - jne 2f |
| 81 | + cli |
| 82 | + sub $1, ulInterruptNesting |
90 | 83 |
|
91 | | -/* If a yield was requested then select a new TCB now. */ |
92 | | -movl ulPortYieldPending, % eax |
93 | | - test % eax, % eax |
94 | | - je 1f |
95 | | -movl $0, ulPortYieldPending |
96 | | -call vTaskSwitchContext |
| 84 | + /* If the nesting has unwound to zero. */ |
| 85 | + movl ulInterruptNesting, %eax |
| 86 | + test %eax, %eax |
| 87 | + jne 2f |
97 | 88 |
|
98 | | -1 : |
99 | | -/* Stack location is first item in the TCB. */ |
100 | | -movl pxCurrentTCB, % eax movl( % eax ), % esp |
| 89 | + /* If a yield was requested then select a new TCB now. */ |
| 90 | + movl ulPortYieldPending, %eax |
| 91 | + test %eax, %eax |
| 92 | + je 1f |
| 93 | + movl $0, ulPortYieldPending |
| 94 | + call vTaskSwitchContext |
101 | 95 |
|
102 | | - . |
| 96 | + 1: |
| 97 | + /* Stack location is first item in the TCB. */ |
| 98 | + movl pxCurrentTCB, %eax |
| 99 | + movl (%eax), %esp |
103 | 100 |
|
104 | | - if configSUPPORT_FPU == 1 |
| 101 | + .if configSUPPORT_FPU == 1 |
105 | 102 |
|
106 | | -/* Restore address of task's FPU context buffer. */ |
107 | | -pop pucPortTaskFPUContextBuffer |
| 103 | + /* Restore address of task's FPU context buffer. */ |
| 104 | + pop pucPortTaskFPUContextBuffer |
108 | 105 |
|
109 | | -/* If the task has a buffer allocated in which its FPU context is saved, |
110 | | - * then restore it now. */ |
111 | | -movl pucPortTaskFPUContextBuffer, % eax |
112 | | -test % eax, % eax |
113 | | -je 1f |
114 | | -frstor( % eax ) |
115 | | -1 : |
116 | | -.endif |
| 106 | + /* If the task has a buffer allocated in which its FPU context is saved, |
| 107 | + then restore it now. */ |
| 108 | + movl pucPortTaskFPUContextBuffer, %eax |
| 109 | + test %eax, %eax |
| 110 | + je 1f |
| 111 | + frstor ( %eax ) |
| 112 | + 1: |
| 113 | + .endif |
117 | 114 |
|
118 | | -2 : |
119 | | -popa |
| 115 | + 2: |
| 116 | + popa |
120 | 117 |
|
121 | | - .endm |
| 118 | +.endm |
122 | 119 | /*-----------------------------------------------------------*/ |
123 | 120 |
|
124 | | - .macro portFREERTOS_INTERRUPT_EXIT |
| 121 | +.macro portFREERTOS_INTERRUPT_EXIT |
125 | 122 |
|
126 | | -portINTERRUPT_EPILOGUE |
127 | | -/* EOI. */ |
128 | | -movl $0x00, ( 0xFEE000B0 ) |
129 | | -iret |
| 123 | + portINTERRUPT_EPILOGUE |
| 124 | + /* EOI. */ |
| 125 | + movl $0x00, (0xFEE000B0) |
| 126 | + iret |
130 | 127 |
|
131 | | - .endm |
| 128 | +.endm |
0 commit comments