Author: ros-arm-bringup
Date: Thu Feb 7 10:10:13 2008
New Revision: 32179
URL:
http://svn.reactos.org/svn/reactos?rev=32179&view=rev
Log:
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.
Modified:
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/reactos/armddk.h
trunk/reactos/ntoskrnl/ex/fmutex.c
trunk/reactos/ntoskrnl/ex/shutdown.c
trunk/reactos/ntoskrnl/inbv/inbv.c
trunk/reactos/ntoskrnl/io/iomgr/file.c
trunk/reactos/ntoskrnl/io/iomgr/irp.c
trunk/reactos/ntoskrnl/ke/apc.c
trunk/reactos/ntoskrnl/ke/bug.c
trunk/reactos/ntoskrnl/ke/ipi.c
trunk/reactos/ntoskrnl/ps/thread.c
trunk/reactos/tools/nci/ncitool.c
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=3…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h (original)
+++ trunk/reactos/include/ddk/winddk.h Thu Feb 7 10:10:13 2008
@@ -9561,6 +9561,10 @@
DDKAPI
KeRaiseIrqlToSynchLevel(
VOID);
+
+#elif defined(_M_ARM)
+
+#include <armddk.h>
#else
Modified: trunk/reactos/include/reactos/armddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/armddk.h?r…
==============================================================================
--- trunk/reactos/include/reactos/armddk.h (original)
+++ trunk/reactos/include/reactos/armddk.h Thu Feb 7 10:10:13 2008
@@ -100,4 +100,24 @@
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
Modified: trunk/reactos/ntoskrnl/ex/fmutex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/fmutex.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/fmutex.c (original)
+++ trunk/reactos/ntoskrnl/ex/fmutex.c Thu Feb 7 10:10:13 2008
@@ -109,7 +109,7 @@
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 @@
}
/* Lower IRQL back */
- KfLowerIrql(OldIrql);
+ KeLowerIrql(OldIrql);
}
/*
@@ -181,7 +181,7 @@
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 @@
else
{
/* Acquire attempt failed */
- KfLowerIrql(OldIrql);
+ KeLowerIrql(OldIrql);
return FALSE;
}
}
Modified: trunk/reactos/ntoskrnl/ex/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/shutdown.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/shutdown.c (original)
+++ trunk/reactos/ntoskrnl/ex/shutdown.c Thu Feb 7 10:10:13 2008
@@ -29,13 +29,14 @@
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
Modified: trunk/reactos/ntoskrnl/inbv/inbv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbv.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/inbv/inbv.c (original)
+++ trunk/reactos/ntoskrnl/inbv/inbv.c Thu Feb 7 10:10:13 2008
@@ -157,7 +157,7 @@
if (InbvOldIrql < DISPATCH_LEVEL)
{
/* Raise IRQL to dispatch level */
- InbvOldIrql = KfRaiseIrql(DISPATCH_LEVEL);
+ KeRaiseIrql(DISPATCH_LEVEL, &InbvOldIrql);
}
/* Acquire the lock */
@@ -172,7 +172,7 @@
KiReleaseSpinLock(&BootDriverLock);
/* If we were below dispatch level, lower IRQL back */
- if (InbvOldIrql < DISPATCH_LEVEL) KfLowerIrql(InbvOldIrql);
+ if (InbvOldIrql < DISPATCH_LEVEL) KeLowerIrql(InbvOldIrql);
}
VOID
Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c Thu Feb 7 10:10:13 2008
@@ -2748,7 +2748,7 @@
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 @@
}
/* Lower the IRQL */
- KfLowerIrql(OldIrql);
+ KeLowerIrql(OldIrql);
/* Check if we had found an IRP */
if (OurIrpsInList)
@@ -2791,7 +2791,7 @@
OurIrpsInList = FALSE;
/* Raise IRQL */
- OldIrql = KfRaiseIrql(APC_LEVEL);
+ KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Now loop the list again */
NextEntry = ListHead->Flink;
@@ -2811,7 +2811,7 @@
}
/* Lower the IRQL */
- KfLowerIrql(OldIrql);
+ KeLowerIrql(OldIrql);
}
}
Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c Thu Feb 7 10:10:13 2008
@@ -1021,7 +1021,7 @@
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 @@
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 @@
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);
}
/*
Modified: trunk/reactos/ntoskrnl/ke/apc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/apc.c?rev=3217…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/apc.c (original)
+++ trunk/reactos/ntoskrnl/ke/apc.c Thu Feb 7 10:10:13 2008
@@ -35,13 +35,15 @@
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
{
Modified: trunk/reactos/ntoskrnl/ke/bug.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=3217…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/bug.c (original)
+++ trunk/reactos/ntoskrnl/ke/bug.c Thu Feb 7 10:10:13 2008
@@ -769,6 +769,7 @@
PVOID DriverBase;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PULONG_PTR HardErrorParameters;
+ KIRQL OldIrql;
#ifdef CONFIG_SMP
LONG i = 0;
#endif
@@ -1115,7 +1116,7 @@
/* Raise IRQL to HIGH_LEVEL */
_disable();
- KfRaiseIrql(HIGH_LEVEL);
+ KeRaiseIrql(HIGH_LEVEL, &OldIrql);
/* Avoid recursion */
if (!InterlockedDecrement((PLONG)&KeBugCheckCount))
@@ -1137,13 +1138,13 @@
#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))
Modified: trunk/reactos/ntoskrnl/ke/ipi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/ipi.c?rev=3217…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/ipi.c (original)
+++ trunk/reactos/ntoskrnl/ke/ipi.c Thu Feb 7 10:10:13 2008
@@ -145,17 +145,17 @@
#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 @@
KefReleaseSpinLockFromDpcLevel(&KiIpiLock);
/* Lower IRQL back */
- KfLowerIrql(OldIrql);
+ KeLowerIrql(OldIrql);
return Status;
#endif
}
Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c Thu Feb 7 10:10:13 2008
@@ -29,6 +29,7 @@
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 @@
}
/* Raise to APC */
- KfRaiseIrql(APC_LEVEL);
+ KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Queue the User APC */
KiInitializeUserApc(NULL,
Modified: trunk/reactos/tools/nci/ncitool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/ncitool.c?rev=32…
==============================================================================
--- trunk/reactos/tools/nci/ncitool.c (original)
+++ trunk/reactos/tools/nci/ncitool.c Thu Feb 7 10:10:13 2008
@@ -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"