Author: ros-arm-bringup
Date: Thu Feb 7 23:04:31 2008
New Revision: 32197
URL:
http://svn.reactos.org/svn/reactos?rev=32197&view=rev
Log:
We can now build the ARM kernel (but not link it).
We now define _disable and _enable for ARM.
We shouldn't define KeRaiseIrqlToSynchLevel for each architecture, since the prototype
is portable itself.
It was a mistake to guard against x86 only system calls -- the system calls should be the
same on all archs, just return STATUS_NOT_IMPLEMENTED if they don't make sense. Undo
the guards.
We now define KeGetPcr() as portable -- it's PCR itself that is a per-arch define.
We now support ARM in RtlWalkFrameChain.
We now support ARM in PspCreateThread.
We now define KeArchHaltProcessor for ARM by using Wait-For-Interrupt Mode.
We now define KeArmInitThreadWithContext for ARM.
KiRestore/SaveProcessorControlState are portable prototypes, we now define them as such.
Bochs KD code should use the portable WRITE/READ_PORT_UCHAR defines, we now do so.
We now support ARM in SharedUserData->ImageNumberLow/High during
ExpInitializeExecutive.
NtQuerySytemInformation for SystemProcessorInformation has now been fixed to use the
portable KeProcesssorXxx variables instead of reading from the non-portable PRCB values.
We now support NtFlushInstructionCache for ARM by flushing the I-Cache.
Added:
trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h (with props)
Modified:
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/ndk/arm/ketypes.h
trunk/reactos/include/ndk/i386/ketypes.h
trunk/reactos/include/ndk/kefuncs.h
trunk/reactos/include/ndk/ketypes.h
trunk/reactos/include/psdk/intrin_arm.h
trunk/reactos/include/psdk/winnt.h
trunk/reactos/include/reactos/armddk.h
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/i386/ke.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/kd/wrappers/bochs.c
trunk/reactos/ntoskrnl/mm/mminit.c
trunk/reactos/ntoskrnl/ps/thread.c
trunk/reactos/ntoskrnl/rtl/libsupp.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 23:04:31 2008
@@ -9495,12 +9495,6 @@
KeRaiseIrqlToDpcLevel(
VOID);
-NTHALAPI
-KIRQL
-DDKAPI
-KeRaiseIrqlToSynchLevel(
- VOID);
-
#define KeLowerIrql(a) KfLowerIrql(a)
#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
@@ -9587,14 +9581,15 @@
KeRaiseIrqlToDpcLevel(
VOID);
+#endif
+
NTKERNELAPI
KIRQL
DDKAPI
KeRaiseIrqlToSynchLevel(
VOID);
-#endif
-
+
/** Memory manager routines **/
NTKERNELAPI
Modified: trunk/reactos/include/ndk/arm/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/arm/ketypes.h?…
==============================================================================
--- trunk/reactos/include/ndk/arm/ketypes.h (original)
+++ trunk/reactos/include/ndk/arm/ketypes.h Thu Feb 7 23:04:31 2008
@@ -38,6 +38,11 @@
#define PRCB_MAJOR_VERSION 1
#define PRCB_BUILD_DEBUG 1
#define PRCB_BUILD_UNIPROCESSOR 2
+
+//
+// No LDTs on ARM
+//
+#define LDT_ENTRY ULONG
//
// HAL Variables
Modified: trunk/reactos/include/ndk/i386/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/ketypes.h…
==============================================================================
--- trunk/reactos/include/ndk/i386/ketypes.h (original)
+++ trunk/reactos/include/ndk/i386/ketypes.h Thu Feb 7 23:04:31 2008
@@ -28,9 +28,8 @@
//
#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
#define PCR ((volatile KPCR * const)K0IPCR)
-#if !defined(CONFIG_SMP) && !defined(NT_BUILD)
-#define KeGetPcr() PCR
-#else
+#if defined(CONFIG_SMP) || defined(NT_BUILD)
+#undef KeGetPcr()
#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
#endif
Modified: trunk/reactos/include/ndk/kefuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/kefuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/kefuncs.h (original)
+++ trunk/reactos/include/ndk/kefuncs.h Thu Feb 7 23:04:31 2008
@@ -457,7 +457,6 @@
IN KPROFILE_SOURCE ClockSource
);
-#ifdef _M_IX86
NTSYSCALLAPI
NTSTATUS
NTAPI
@@ -467,7 +466,6 @@
IN ULONG Selector2,
IN LDT_ENTRY LdtEntry2
);
-#endif
NTSYSCALLAPI
NTSTATUS
@@ -665,7 +663,6 @@
IN KPROFILE_SOURCE ClockSource
);
-#ifdef _M_IX86
NTSYSAPI
NTSTATUS
NTAPI
@@ -675,7 +672,6 @@
IN ULONG Selector2,
IN LDT_ENTRY LdtEntry2
);
-#endif
NTSYSAPI
NTSTATUS
Modified: trunk/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h (original)
+++ trunk/reactos/include/ndk/ketypes.h Thu Feb 7 23:04:31 2008
@@ -111,6 +111,11 @@
#else
#define KINTERRUPT_DISPATCH_CODES 106
#endif
+
+//
+// Get KPCR
+//
+#define KeGetPcr() PCR
#ifdef NTOS_MODE_USER
Modified: trunk/reactos/include/psdk/intrin_arm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/intrin_arm.h?…
==============================================================================
--- trunk/reactos/include/psdk/intrin_arm.h (original)
+++ trunk/reactos/include/psdk/intrin_arm.h Thu Feb 7 23:04:31 2008
@@ -148,5 +148,25 @@
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
}
+static __inline__ __attribute__((always_inline)) void _disable(void)
+{
+ __asm__ __volatile__
+ (
+ "mrs r1, cpsr;"
+ "orr r1, r1, #0x80;"
+ "msr cpsr, r1;"
+ );
+}
+
+static __inline__ __attribute__((always_inline)) void _enable(void)
+{
+ __asm__ __volatile__
+ (
+ "mrs r1, cpsr;"
+ "bic r1, r1, #0x80;"
+ "msr cpsr, r1;"
+ );
+}
+
#endif
/* EOF */
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=3…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Thu Feb 7 23:04:31 2008
@@ -4108,6 +4108,7 @@
//
// NT-ARM is not documented
//
+#define KIRQL ULONG // Hack!
#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 23:04:31 2008
@@ -103,16 +103,12 @@
//
// IRQL Support on ARM is similar to MIPS/ALPHA
//
-NTKERNELAPI
KIRQL
-DDKAPI
KeSwapIrql(
IN KIRQL NewIrql
);
-NTKERNELAPI
KIRQL
-NTAPI
KeRaiseIrqlToDpcLevel(
VOID
);
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=321…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c (original)
+++ trunk/reactos/ntoskrnl/ex/init.c Thu Feb 7 23:04:31 2008
@@ -1229,6 +1229,9 @@
#elif defined(_MIPS_)
SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_R4000;
SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_R4000;
+#elif defined(_ARM_)
+ SharedUserData->ImageNumberLow = IMAGE_FILE_MACHINE_ARM;
+ SharedUserData->ImageNumberHigh = IMAGE_FILE_MACHINE_ARM;
#else
#error "Unsupported ReactOS Target"
#endif
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c Thu Feb 7 23:04:31 2008
@@ -531,11 +531,11 @@
return (STATUS_INFO_LENGTH_MISMATCH);
}
Prcb = KeGetCurrentPrcb();
- Spi->ProcessorArchitecture = 0; /* Intel Processor */
- Spi->ProcessorLevel = Prcb->CpuType;
- Spi->ProcessorRevision = Prcb->CpuStep;
+ Spi->ProcessorArchitecture = KeProcessorArchitecture;
+ Spi->ProcessorLevel = KeProcessorLevel;
+ Spi->ProcessorRevision = KeProcessorRevision;
Spi->Reserved = 0;
- Spi->ProcessorFeatureBits = Prcb->FeatureBits;
+ Spi->ProcessorFeatureBits = KeFeatureBits;
DPRINT("Arch %d Level %d Rev 0x%x\n", Spi->ProcessorArchitecture,
Spi->ProcessorLevel, Spi->ProcessorRevision);
@@ -1927,6 +1927,8 @@
#elif defined(_M_MIPS)
DPRINT1("NtFlushInstructionCache() is not implemented\n");
for (;;);
+#elif defined(_M_ARM)
+ __asm__ __volatile__("mov r1, #0; mcr p15, 0, r1, c7, c5, 0");
#else
#error Unknown architecture
#endif
Modified: trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/arch/intrin_i.h Thu Feb 7 23:04:31 2008
@@ -26,9 +26,7 @@
#elif defined(_M_MIPS)
#include "../mips/intrin_i.h"
#elif defined(_M_ARM)
-//
-// Not sure we'll need ARM internal intrinsics
-//
+#include "../arm/intrin_i.h"
#else
#error "Unknown processor"
#endif
Added: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h (added)
+++ trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h Thu Feb 7 23:04:31 2008
@@ -1,0 +1,18 @@
+#ifndef _INTRIN_INTERNAL_
+#define _INTRIN_INTERNAL_
+
+static __inline__ __attribute__((always_inline)) void KeArchHaltProcessor(void)
+{
+ //
+ // Enter Wait-For-Interrupt Mode
+ //
+ __asm__ __volatile__
+ (
+ "mov r1, #0;"
+ "mcr p15, 0, r1, c7, c0, 4;"
+ );
+}
+
+#endif
+
+/* EOF */
Propchange: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/ntoskrnl/include/internal/arm/intrin_i.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h Thu Feb 7 23:04:31 2008
@@ -1,1 +1,20 @@
+#ifndef __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
+#define __NTOSKRNL_INCLUDE_INTERNAL_ARM_KE_H
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+VOID
+NTAPI
+KeArmInitThreadWithContext(
+ IN PKTHREAD Thread,
+ IN PKSYSTEM_ROUTINE SystemRoutine,
+ IN PKSTART_ROUTINE StartRoutine,
+ IN PVOID StartContext,
+ IN PCONTEXT Context
+);
+
+#define KeArchInitThreadWithContext KeArmInitThreadWithContext
+
+#endif
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h Thu Feb 7 23:04:31 2008
@@ -59,18 +59,6 @@
IN PKTSS Tss,
IN PKIDTENTRY Idt,
IN PKGDTENTRY Gdt
-);
-
-VOID
-NTAPI
-KiRestoreProcessorControlState(
- IN PKPROCESSOR_STATE ProcessorState
-);
-
-VOID
-NTAPI
-KiSaveProcessorControlState(
- OUT PKPROCESSOR_STATE ProcessorState
);
VOID
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h Thu Feb 7 23:04:31 2008
@@ -972,6 +972,18 @@
IN OUT PKSPIN_LOCK_QUEUE LockQueue
);
+VOID
+NTAPI
+KiRestoreProcessorControlState(
+ IN PKPROCESSOR_STATE ProcessorState
+);
+
+VOID
+NTAPI
+KiSaveProcessorControlState(
+ OUT PKPROCESSOR_STATE ProcessorState
+);
+
#include "ke_x.h"
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */
Modified: trunk/reactos/ntoskrnl/kd/wrappers/bochs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/wrappers/bochs…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/wrappers/bochs.c (original)
+++ trunk/reactos/ntoskrnl/kd/wrappers/bochs.c Thu Feb 7 23:04:31 2008
@@ -12,7 +12,7 @@
#include <internal/debug.h>
/* bochs debug output */
-#define BOCHS_LOGGER_PORT (0xe9)
+#define BOCHS_LOGGER_PORT ((PVOID)0xe9)
/* FUNCTIONS *****************************************************************/
@@ -27,9 +27,9 @@
{
if (*Message == '\n')
{
- __outbyte(BOCHS_LOGGER_PORT, '\r');
+ WRITE_PORT_UCHAR(BOCHS_LOGGER_PORT, '\r');
}
- __outbyte(BOCHS_LOGGER_PORT, *Message);
+ WRITE_PORT_UCHAR(BOCHS_LOGGER_PORT, *Message);
Message++;
}
}
@@ -44,8 +44,8 @@
if (BootPhase == 0)
{
- Value = __inbyte(BOCHS_LOGGER_PORT);
- if (Value != BOCHS_LOGGER_PORT)
+ Value = READ_PORT_UCHAR(BOCHS_LOGGER_PORT);
+ if (Value != (ULONG)BOCHS_LOGGER_PORT)
{
KdpDebugMode.Bochs = FALSE;
return;
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=3…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c Thu Feb 7 23:04:31 2008
@@ -112,7 +112,7 @@
*/
MiInitPageDirectoryMap();
- BaseAddress = (PVOID)KIP0PCRADDRESS;
+ BaseAddress = (PVOID)PCR;
MmCreateMemoryArea(MmGetKernelAddressSpace(),
MEMORY_AREA_SYSTEM,
&BaseAddress,
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 23:04:31 2008
@@ -325,10 +325,14 @@
Thread->StartAddress = (PVOID)ThreadContext->Eip;
Thread->Win32StartAddress = (PVOID)ThreadContext->Eax;
#elif defined(_M_PPC)
- Thread->StartAddress = (PVOID)ThreadContext->Dr0;
- Thread->Win32StartAddress = (PVOID)ThreadContext->Gpr3;
+ Thread->StartAddress = (PVOID)ThreadContext->Dr0;
+ Thread->Win32StartAddress = (PVOID)ThreadContext->Gpr3;
#elif defined(_M_MIPS)
- for (;;);
+ Thread->StartAddress = (PVOID)ThreadContext->Psr;
+ Thread->Win32StartAddress = (PVOID)ThreadContext->IntA0;
+#elif defined(_M_ARM)
+ Thread->StartAddress = (PVOID)ThreadContext->Pc;
+ Thread->Win32StartAddress = (PVOID)ThreadContext->R0;
#else
#error Unknown architecture
#endif
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/libsupp.c (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c Thu Feb 7 23:04:31 2008
@@ -284,6 +284,8 @@
__asm__("move $sp, %0" : "=r" (Stack) : );
#elif defined(_M_PPC)
__asm__("mr %0,1" : "=r" (Stack) : );
+#elif defined(_M_ARM)
+ __asm__("mov sp, %0" : "=r"(Stack) : );
#else
#error Unknown architecture
#endif