mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
- Fix incorrect definition of PCR and USERPCR which was making us incorrect memory.
- Fix incorrect definition of ARM_CONTROL_REGISTER, which was stopping us from correctly enabling High Vectors. - The RtlCaptureStackLimits and RtlWakeChainFrame routines in libsupp.c cannot possibly be portable across all architectures -- separated ARM versions in an arm directory. - Setup the panic stack for abort/undefined exceptions, and the interrupt stack for FIQs. - Implement support for exceptions! We can now display the address which caused a data abort, and begin handling exceptions. - Implement all the HAL Spinlock/IRQL functions except KfRaise/LowerIrql which actually do the work. - We're booting all the way to setting up the user_shared_data memory area. svn path=/trunk/; revision=32653
This commit is contained in:
parent
cfb18d14ea
commit
a6b9a98b82
|
@ -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
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef union _ARM_CONTROL_REGISTER
|
|||
ULONG MmuEnabled:1;
|
||||
ULONG AlignmentFaultsEnabled:1;
|
||||
ULONG DCacheEnabled:1;
|
||||
ULONG Sbo:3;
|
||||
ULONG Sbo:4;
|
||||
ULONG BigEndianEnabled:1;
|
||||
ULONG System:1;
|
||||
ULONG Rom:1;
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
/*
|
||||
* CPSR Values
|
||||
*/
|
||||
.equ CPSR_IRQ_DISABLE, 0x80
|
||||
.equ CPSR_FIQ_DISABLE, 0x40
|
||||
.equ CPSR_THUMB_ENABLE, 0x20
|
||||
.equ CPSR_FIQ_DISABLE, 0x40
|
||||
.equ CPSR_IRQ_DISABLE, 0x80
|
||||
.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
|
||||
|
|
|
@ -14,6 +14,52 @@
|
|||
NESTED_ENTRY KiSystemStartup
|
||||
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
|
||||
//
|
||||
|
|
|
@ -18,6 +18,7 @@ KINTERRUPT KxUnexpectedInterrupt;
|
|||
BOOLEAN KeIsArmV6;
|
||||
ULONG KeNumberProcessIds;
|
||||
ULONG KeNumberTbEntries;
|
||||
extern PVOID KiArmVectorTable;
|
||||
#define __ARMV6__ KeIsArmV6
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
@ -298,6 +299,7 @@ KiInitializeSystem(IN ULONG Magic,
|
|||
{
|
||||
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);
|
||||
|
@ -467,6 +469,18 @@ KiInitializeSystem(IN ULONG Magic,
|
|||
Pcr->ProcessorId = KeArmIdCodeRegisterGet().AsUlong;
|
||||
Pcr->SystemReserved[0] = KeArmControlRegisterGet().AsUlong;
|
||||
|
||||
//
|
||||
// Set the exception address to high
|
||||
//
|
||||
ControlRegister = KeArmControlRegisterGet();
|
||||
ControlRegister.HighVectors = TRUE;
|
||||
KeArmControlRegisterSet(ControlRegister);
|
||||
|
||||
//
|
||||
// Setup the exception vector table
|
||||
//
|
||||
RtlCopyMemory((PVOID)0xFFFF0000, &KiArmVectorTable, 14 * sizeof(PVOID));
|
||||
|
||||
//
|
||||
// Initialize the rest of the kernel now
|
||||
//
|
||||
|
|
123
reactos/ntoskrnl/ke/arm/trap.s
Normal file
123
reactos/ntoskrnl/ke/arm/trap.s
Normal file
|
@ -0,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
|
||||
|
27
reactos/ntoskrnl/ke/arm/trapc.c
Normal file
27
reactos/ntoskrnl/ke/arm/trapc.c
Normal file
|
@ -0,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;
|
||||
}
|
||||
|
|
@ -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="ARCH" value="powerpc">
|
||||
|
@ -413,6 +415,11 @@
|
|||
<file>win32.c</file>
|
||||
</directory>
|
||||
<directory name="rtl">
|
||||
<if property="ARCH" value="arm">
|
||||
<directory name="arm">
|
||||
<file>rtlexcpt.c</file>
|
||||
</directory>
|
||||
</if>
|
||||
<file>libsupp.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>strtok.c</file>
|
||||
|
|
41
reactos/ntoskrnl/rtl/arm/rtlexcpt.c
Normal file
41
reactos/ntoskrnl/rtl/arm/rtlexcpt.c
Normal file
|
@ -0,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@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 */
|
|
@ -211,6 +211,8 @@ RtlpHandleDpcStackException(IN PEXCEPTION_REGISTRATION_RECORD RegistrationFrame,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef _ARM_
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
RtlpCaptureStackLimits(IN ULONG_PTR Ebp,
|
||||
|
@ -400,6 +402,8 @@ RtlWalkFrameChain(OUT PVOID *Callers,
|
|||
return i;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* RTL Atom Tables ************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
|
|
Loading…
Reference in a new issue