We now generate the correct ARM syscall stub code for system calls with IDs > 0x100.
authorReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Thu, 7 Feb 2008 07:10:13 +0000 (07:10 +0000)
committerReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Thu, 7 Feb 2008 07:10:13 +0000 (07:10 +0000)
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

12 files changed:
reactos/include/ddk/winddk.h
reactos/include/reactos/armddk.h
reactos/ntoskrnl/ex/fmutex.c
reactos/ntoskrnl/ex/shutdown.c
reactos/ntoskrnl/inbv/inbv.c
reactos/ntoskrnl/io/iomgr/file.c
reactos/ntoskrnl/io/iomgr/irp.c
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/ipi.c
reactos/ntoskrnl/ps/thread.c
reactos/tools/nci/ncitool.c

index 6abd2ae..d266b31 100644 (file)
@@ -9561,6 +9561,10 @@ KIRQL
 DDKAPI
 KeRaiseIrqlToSynchLevel(
     VOID);
+    
+#elif defined(_M_ARM)
+    
+#include <armddk.h>
 
 #else
 
index 4110279..f5277a8 100644 (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
index 7eb44e5..4b22f8b 100644 (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;
     }
 }
index b1f6d9f..08ac178 100644 (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
index 9fcba6a..dabb00b 100644 (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
index 7f3e072..da7dfce 100644 (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);
         }
     }
 
index 7cb53c3..f09032e 100644 (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);
 }
 
 /*
index 81d4ecf..6ec3996 100644 (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
     {
index bea86aa..b90e0d5 100644 (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))
index 99d2ac2..d7d1c2a 100644 (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
 }
index ab8b563..db48805 100644 (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,
index 9fbfa6a..99e0334 100644 (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"
 
 #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"