mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 16:31:22 +00:00
- Fix various compilation errors in SMP assembly (typos, missing jump labels and specifiers)
- Implement the SMP case in KiDispatchInterrupt -- on SMP we must raise IRQL to SYNCH_LEVEL, set the thread context swap busy flag and acquire the PRCB lock before calling KiQueueReadyThread and KiSwapContextInternal svn path=/trunk/; revision=36876
This commit is contained in:
parent
a9f8e09aa6
commit
42d35acde0
2 changed files with 35 additions and 8 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <ndk/asm.h>
|
#include <ndk/asm.h>
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
#define Ready 1
|
||||||
#define Running 2
|
#define Running 2
|
||||||
#define WrDispatchInt 0x1F
|
#define WrDispatchInt 0x1F
|
||||||
|
|
||||||
|
@ -346,7 +347,7 @@ BadThread:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
GetSwapLock:
|
GetSwapLock:
|
||||||
/* Acquire the swap lock */
|
/* Acquire the swap lock */
|
||||||
cmp [esi+KTHREAD_SWAP_BUSY], 0
|
cmp byte ptr [esi+KTHREAD_SWAP_BUSY], 0
|
||||||
jz NotBusy
|
jz NotBusy
|
||||||
pause
|
pause
|
||||||
jmp GetSwapLock
|
jmp GetSwapLock
|
||||||
|
@ -559,6 +560,16 @@ NewCr0:
|
||||||
mov cr0, ecx
|
mov cr0, ecx
|
||||||
jmp StackOk
|
jmp StackOk
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
NpxLoaded:
|
||||||
|
|
||||||
|
/* FIXME: TODO */
|
||||||
|
int 3
|
||||||
|
|
||||||
|
/* Jump back */
|
||||||
|
jmp SetStack
|
||||||
|
#endif
|
||||||
|
|
||||||
WmiTrace:
|
WmiTrace:
|
||||||
|
|
||||||
/* No WMI support yet */
|
/* No WMI support yet */
|
||||||
|
@ -696,8 +707,7 @@ CheckSchedule:
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* There is, raise IRQL to synch level */
|
/* There is, raise IRQL to synch level */
|
||||||
mov ecx, SYNCH_LEVEL
|
call _KeRaiseIrqlToSynchLevel@0
|
||||||
call @KfRaiseIrql@4
|
|
||||||
#endif
|
#endif
|
||||||
sti
|
sti
|
||||||
|
|
||||||
|
@ -707,7 +717,7 @@ CheckSchedule:
|
||||||
mov byte ptr [edi+KTHREAD_SWAP_BUSY], 1
|
mov byte ptr [edi+KTHREAD_SWAP_BUSY], 1
|
||||||
|
|
||||||
/* Acquire the PRCB Lock */
|
/* Acquire the PRCB Lock */
|
||||||
lock bts [ebx+KPCR_PRCB_PRCB_LOCK], 0
|
lock bts dword ptr [ebx+KPCR_PRCB_PRCB_LOCK], 0
|
||||||
jnb CheckNext
|
jnb CheckNext
|
||||||
lea ecx, [ebx+KPCR_PRCB_PRCB_LOCK]
|
lea ecx, [ebx+KPCR_PRCB_PRCB_LOCK]
|
||||||
call @KefAcquireSpinLockAtDpcLevel@4
|
call @KefAcquireSpinLockAtDpcLevel@4
|
||||||
|
@ -731,7 +741,7 @@ CheckNext:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* Disable the idle scheduler and release the PRCB lock */
|
/* Disable the idle scheduler and release the PRCB lock */
|
||||||
and byte ptr [ebx+KPCR_PRCB_IDLE_SCHEDULE], 0
|
and byte ptr [ebx+KPCR_PRCB_IDLE_SCHEDULE], 0
|
||||||
and [ebx+KPCR_PRCB_PRCB_LOCK], 0
|
and dword ptr [ebx+KPCR_PRCB_PRCB_LOCK], 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SwapContext:
|
SwapContext:
|
||||||
|
@ -764,7 +774,7 @@ NoNextThread:
|
||||||
jz CpuIdle
|
jz CpuIdle
|
||||||
|
|
||||||
/* It is, so call the scheduler */
|
/* It is, so call the scheduler */
|
||||||
lea ecx, [ebx+KPCR_PRCBDATA]
|
lea ecx, [ebx+KPCR_PRCB_DATA]
|
||||||
call @KiIdleSchedule@4
|
call @KiIdleSchedule@4
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
|
||||||
|
|
|
@ -2455,9 +2455,20 @@ CheckQuantum:
|
||||||
mov edi, [ebx+KPCR_CURRENT_THREAD]
|
mov edi, [ebx+KPCR_CURRENT_THREAD]
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
#error SMP Interrupt not handled!
|
/* Raise to synch level */
|
||||||
|
call _KeRaiseIrqlToSynchLevel@0
|
||||||
|
|
||||||
|
/* Set context swap busy */
|
||||||
|
mov byte ptr [edi+KTHREAD_SWAP_BUSY], 1
|
||||||
|
|
||||||
|
/* Acquire the PRCB Lock */
|
||||||
|
lock bts dword ptr [ebx+KPCR_PRCB_PRCB_LOCK], 0
|
||||||
|
jnb GetNext
|
||||||
|
lea ecx, [ebx+KPCR_PRCB_PRCB_LOCK]
|
||||||
|
call @KefAcquireSpinLockAtDpcLevel@4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GetNext:
|
||||||
/* Get the next thread and clear it */
|
/* Get the next thread and clear it */
|
||||||
mov esi, [ebx+KPCR_PRCB_NEXT_THREAD]
|
mov esi, [ebx+KPCR_PRCB_NEXT_THREAD]
|
||||||
and dword ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0
|
and dword ptr [ebx+KPCR_PRCB_NEXT_THREAD], 0
|
||||||
|
@ -2476,6 +2487,12 @@ CheckQuantum:
|
||||||
mov cl, APC_LEVEL
|
mov cl, APC_LEVEL
|
||||||
call @KiSwapContextInternal@0
|
call @KiSwapContextInternal@0
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* Lower IRQL back to dispatch */
|
||||||
|
mov cl, DISPATCH_LEVEL
|
||||||
|
call @KfLowerIrql@4
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Restore registers */
|
/* Restore registers */
|
||||||
mov ebp, [esp+0]
|
mov ebp, [esp+0]
|
||||||
mov edi, [esp+4]
|
mov edi, [esp+4]
|
||||||
|
@ -2617,7 +2634,7 @@ SpuriousInt:
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
IntSpin:
|
IntSpin:
|
||||||
SPIN_ON_LOCK esi, GetIntLock
|
SPIN_ON_LOCK(esi, GetIntLock)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IsrTimeout:
|
IsrTimeout:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue