86 // r0 = address to store |
86 // r0 = address to store |
87 asm ("stmia r0,{lr}^"); |
87 asm ("stmia r0,{lr}^"); |
88 __JUMP(,lr); |
88 __JUMP(,lr); |
89 } |
89 } |
90 |
90 |
|
91 // This will return 1 if it was iDFC interrupted (0 otherwise). |
|
92 // As there is no Kernel interface for that, we have to 'fake' Kernel by |
|
93 // setting SVC mode before calling NKern::CurrentContext. |
|
94 // Without that, CurrentContext would always return EInterrupt. |
|
95 __NAKED__ TUint IDFCRunning() |
|
96 { |
|
97 asm("stmfd sp!, {r4-r5} "); |
|
98 |
|
99 asm("mrs r5, cpsr"); // r5 = cpsr_irq |
|
100 asm("bic r4, r5, #0xdf "); // clear interrupt mask & CPU mode |
|
101 asm("orr r4, r4, #0xd3 "); // disable all interrupts and set SVC mode |
|
102 |
|
103 asm("msr CPSR_cf, r4"); // switch to SVC, (dissable FIQ, IRQ) |
|
104 |
|
105 // NKern::CurrentContext does not use sp (only r0,r1,r2) |
|
106 // It is just lr in svc mode we need to preserve. |
|
107 asm("mov r4, lr"); // r4 = lr_svc |
|
108 asm("bl " CSM__ZN5NKern14CurrentContextEv ); // r0 = 1 if iDFC was running, 0 if a thread was running |
|
109 asm("mov lr, r4"); // lr_svc is back to original state |
|
110 |
|
111 asm("msr CPSR_cf, r5"); // return to IRQ mode |
|
112 |
|
113 asm("ldmfd sp!, {r4-r5} "); |
|
114 __JUMP(,lr); |
|
115 } |
91 #endif |
116 #endif |