mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
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:
parent
46c6129581
commit
ac30a263d8
12 changed files with 56 additions and 27 deletions
|
@ -9561,6 +9561,10 @@ KIRQL
|
||||||
DDKAPI
|
DDKAPI
|
||||||
KeRaiseIrqlToSynchLevel(
|
KeRaiseIrqlToSynchLevel(
|
||||||
VOID);
|
VOID);
|
||||||
|
|
||||||
|
#elif defined(_M_ARM)
|
||||||
|
|
||||||
|
#include <armddk.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -100,4 +100,24 @@ struct _TEB* NtCurrentTeb(VOID)
|
||||||
return (struct _TEB*)USERPCR->Teb;
|
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
|
#endif
|
||||||
|
|
|
@ -109,7 +109,7 @@ ExAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
|
||||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
|
||||||
/* Raise IRQL to APC */
|
/* Raise IRQL to APC */
|
||||||
OldIrql = KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Decrease the count */
|
/* Decrease the count */
|
||||||
if (InterlockedDecrement(&FastMutex->Count) != 0)
|
if (InterlockedDecrement(&FastMutex->Count) != 0)
|
||||||
|
@ -145,7 +145,7 @@ ExReleaseFastMutex(IN OUT PFAST_MUTEX FastMutex)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lower IRQL back */
|
/* Lower IRQL back */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -181,7 +181,7 @@ ExTryToAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
|
||||||
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
|
||||||
|
|
||||||
/* Raise to APC_LEVEL */
|
/* Raise to APC_LEVEL */
|
||||||
OldIrql = KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Check if we can quickly acquire it */
|
/* Check if we can quickly acquire it */
|
||||||
if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
|
if (InterlockedCompareExchange(&FastMutex->Count, 0, 1) == 1)
|
||||||
|
@ -194,7 +194,7 @@ ExTryToAcquireFastMutex(IN OUT PFAST_MUTEX FastMutex)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Acquire attempt failed */
|
/* Acquire attempt failed */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,14 @@ KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
|
||||||
IN PVOID SystemArgument1,
|
IN PVOID SystemArgument1,
|
||||||
IN PVOID SystemArgument2)
|
IN PVOID SystemArgument2)
|
||||||
{
|
{
|
||||||
|
KIRQL OldIrql;
|
||||||
if (DeferredContext)
|
if (DeferredContext)
|
||||||
{
|
{
|
||||||
ExFreePool(DeferredContext);
|
ExFreePool(DeferredContext);
|
||||||
}
|
}
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
KfRaiseIrql(SYNCH_LEVEL);
|
KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
|
||||||
#if defined(_M_X86)
|
#if defined(_M_X86)
|
||||||
Ke386HaltProcessor();
|
Ke386HaltProcessor();
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -157,7 +157,7 @@ InbvAcquireLock(VOID)
|
||||||
if (InbvOldIrql < DISPATCH_LEVEL)
|
if (InbvOldIrql < DISPATCH_LEVEL)
|
||||||
{
|
{
|
||||||
/* Raise IRQL to dispatch level */
|
/* Raise IRQL to dispatch level */
|
||||||
InbvOldIrql = KfRaiseIrql(DISPATCH_LEVEL);
|
KeRaiseIrql(DISPATCH_LEVEL, &InbvOldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire the lock */
|
/* Acquire the lock */
|
||||||
|
@ -172,7 +172,7 @@ InbvReleaseLock(VOID)
|
||||||
KiReleaseSpinLock(&BootDriverLock);
|
KiReleaseSpinLock(&BootDriverLock);
|
||||||
|
|
||||||
/* If we were below dispatch level, lower IRQL back */
|
/* If we were below dispatch level, lower IRQL back */
|
||||||
if (InbvOldIrql < DISPATCH_LEVEL) KfLowerIrql(InbvOldIrql);
|
if (InbvOldIrql < DISPATCH_LEVEL) KeLowerIrql(InbvOldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -2748,7 +2748,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* IRP cancellations are synchronized at APC_LEVEL. */
|
/* IRP cancellations are synchronized at APC_LEVEL. */
|
||||||
OldIrql = KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Get the current thread */
|
/* Get the current thread */
|
||||||
Thread = PsGetCurrentThread();
|
Thread = PsGetCurrentThread();
|
||||||
|
@ -2775,7 +2775,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lower the IRQL */
|
/* Lower the IRQL */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
|
||||||
/* Check if we had found an IRP */
|
/* Check if we had found an IRP */
|
||||||
if (OurIrpsInList)
|
if (OurIrpsInList)
|
||||||
|
@ -2791,7 +2791,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
|
||||||
OurIrpsInList = FALSE;
|
OurIrpsInList = FALSE;
|
||||||
|
|
||||||
/* Raise IRQL */
|
/* Raise IRQL */
|
||||||
OldIrql = KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Now loop the list again */
|
/* Now loop the list again */
|
||||||
NextEntry = ListHead->Flink;
|
NextEntry = ListHead->Flink;
|
||||||
|
@ -2811,7 +2811,7 @@ NtCancelIoFile(IN HANDLE FileHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lower the IRQL */
|
/* Lower the IRQL */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ IoCancelThreadIo(IN PETHREAD Thread)
|
||||||
Thread);
|
Thread);
|
||||||
|
|
||||||
/* Raise to APC to protect the IrpList */
|
/* 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. */
|
/* Start by cancelling all the IRPs in the current thread queue. */
|
||||||
ListHead = &Thread->IrpList;
|
ListHead = &Thread->IrpList;
|
||||||
|
@ -1045,7 +1045,7 @@ IoCancelThreadIo(IN PETHREAD Thread)
|
||||||
while (!IsListEmpty(&Thread->IrpList))
|
while (!IsListEmpty(&Thread->IrpList))
|
||||||
{
|
{
|
||||||
/* Now we can lower */
|
/* Now we can lower */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
|
|
||||||
/* Wait a short while and then look if all our IRPs were completed. */
|
/* Wait a short while and then look if all our IRPs were completed. */
|
||||||
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
|
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
|
||||||
|
@ -1057,11 +1057,11 @@ IoCancelThreadIo(IN PETHREAD Thread)
|
||||||
if (!(Retries--)) IopRemoveThreadIrp();
|
if (!(Retries--)) IopRemoveThreadIrp();
|
||||||
|
|
||||||
/* Raise the IRQL Again */
|
/* Raise the IRQL Again */
|
||||||
OldIrql = KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We're done, lower the IRQL */
|
/* We're done, lower the IRQL */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -35,13 +35,15 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KiCheckForKernelApcDelivery(VOID)
|
KiCheckForKernelApcDelivery(VOID)
|
||||||
{
|
{
|
||||||
|
KIRQL OldIrql;
|
||||||
|
|
||||||
/* We should only deliver at passive */
|
/* We should only deliver at passive */
|
||||||
if (KeGetCurrentIrql() == PASSIVE_LEVEL)
|
if (KeGetCurrentIrql() == PASSIVE_LEVEL)
|
||||||
{
|
{
|
||||||
/* Raise to APC and Deliver APCs, then lower back to Passive */
|
/* Raise to APC and Deliver APCs, then lower back to Passive */
|
||||||
KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
KiDeliverApc(KernelMode, 0, 0);
|
KiDeliverApc(KernelMode, 0, 0);
|
||||||
KfLowerIrql(PASSIVE_LEVEL);
|
KeLowerIrql(PASSIVE_LEVEL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -769,6 +769,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
|
||||||
PVOID DriverBase;
|
PVOID DriverBase;
|
||||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||||
PULONG_PTR HardErrorParameters;
|
PULONG_PTR HardErrorParameters;
|
||||||
|
KIRQL OldIrql;
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
LONG i = 0;
|
LONG i = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1115,7 +1116,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
|
||||||
|
|
||||||
/* Raise IRQL to HIGH_LEVEL */
|
/* Raise IRQL to HIGH_LEVEL */
|
||||||
_disable();
|
_disable();
|
||||||
KfRaiseIrql(HIGH_LEVEL);
|
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Avoid recursion */
|
/* Avoid recursion */
|
||||||
if (!InterlockedDecrement((PLONG)&KeBugCheckCount))
|
if (!InterlockedDecrement((PLONG)&KeBugCheckCount))
|
||||||
|
@ -1137,13 +1138,13 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Display the BSOD */
|
/* 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,
|
KiDisplayBlueScreen(MessageId,
|
||||||
IsHardError,
|
IsHardError,
|
||||||
HardErrCaption,
|
HardErrCaption,
|
||||||
HardErrMessage,
|
HardErrMessage,
|
||||||
AnsiName);
|
AnsiName);
|
||||||
KfRaiseIrql(HIGH_LEVEL);
|
KeRaiseIrql(HIGH_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Check if the debugger is disabled but we can enable it */
|
/* Check if the debugger is disabled but we can enable it */
|
||||||
if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
|
if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
|
||||||
|
|
|
@ -145,17 +145,17 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
|
||||||
#error Not yet implemented!
|
#error Not yet implemented!
|
||||||
#else
|
#else
|
||||||
ULONG_PTR Status;
|
ULONG_PTR Status;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql, OldIrql2;
|
||||||
|
|
||||||
/* Raise to DPC level if required */
|
/* Raise to DPC level if required */
|
||||||
OldIrql = KeGetCurrentIrql();
|
OldIrql = KeGetCurrentIrql();
|
||||||
if (OldIrql < DISPATCH_LEVEL) OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
|
if (OldIrql < DISPATCH_LEVEL) KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Acquire the IPI lock */
|
/* Acquire the IPI lock */
|
||||||
KefAcquireSpinLockAtDpcLevel(&KiIpiLock);
|
KefAcquireSpinLockAtDpcLevel(&KiIpiLock);
|
||||||
|
|
||||||
/* Raise to IPI level */
|
/* Raise to IPI level */
|
||||||
KfRaiseIrql(IPI_LEVEL);
|
KeRaiseIrql(IPI_LEVEL, &OldIrql2);
|
||||||
|
|
||||||
/* Call the function */
|
/* Call the function */
|
||||||
Status = Function(Argument);
|
Status = Function(Argument);
|
||||||
|
@ -164,7 +164,7 @@ KeIpiGenericCall(IN PKIPI_BROADCAST_WORKER Function,
|
||||||
KefReleaseSpinLockFromDpcLevel(&KiIpiLock);
|
KefReleaseSpinLockFromDpcLevel(&KiIpiLock);
|
||||||
|
|
||||||
/* Lower IRQL back */
|
/* Lower IRQL back */
|
||||||
KfLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine,
|
||||||
PETHREAD Thread;
|
PETHREAD Thread;
|
||||||
PTEB Teb;
|
PTEB Teb;
|
||||||
BOOLEAN DeadThread = FALSE;
|
BOOLEAN DeadThread = FALSE;
|
||||||
|
KIRQL OldIrql;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
PSTRACE(PS_THREAD_DEBUG,
|
PSTRACE(PS_THREAD_DEBUG,
|
||||||
"StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
|
"StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
|
||||||
|
@ -68,7 +69,7 @@ PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Raise to APC */
|
/* Raise to APC */
|
||||||
KfRaiseIrql(APC_LEVEL);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
|
||||||
/* Queue the User APC */
|
/* Queue the User APC */
|
||||||
KiInitializeUserApc(NULL,
|
KiInitializeUserApc(NULL,
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
//
|
//
|
||||||
// For now, only supports 0-4 arguments
|
// 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" \
|
" swi #0x2E\n" \
|
||||||
" bx lr\n\n"
|
" bx lr\n\n"
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
#define KernelModeStub_mips " j KiSystemService\n" \
|
#define KernelModeStub_mips " j KiSystemService\n" \
|
||||||
" nop\n"
|
" nop\n"
|
||||||
|
|
||||||
#define KernelModeStub_arm " mov r12, #0x%x\n" \
|
#define KernelModeStub_arm " ldr r12, =x%x\n" \
|
||||||
" swi #0x2E\n" \
|
" swi #0x2E\n" \
|
||||||
" bx lr\n\n"
|
" bx lr\n\n"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue