We now generate the correct ARM syscall stub code for system calls with IDs > 0x100.

We never call KfRaise/LowerIrql in portable code anymore, isntead, we use Ke.
We now have correctly defined IRQL routines for ARM, much more of the kernel builds as a result.

svn path=/trunk/; revision=32179
This commit is contained in:
ReactOS Portable Systems Group 2008-02-07 07:10:13 +00:00
parent 46c6129581
commit ac30a263d8
12 changed files with 56 additions and 27 deletions

View file

@ -9561,6 +9561,10 @@ KIRQL
DDKAPI
KeRaiseIrqlToSynchLevel(
VOID);
#elif defined(_M_ARM)
#include <armddk.h>
#else

View file

@ -100,4 +100,24 @@ struct _TEB* NtCurrentTeb(VOID)
return (struct _TEB*)USERPCR->Teb;
}
//
// IRQL Support on ARM is similar to MIPS/ALPHA
//
NTKERNELAPI
KIRQL
DDKAPI
KeSwapIrql(
IN KIRQL NewIrql
);
NTKERNELAPI
KIRQL
NTAPI
KeRaiseIrqlToDpcLevel(
VOID
);
#define KeLowerIrql(NewIrql) KeSwapIrql(NewIrql)
#define KeRaiseIrql(NewIrql, OldIrql) *(OldIrql) = KeSwapIrql(NewIrql)
#endif

View file

@ -109,7 +109,7 @@ ExAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
/* Raise IRQL to APC */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Decrease the count */
if (InterlockedDecrement(&FastMutex->Count) != 0)
@ -145,7 +145,7 @@ ExReleaseFastMutex(IN OUT PFAST_MUTEX FastMutex)
}
/* Lower IRQL back */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
}
/*
@ -181,7 +181,7 @@ ExTryToAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
/* Raise to APC_LEVEL */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Check if we can quickly acquire it */
if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
@ -194,7 +194,7 @@ ExTryToAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
else
{
/* Acquire attempt failed */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
return FALSE;
}
}

View file

@ -29,13 +29,14 @@ KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
{
KIRQL OldIrql;
if (DeferredContext)
{
ExFreePool(DeferredContext);
}
while (TRUE)
{
KfRaiseIrql(SYNCH_LEVEL);
KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
#if defined(_M_X86)
Ke386HaltProcessor();
#else

View file

@ -157,7 +157,7 @@ InbvAcquireLock(VOID)
if (InbvOldIrql < DISPATCH_LEVEL)
{
/* Raise IRQL to dispatch level */
InbvOldIrql = KfRaiseIrql(DISPATCH_LEVEL);
KeRaiseIrql(DISPATCH_LEVEL, &InbvOldIrql);
}
/* Acquire the lock */
@ -172,7 +172,7 @@ InbvReleaseLock(VOID)
KiReleaseSpinLock(&BootDriverLock);
/* If we were below dispatch level, lower IRQL back */
if (InbvOldIrql < DISPATCH_LEVEL) KfLowerIrql(InbvOldIrql);
if (InbvOldIrql < DISPATCH_LEVEL) KeLowerIrql(InbvOldIrql);
}
VOID

View file

@ -2748,7 +2748,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
if (!NT_SUCCESS(Status)) return Status;
/* IRP cancellations are synchronized at APC_LEVEL. */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Get the current thread */
Thread = PsGetCurrentThread();
@ -2775,7 +2775,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
}
/* Lower the IRQL */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
/* Check if we had found an IRP */
if (OurIrpsInList)
@ -2791,7 +2791,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
OurIrpsInList = FALSE;
/* Raise IRQL */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Now loop the list again */
NextEntry = ListHead->Flink;
@ -2811,7 +2811,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
}
/* Lower the IRQL */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
}
}

View file

@ -1021,7 +1021,7 @@ IoCancelThreadIo(IN PETHREAD Thread)
Thread);
/* Raise to APC to protect the IrpList */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Start by cancelling all the IRPs in the current thread queue. */
ListHead = &Thread->IrpList;
@ -1045,7 +1045,7 @@ IoCancelThreadIo(IN PETHREAD Thread)
while (!IsListEmpty(&Thread->IrpList))
{
/* Now we can lower */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
/* Wait a short while and then look if all our IRPs were completed. */
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
@ -1057,11 +1057,11 @@ IoCancelThreadIo(IN PETHREAD Thread)
if (!(Retries--)) IopRemoveThreadIrp();
/* Raise the IRQL Again */
OldIrql = KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
}
/* We're done, lower the IRQL */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
}
/*

View file

@ -35,13 +35,15 @@ VOID
NTAPI
KiCheckForKernelApcDelivery(VOID)
{
KIRQL OldIrql;
/* We should only deliver at passive */
if (KeGetCurrentIrql() == PASSIVE_LEVEL)
{
/* Raise to APC and Deliver APCs, then lower back to Passive */
KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
KiDeliverApc(KernelMode, 0, 0);
KfLowerIrql(PASSIVE_LEVEL);
KeLowerIrql(PASSIVE_LEVEL);
}
else
{

View file

@ -769,6 +769,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
PVOID DriverBase;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PULONG_PTR HardErrorParameters;
KIRQL OldIrql;
#ifdef CONFIG_SMP
LONG i = 0;
#endif
@ -1115,7 +1116,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
/* Raise IRQL to HIGH_LEVEL */
_disable();
KfRaiseIrql(HIGH_LEVEL);
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
/* Avoid recursion */
if (!InterlockedDecrement((PLONG)&KeBugCheckCount))
@ -1137,13 +1138,13 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
#endif
/* Display the BSOD */
KfLowerIrql(APC_LEVEL); // This is a nastier hack than any ever before
KeLowerIrql(APC_LEVEL); // This is a nastier hack than any ever before
KiDisplayBlueScreen(MessageId,
IsHardError,
HardErrCaption,
HardErrMessage,
AnsiName);
KfRaiseIrql(HIGH_LEVEL);
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
/* Check if the debugger is disabled but we can enable it */
if (!(KdDebuggerEnabled) && !(KdPitchDebugger))

View file

@ -145,17 +145,17 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
#error Not yet implemented!
#else
ULONG_PTR Status;
KIRQL OldIrql;
KIRQL OldIrql, OldIrql2;
/* Raise to DPC level if required */
OldIrql = KeGetCurrentIrql();
if (OldIrql < DISPATCH_LEVEL) OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
if (OldIrql < DISPATCH_LEVEL) KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
/* Acquire the IPI lock */
KefAcquireSpinLockAtDpcLevel(&KiIpiLock);
/* Raise to IPI level */
KfRaiseIrql(IPI_LEVEL);
KeRaiseIrql(IPI_LEVEL, &OldIrql2);
/* Call the function */
Status = Function(Argument);
@ -164,7 +164,7 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
KefReleaseSpinLockFromDpcLevel(&KiIpiLock);
/* Lower IRQL back */
KfLowerIrql(OldIrql);
KeLowerIrql(OldIrql);
return Status;
#endif
}

View file

@ -29,6 +29,7 @@ PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine,
PETHREAD Thread;
PTEB Teb;
BOOLEAN DeadThread = FALSE;
KIRQL OldIrql;
PAGED_CODE();
PSTRACE(PS_THREAD_DEBUG,
"StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
@ -68,7 +69,7 @@ PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine,
}
/* Raise to APC */
KfRaiseIrql(APC_LEVEL);
KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Queue the User APC */
KiInitializeUserApc(NULL,

View file

@ -71,7 +71,7 @@
//
// For now, only supports 0-4 arguments
//
#define UserModeStub_arm " mov r12, #0x%x\n" \
#define UserModeStub_arm " ldr r12, =%x\n" \
" swi #0x2E\n" \
" bx lr\n\n"
@ -104,7 +104,7 @@
#define KernelModeStub_mips " j KiSystemService\n" \
" nop\n"
#define KernelModeStub_arm " mov r12, #0x%x\n" \
#define KernelModeStub_arm " ldr r12, =x%x\n" \
" swi #0x2E\n" \
" bx lr\n\n"