Author: ros-arm-bringup
Date: Mon Mar 10 21:45:13 2008
New Revision: 32653
URL:
http://svn.reactos.org/svn/reactos?rev=3D32653&view=3Drev
Log:
- Fix incorrect definition of PCR and USERPCR which was making us incorrect=
memory.
- Fix incorrect definition of ARM_CONTROL_REGISTER, which was stopping us f=
rom correctly enabling High Vectors.
- The RtlCaptureStackLimits and RtlWakeChainFrame routines in libsupp.c can=
not possibly be portable across all architectures -- separated ARM versions=
in an arm directory.
- Setup the panic stack for abort/undefined exceptions, and the interrupt s=
tack for FIQs.
- Implement support for exceptions! We can now display the address which ca=
used a data abort, and begin handling exceptions.
- Implement all the HAL Spinlock/IRQL functions except KfRaise/LowerIrql wh=
ich actually do the work.
- We're booting all the way to setting up the user_shared_data memory area.
Added:
trunk/reactos/ntoskrnl/ke/arm/trap.s (with props)
trunk/reactos/ntoskrnl/ke/arm/trapc.c (with props)
trunk/reactos/ntoskrnl/rtl/arm/
trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c (with props)
Modified:
trunk/reactos/include/reactos/armddk.h
trunk/reactos/ntoskrnl/include/internal/arm/ke.h
trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h
trunk/reactos/ntoskrnl/ke/arm/boot.s
trunk/reactos/ntoskrnl/ke/arm/kiinit.c
trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
trunk/reactos/ntoskrnl/rtl/libsupp.c
Modified: trunk/reactos/include/reactos/armddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/armdd=
k.h?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/include/reactos/armddk.h (original)
+++ trunk/reactos/include/reactos/armddk.h Mon Mar 10 21:45:13 2008
@@ -20,8 +20,8 @@
#define KIPCR 0xFFFFF000
#define KI_USER_SHARED_DATA 0xFFFFE000
#define USPCR 0x7FFF0000
-#define PCR ((volatile KPCR * const)USPCR)
-#define USERPCR ((volatile KPCR * const)KIPCR)
+#define PCR ((volatile KPCR * const)KIPCR)
+#define USERPCR ((volatile KPCR * const)USPCR)
=
//
// Maximum IRQs
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/inte=
rnal/arm/ke.h?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/include/internal/arm/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ke.h Mon Mar 10 21:45:13 20=
08
@@ -55,7 +55,7 @@
ULONG MmuEnabled:1;
ULONG AlignmentFaultsEnabled:1;
ULONG DCacheEnabled:1;
- ULONG Sbo:3;
+ ULONG Sbo:4;
ULONG BigEndianEnabled:1;
ULONG System:1;
ULONG Rom:1;
Modified: trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/inte=
rnal/arm/ksarm.h?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/ksarm.h Mon Mar 10 21:45:13=
2008
@@ -1,9 +1,15 @@
/*
* CPSR Values
*/
+.equ CPSR_THUMB_ENABLE, 0x20 =
+.equ CPSR_FIQ_DISABLE, 0x40
.equ CPSR_IRQ_DISABLE, 0x80
-.equ CPSR_FIQ_DISABLE, 0x40
-.equ CPSR_THUMB_ENABLE, 0x20 =
+.equ CPSR_FIQ_MODE, 0x11
+.equ CPSR_IRQ_MODE, 0x12
+.equ CPSR_SVC_MODE, 0x13
+.equ CPSR_ABORT_MODE, 0x17
+.equ CPSR_UND_MODE, 0x1B
+
=
/*
* C1 Register Values
@@ -18,6 +24,14 @@
* Loader Parameter Block Offsets
*/
.equ LpbKernelStack, 0x18
+.equ LpbPanicStack, 0x74
+.equ LpbInterruptStack, 0x5C
+
+/*
+ * Trap Frame offsets
+ */
+.equ TrR0, 0x00
+.equ TrapFrameLength, 0x144
=
/*
* PCR
Modified: trunk/reactos/ntoskrnl/ke/arm/boot.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/boot.=
s?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/ke/arm/boot.s (original)
+++ trunk/reactos/ntoskrnl/ke/arm/boot.s Mon Mar 10 21:45:13 2008
@@ -15,6 +15,52 @@
PROLOG_END KiSystemStartup
=
//
+ // Put us in FIQ mode
+ //
+ mrs r3, cpsr
+ orr r3, r1, #CPSR_FIQ_MODE
+ msr cpsr, r3
+ =
+ //
+ // Set FIQ stack and registers
+ //
+ ldr sp, [a2, #LpbInterruptStack]
+ mov r8, #0
+ mov r9, #0
+ mov r10, #0
+ =
+ //
+ // Put us in ABORT mode
+ //
+ mrs r3, cpsr
+ orr r3, r1, #CPSR_ABORT_MODE
+ msr cpsr, r3
+ =
+ //
+ // Set panic stack
+ //
+ ldr sp, [a2, #LpbPanicStack]
+ =
+ //
+ // Put us in UND (Undefined) mode
+ //
+ mrs r3, cpsr
+ orr r3, r1, #CPSR_UND_MODE
+ msr cpsr, r3
+ =
+ //
+ // Set panic stack
+ //
+ ldr sp, [a2, #LpbPanicStack]
+ =
+ //
+ // Put us into SVC (Supervisor) mode
+ //
+ mrs r3, cpsr
+ orr r3, r1, #CPSR_SVC_MODE
+ msr cpsr, r3
+
+ //
// Switch to boot kernel stack
//
ldr sp, [a2, #LpbKernelStack]
Modified: trunk/reactos/ntoskrnl/ke/arm/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/kiini=
t.c?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/ke/arm/kiinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/arm/kiinit.c Mon Mar 10 21:45:13 2008
@@ -18,6 +18,7 @@
BOOLEAN KeIsArmV6;
ULONG KeNumberProcessIds;
ULONG KeNumberTbEntries;
+extern PVOID KiArmVectorTable;
#define __ARMV6__ KeIsArmV6
=
/* FUNCTIONS *************************************************************=
*****/
@@ -298,6 +299,7 @@
{
ARM_PTE Pte;
PKPCR Pcr;
+ ARM_CONTROL_REGISTER ControlRegister;
DPRINT1("-----------------------------------------------------\n");
DPRINT1("ReactOS-ARM "KERNEL_VERSION_STR" (Build
"KERNEL_VERSION_BUILD=
_STR")\n");
DPRINT1("Command Line: %s\n", LoaderBlock->LoadOptions);
@@ -468,6 +470,18 @@
Pcr->SystemReserved[0] =3D KeArmControlRegisterGet().AsUlong;
=
//
+ // Set the exception address to high
+ //
+ ControlRegister =3D KeArmControlRegisterGet();
+ ControlRegister.HighVectors =3D TRUE;
+ KeArmControlRegisterSet(ControlRegister);
+ =
+ //
+ // Setup the exception vector table
+ //
+ RtlCopyMemory((PVOID)0xFFFF0000, &KiArmVectorTable, 14 * sizeof(PVOID)=
);
+
+ //
// Initialize the rest of the kernel now
//
KiInitializeKernel((PKPROCESS)LoaderBlock->Process,
Added: trunk/reactos/ntoskrnl/ke/arm/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trap.=
s?rev=3D32653&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/ke/arm/trap.s (added)
+++ trunk/reactos/ntoskrnl/ke/arm/trap.s Mon Mar 10 21:45:13 2008
@@ -1,0 +1,123 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/ke/arm/trap.s
+ * PURPOSE: Support for exceptions and interrupts on ARM machines
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+ .title "ARM Trap Dispatching and Handling"
+ .include "ntoskrnl/include/internal/arm/kxarm.h"
+ .include "ntoskrnl/include/internal/arm/ksarm.h"
+
+ .global KiArmVectorTable
+ KiArmVectorTable:
+ b . // Reset
+ ldr pc, _KiUndefinedInstructionJump // Undefined Instruction
+ ldr pc, _KiSoftwareInterruptJump // Software Interrupt
+ ldr pc, _KiPrefetchAbortJump // Prefetch Abort
+ ldr pc, _KiDataAbortJump // Data Abort
+ ldr pc, _KiReservedJump // Reserved
+ ldr pc, _KiInterruptJump // Interrupt
+ ldr pc, _KiFastInterruptJump // Fast Interrupt
+ =
+ _KiUndefinedInstructionJump: .word KiUndefinedInstructionException
+ _KiSoftwareInterruptJump: .word KiSoftwareInterruptException
+ _KiPrefetchAbortJump: .word KiPrefetchAbortException
+ _KiDataAbortJump: .word KiDataAbortException
+ _KiReservedJump: .word KiReservedException
+ _KiInterruptJump: .word KiInterruptException
+ _KiFastInterruptJump: .word KiFastInterruptException
+
+ TEXTAREA
+ NESTED_ENTRY KiUndefinedInstructionException
+ PROLOG_END KiUndefinedInstructionException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiUndefinedInstructionException
+ =
+ NESTED_ENTRY KiSoftwareInterruptException
+ PROLOG_END KiSoftwareInterruptException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiSoftwareInterruptException
+
+ NESTED_ENTRY KiPrefetchAbortException
+ PROLOG_END KiPrefetchAbortException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiPrefetchAbortException
+
+ NESTED_ENTRY KiDataAbortException
+ PROLOG_END KiDataAbortException
+
+ //
+ // Save space for trap frame
+ //
+ sub sp, #TrapFrameLength
+ =
+ //
+ // Build the register part of the trap frame
+ //
+ stm sp, {r0-r15}
+
+ //
+ // TOOD: We'll worry about the rest later...
+ //
+ =
+ //
+ // Call the C handler
+ //
+ mov a1, sp
+ b KiDataAbortHandler
+
+ //
+ // Restore state
+ //
+ b .
+ =
+ ENTRY_END KiDataAbortException
+
+ NESTED_ENTRY KiInterruptException
+ PROLOG_END KiInterruptException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiInterruptException
+
+ NESTED_ENTRY KiFastInterruptException
+ PROLOG_END KiFastInterruptException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiFastInterruptException
+ =
+
+ NESTED_ENTRY KiReservedException
+ PROLOG_END KiReservedException
+ =
+ //
+ // FIXME: TODO
+ //
+ b .
+ =
+ ENTRY_END KiReservedException
+
Propchange: trunk/reactos/ntoskrnl/ke/arm/trap.s
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Propchange: trunk/reactos/ntoskrnl/ke/arm/trap.s
---------------------------------------------------------------------------=
---
svn:mime-type =3D text/plain
Added: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc=
.c?rev=3D32653&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c (added)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c Mon Mar 10 21:45:13 2008
@@ -1,0 +1,27 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/ke/arm/trapc.c
+ * PURPOSE: Implements the various trap handlers for ARM exceptions
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+/* INCLUDES **************************************************************=
*****/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ***************************************************************=
*****/
+
+/* FUNCTIONS *************************************************************=
*****/
+
+NTSTATUS
+KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame)
+{
+ DPRINT1("Data Abort (%p) @ %p\n", TrapFrame, TrapFrame->Lr - 8);
+ =
+ while (TRUE);
+ return STATUS_SUCCESS;
+}
+
Propchange: trunk/reactos/ntoskrnl/ke/arm/trapc.c
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Propchange: trunk/reactos/ntoskrnl/ke/arm/trapc.c
---------------------------------------------------------------------------=
---
svn:mime-type =3D text/plain
Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-gen=
eric.rbuild?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild Mon Mar 10 21:45:13 2008
@@ -67,6 +67,8 @@
<file>stubs_asm.s</file>
<file>stubs.c</file>
<file>thrdini.c</file>
+ <file>trap.s</file>
+ <file>trapc.c</file>
</directory>
</if>
<if property=3D"ARCH" value=3D"powerpc">
@@ -413,6 +415,11 @@
<file>win32.c</file>
</directory>
<directory name=3D"rtl">
+ <if property=3D"ARCH" value=3D"arm">
+ <directory name=3D"arm">
+ <file>rtlexcpt.c</file>
+ </directory>
+ </if>
<file>libsupp.c</file>
<file>misc.c</file>
<file>strtok.c</file>
Added: trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/arm/rtle=
xcpt.c?rev=3D32653&view=3Dauto
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c (added)
+++ trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c Mon Mar 10 21:45:13 2008
@@ -1,0 +1,41 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: ntoskrnl/rtl/libsupp.c
+ * PURPOSE: RTL Support Routines
+ * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net)
+ * Gunnar Dalsnes
+ */
+
+/* INCLUDES **************************************************************=
****/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <internal/debug.h>
+
+/* FUNCTIONS *************************************************************=
****/
+
+BOOLEAN
+NTAPI
+RtlpCaptureStackLimits(IN ULONG_PTR Ebp,
+ IN ULONG_PTR *StackBegin,
+ IN ULONG_PTR *StackEnd)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+/*
+ * @unimplemented
+ */
+ULONG
+NTAPI
+RtlWalkFrameChain(OUT PVOID *Callers,
+ IN ULONG Count,
+ IN ULONG Flags)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+/* EOF */
Propchange: trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c
---------------------------------------------------------------------------=
---
svn:eol-style =3D native
Propchange: trunk/reactos/ntoskrnl/rtl/arm/rtlexcpt.c
---------------------------------------------------------------------------=
---
svn:mime-type =3D text/plain
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.=
c?rev=3D32653&r1=3D32652&r2=3D32653&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/ntoskrnl/rtl/libsupp.c (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c Mon Mar 10 21:45:13 2008
@@ -210,6 +210,8 @@
/* Not in DPC stack */
return FALSE;
}
+
+#ifndef _ARM_
=
BOOLEAN
NTAPI
@@ -400,6 +402,8 @@
return i;
}
=
+#endif
+
/* RTL Atom Tables *******************************************************=
*****/
=
NTSTATUS