mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
Add /arm tree for Memory Manager and stub MmUpdatePageDir in C.
Add exp.c for ARM. Stub out KeContextToTrapFrame in C. Add thrdini.c for ARM and implement KeArmInitThreadWithContext -- may require changes if the exception frame structure isn't preserving all we need. Stub out KiThreadStartup in C. svn path=/trunk/; revision=32341
This commit is contained in:
parent
a177849941
commit
e31c6ada8e
30
reactos/ntoskrnl/ke/arm/exp.c
Normal file
30
reactos/ntoskrnl/ke/arm/exp.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Kernel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: ntoskrnl/ke/arm/exp.c
|
||||
* PURPOSE: Implements exception helper routines for ARM machines
|
||||
* PROGRAMMERS: ReactOS Portable Systems Group
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KeContextToTrapFrame(IN PCONTEXT Context,
|
||||
IN OUT PKEXCEPTION_FRAME ExceptionFrame,
|
||||
IN OUT PKTRAP_FRAME TrapFrame,
|
||||
IN ULONG ContextFlags,
|
||||
IN KPROCESSOR_MODE PreviousMode)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return;
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
#include <internal/arm/asmmacro.S>
|
||||
|
||||
GENERATE_ARM_STUB KiSwapContext
|
||||
GENERATE_ARM_STUB DbgBreakPointWithStatus
|
||||
//
|
||||
// Interlocked APIs
|
||||
//
|
||||
GENERATE_ARM_STUB ExInterlockedAddLargeInteger
|
||||
GENERATE_ARM_STUB ExInterlockedAddLargeStatistic
|
||||
GENERATE_ARM_STUB ExInterlockedAddUlong
|
||||
|
@ -37,6 +38,66 @@ GENERATE_ARM_STUB InterlockedExchangeAdd
|
|||
GENERATE_ARM_STUB InterlockedIncrement
|
||||
GENERATE_ARM_STUB InterlockedPopEntrySList
|
||||
GENERATE_ARM_STUB InterlockedPushEntrySList
|
||||
|
||||
//
|
||||
// Port I/O and Register Access
|
||||
//
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_UCHAR
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_ULONG
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_USHORT
|
||||
GENERATE_ARM_STUB READ_REGISTER_UCHAR
|
||||
GENERATE_ARM_STUB READ_REGISTER_ULONG
|
||||
GENERATE_ARM_STUB READ_REGISTER_USHORT
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_UCHAR
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_ULONG
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_USHORT
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_UCHAR
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_ULONG
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_USHORT
|
||||
|
||||
//
|
||||
// CRT APIs implemented in ASM
|
||||
//
|
||||
GENERATE_ARM_STUB _alldiv
|
||||
GENERATE_ARM_STUB _alldvrm
|
||||
GENERATE_ARM_STUB _allmul
|
||||
GENERATE_ARM_STUB _alloca_probe
|
||||
GENERATE_ARM_STUB _allrem
|
||||
GENERATE_ARM_STUB _allshl
|
||||
GENERATE_ARM_STUB _allshr
|
||||
GENERATE_ARM_STUB _aulldiv
|
||||
GENERATE_ARM_STUB _aulldvrm
|
||||
GENERATE_ARM_STUB _aullrem
|
||||
GENERATE_ARM_STUB _aullshr
|
||||
|
||||
//
|
||||
// RTL CRT-like APIs implemented in ASM
|
||||
//
|
||||
GENERATE_ARM_STUB RtlCompareMemory
|
||||
GENERATE_ARM_STUB RtlCompareMemoryUlong
|
||||
GENERATE_ARM_STUB RtlFillMemory
|
||||
GENERATE_ARM_STUB RtlFillMemoryUlong
|
||||
GENERATE_ARM_STUB RtlMoveMemory
|
||||
GENERATE_ARM_STUB RtlPrefetchMemoryNonTemporal
|
||||
GENERATE_ARM_STUB RtlUlongByteSwap
|
||||
GENERATE_ARM_STUB RtlUlonglongByteSwap
|
||||
GENERATE_ARM_STUB RtlUshortByteSwap
|
||||
GENERATE_ARM_STUB RtlZeroMemory
|
||||
|
||||
//
|
||||
// Exceptions
|
||||
//
|
||||
GENERATE_ARM_STUB _abnormal_termination
|
||||
GENERATE_ARM_STUB _except_handler2
|
||||
GENERATE_ARM_STUB _except_handler3
|
||||
GENERATE_ARM_STUB _global_unwind2
|
||||
GENERATE_ARM_STUB _local_unwind2
|
||||
|
||||
//
|
||||
// Exported Ke Arch-Specific APIs
|
||||
//
|
||||
GENERATE_ARM_STUB KiSwapContext
|
||||
GENERATE_ARM_STUB DbgBreakPointWithStatus
|
||||
GENERATE_ARM_STUB Ke386CallBios
|
||||
GENERATE_ARM_STUB KeConnectInterrupt
|
||||
GENERATE_ARM_STUB KeDcacheFlushCount
|
||||
|
@ -62,69 +123,33 @@ GENERATE_ARM_STUB KeUserModeCallback
|
|||
GENERATE_ARM_STUB Kei386EoiHelper
|
||||
GENERATE_ARM_STUB KiCoprocessorError
|
||||
GENERATE_ARM_STUB KiDispatchInterrupt
|
||||
GENERATE_ARM_STUB KiApcInterrupt
|
||||
GENERATE_ARM_STUB KiPassiveRelease
|
||||
GENERATE_ARM_STUB KiInterruptTemplate
|
||||
GENERATE_ARM_STUB KiUnexpectedInterrupt
|
||||
GENERATE_ARM_STUB MmGetPhysicalAddress
|
||||
GENERATE_ARM_STUB NtVdmControl
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_UCHAR
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_ULONG
|
||||
GENERATE_ARM_STUB READ_REGISTER_BUFFER_USHORT
|
||||
GENERATE_ARM_STUB READ_REGISTER_UCHAR
|
||||
GENERATE_ARM_STUB READ_REGISTER_ULONG
|
||||
GENERATE_ARM_STUB READ_REGISTER_USHORT
|
||||
GENERATE_ARM_STUB RtlCaptureContext
|
||||
GENERATE_ARM_STUB RtlCompareMemory
|
||||
GENERATE_ARM_STUB RtlCompareMemoryUlong
|
||||
GENERATE_ARM_STUB RtlFillMemory
|
||||
GENERATE_ARM_STUB RtlFillMemoryUlong
|
||||
GENERATE_ARM_STUB RtlGetCallersAddress
|
||||
GENERATE_ARM_STUB RtlMoveMemory
|
||||
GENERATE_ARM_STUB RtlPrefetchMemoryNonTemporal
|
||||
GENERATE_ARM_STUB RtlUlongByteSwap
|
||||
GENERATE_ARM_STUB RtlUlonglongByteSwap
|
||||
GENERATE_ARM_STUB RtlUnwind
|
||||
GENERATE_ARM_STUB RtlUshortByteSwap
|
||||
GENERATE_ARM_STUB RtlZeroMemory
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_UCHAR
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_ULONG
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_BUFFER_USHORT
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_UCHAR
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_ULONG
|
||||
GENERATE_ARM_STUB WRITE_REGISTER_USHORT
|
||||
GENERATE_ARM_STUB _abnormal_termination
|
||||
GENERATE_ARM_STUB _alldiv
|
||||
GENERATE_ARM_STUB _alldvrm
|
||||
GENERATE_ARM_STUB _allmul
|
||||
GENERATE_ARM_STUB _alloca_probe
|
||||
GENERATE_ARM_STUB _allrem
|
||||
GENERATE_ARM_STUB _allshl
|
||||
GENERATE_ARM_STUB _allshr
|
||||
GENERATE_ARM_STUB _aulldiv
|
||||
GENERATE_ARM_STUB _aulldvrm
|
||||
GENERATE_ARM_STUB _aullrem
|
||||
GENERATE_ARM_STUB _aullshr
|
||||
GENERATE_ARM_STUB _except_handler2
|
||||
GENERATE_ARM_STUB _except_handler3
|
||||
GENERATE_ARM_STUB _global_unwind2
|
||||
GENERATE_ARM_STUB _local_unwind2
|
||||
GENERATE_ARM_STUB KiSaveProcessorControlState
|
||||
GENERATE_ARM_STUB KiInitializeUserApc
|
||||
GENERATE_ARM_STUB KeDisableInterrupts
|
||||
GENERATE_ARM_STUB KeContextToTrapFrame
|
||||
GENERATE_ARM_STUB KiDispatchException
|
||||
GENERATE_ARM_STUB NtSetLdtEntries
|
||||
GENERATE_ARM_STUB NtRaiseException
|
||||
GENERATE_ARM_STUB NtCallbackReturn
|
||||
GENERATE_ARM_STUB NtContinue
|
||||
GENERATE_ARM_STUB NtVdmControl
|
||||
GENERATE_ARM_STUB RtlCreateUserThread
|
||||
GENERATE_ARM_STUB RtlInitializeContext
|
||||
|
||||
//
|
||||
// Internal Ke Arch-Specific Helpers
|
||||
//
|
||||
GENERATE_ARM_STUB KiSaveProcessorControlState
|
||||
GENERATE_ARM_STUB KiInitializeUserApc
|
||||
GENERATE_ARM_STUB KeDisableInterrupts
|
||||
GENERATE_ARM_STUB KiDispatchException
|
||||
GENERATE_ARM_STUB KiSwapProcess
|
||||
GENERATE_ARM_STUB MmUpdatePageDir
|
||||
GENERATE_ARM_STUB KeArmInitThreadWithContext
|
||||
GENERATE_ARM_STUB MmGetPfnForProcess
|
||||
GENERATE_ARM_STUB MmCreateVirtualMapping
|
||||
GENERATE_ARM_STUB CmpInitializeMachineDependentConfiguration
|
||||
GENERATE_ARM_STUB KeI386VdmInitialize
|
||||
GENERATE_ARM_STUB KeSwitchKernelStack
|
||||
GENERATE_ARM_STUB KiInitMachineDependent
|
||||
GENERATE_ARM_STUB KiComputeTimerTableIndex
|
||||
GENERATE_ARM_STUB CmpInitializeMachineDependentConfiguration
|
||||
|
||||
|
||||
//
|
||||
// Memory Manager Arch-Specific
|
||||
//
|
||||
GENERATE_ARM_STUB MmGetPhysicalAddress
|
||||
GENERATE_ARM_STUB MmSetDirtyPage
|
||||
GENERATE_ARM_STUB MmSetCleanPage
|
||||
GENERATE_ARM_STUB MmIsDirtyPage
|
||||
|
@ -143,13 +168,8 @@ GENERATE_ARM_STUB MmCreateVirtualMappingUnsafe
|
|||
GENERATE_ARM_STUB MmInitializeHandBuiltProcess
|
||||
GENERATE_ARM_STUB MmCreateProcessAddressSpace
|
||||
GENERATE_ARM_STUB Mmi386ReleaseMmInfo
|
||||
GENERATE_ARM_STUB RtlCreateUserThread
|
||||
GENERATE_ARM_STUB RtlInitializeContext
|
||||
GENERATE_ARM_STUB RtlpGetExceptionAddress
|
||||
GENERATE_ARM_STUB RtlDispatchException
|
||||
GENERATE_ARM_STUB DebugService2
|
||||
GENERATE_ARM_STUB KdpGdbStubInit
|
||||
GENERATE_ARM_STUB KeSwitchKernelStack
|
||||
GENERATE_ARM_STUB MmGetPfnForProcess
|
||||
GENERATE_ARM_STUB MmCreateVirtualMapping
|
||||
GENERATE_ARM_STUB MiInitPageDirectoryMap
|
||||
GENERATE_ARM_STUB MmGetPageDirectory
|
||||
GENERATE_ARM_STUB MmInitGlobalKernelPageDirectory
|
||||
|
@ -157,12 +177,20 @@ GENERATE_ARM_STUB MmDeletePageTable
|
|||
GENERATE_ARM_STUB MmGetPageProtect
|
||||
GENERATE_ARM_STUB MmCreateVirtualMappingForKernel
|
||||
GENERATE_ARM_STUB MiGetUserPageDirectoryCount
|
||||
GENERATE_ARM_STUB RtlpGetStackLimits
|
||||
GENERATE_ARM_STUB KiInitMachineDependent
|
||||
GENERATE_ARM_STUB KiComputeTimerTableIndex
|
||||
GENERATE_ARM_STUB _SEHCurrentRegistration
|
||||
GENERATE_ARM_STUB _SEHUnregisterFrame
|
||||
GENERATE_ARM_STUB _SEHRegisterFrame
|
||||
GENERATE_ARM_STUB _SEHCleanHandlerEnvironment
|
||||
GENERATE_ARM_STUB _SEHGlobalUnwind
|
||||
|
||||
//
|
||||
// Traps, Debugging and Execeptions
|
||||
//
|
||||
GENERATE_ARM_STUB KiApcInterrupt
|
||||
GENERATE_ARM_STUB KiPassiveRelease
|
||||
GENERATE_ARM_STUB KiInterruptTemplate
|
||||
GENERATE_ARM_STUB KiUnexpectedInterrupt
|
||||
GENERATE_ARM_STUB RtlCaptureContext
|
||||
GENERATE_ARM_STUB RtlGetCallersAddress
|
||||
GENERATE_ARM_STUB RtlUnwind
|
||||
GENERATE_ARM_STUB RtlpGetExceptionAddress
|
||||
GENERATE_ARM_STUB RtlDispatchException
|
||||
GENERATE_ARM_STUB DebugService2
|
||||
GENERATE_ARM_STUB RtlpGetStackLimits
|
||||
|
||||
GENERATE_ARM_STUB KdpGdbStubInit
|
||||
|
|
141
reactos/ntoskrnl/ke/arm/thrdini.c
Normal file
141
reactos/ntoskrnl/ke/arm/thrdini.c
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Kernel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: ntoskrnl/ke/arm/thrdini.c
|
||||
* PURPOSE: Implements thread context setup and startup for ARM machines
|
||||
* PROGRAMMERS: ReactOS Portable Systems Group
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
typedef struct _KUINIT_FRAME
|
||||
{
|
||||
KEXCEPTION_FRAME CtxSwitchFrame;
|
||||
KEXCEPTION_FRAME ExceptionFrame;
|
||||
KTRAP_FRAME TrapFrame;
|
||||
} KUINIT_FRAME, *PKUINIT_FRAME;
|
||||
|
||||
typedef struct _KKINIT_FRAME
|
||||
{
|
||||
KEXCEPTION_FRAME CtxSwitchFrame;
|
||||
} KKINIT_FRAME, *PKKINIT_FRAME;
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KiThreadStartup(IN PKSYSTEM_ROUTINE SystemRoutine,
|
||||
IN PKSTART_ROUTINE StartRoutine,
|
||||
IN PVOID StartContext,
|
||||
IN BOOLEAN UserThread,
|
||||
IN KTRAP_FRAME TrapFrame)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KeArmInitThreadWithContext(IN PKTHREAD Thread,
|
||||
IN PKSYSTEM_ROUTINE SystemRoutine,
|
||||
IN PKSTART_ROUTINE StartRoutine,
|
||||
IN PVOID StartContext,
|
||||
IN PCONTEXT ContextPointer)
|
||||
{
|
||||
PKTRAP_FRAME TrapFrame;
|
||||
PKEXCEPTION_FRAME ExceptionFrame = NULL, CtxSwitchFrame;
|
||||
|
||||
//
|
||||
// Check if this is a user thread
|
||||
//
|
||||
if (ContextPointer)
|
||||
{
|
||||
//
|
||||
// Setup the initial frame
|
||||
//
|
||||
PKUINIT_FRAME InitFrame;
|
||||
InitFrame = (PKUINIT_FRAME)((ULONG_PTR)Thread->InitialStack -
|
||||
sizeof(KUINIT_FRAME));
|
||||
|
||||
//
|
||||
// Setup the Trap Frame and Exception frame
|
||||
//
|
||||
TrapFrame = &InitFrame->TrapFrame;
|
||||
ExceptionFrame = &InitFrame->ExceptionFrame;
|
||||
|
||||
///
|
||||
// Zero out the trap frame and exception frame
|
||||
//
|
||||
RtlZeroMemory(TrapFrame, sizeof(KTRAP_FRAME));
|
||||
RtlZeroMemory(ExceptionFrame, sizeof(KEXCEPTION_FRAME));
|
||||
|
||||
//
|
||||
// Set up a trap frame from the context
|
||||
//
|
||||
KeContextToTrapFrame(ContextPointer,
|
||||
ExceptionFrame,
|
||||
TrapFrame,
|
||||
ContextPointer->ContextFlags | CONTEXT_CONTROL,
|
||||
UserMode);
|
||||
|
||||
//
|
||||
// Set the previous mode as user
|
||||
//
|
||||
TrapFrame->PreviousMode = UserMode;
|
||||
Thread->PreviousMode = UserMode;
|
||||
|
||||
//
|
||||
// Clear the return address
|
||||
//
|
||||
ExceptionFrame->Lr = 0;
|
||||
|
||||
//
|
||||
// Context switch frame to setup below
|
||||
//
|
||||
CtxSwitchFrame = &InitFrame->CtxSwitchFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Set up the Initial Frame for the system thread
|
||||
//
|
||||
PKKINIT_FRAME InitFrame;
|
||||
InitFrame = (PKKINIT_FRAME)((ULONG_PTR)Thread->InitialStack -
|
||||
sizeof(KKINIT_FRAME));
|
||||
|
||||
//
|
||||
// Set the previous mode as kernel
|
||||
//
|
||||
Thread->PreviousMode = KernelMode;
|
||||
|
||||
//
|
||||
// Context switch frame to setup below
|
||||
//
|
||||
CtxSwitchFrame = &InitFrame->CtxSwitchFrame;
|
||||
}
|
||||
|
||||
//
|
||||
// Now setup the context switch frame
|
||||
//
|
||||
CtxSwitchFrame->SwapReturn = (ULONG)KiThreadStartup;
|
||||
CtxSwitchFrame->R11 = (ULONG)(ExceptionFrame ? ExceptionFrame : CtxSwitchFrame);
|
||||
|
||||
//
|
||||
// Set the parameters
|
||||
//
|
||||
CtxSwitchFrame->R4 = (ULONG)ContextPointer;
|
||||
CtxSwitchFrame->R5 = (ULONG)StartContext;
|
||||
CtxSwitchFrame->R6 = (ULONG)StartRoutine;
|
||||
CtxSwitchFrame->R7 = (ULONG)SystemRoutine;
|
||||
|
||||
//
|
||||
// Save back the new value of the kernel stack
|
||||
//
|
||||
Thread->KernelStack = (PVOID)CtxSwitchFrame;
|
||||
}
|
33
reactos/ntoskrnl/mm/arm/stubs.c
Normal file
33
reactos/ntoskrnl/mm/arm/stubs.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Kernel
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: ntoskrnl/mm/arm/stubs.c
|
||||
* PURPOSE: ARM Memory Manager
|
||||
* PROGRAMMERS: ReactOS Portable Systems Group
|
||||
*/
|
||||
|
||||
/* INCLUDES *******************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
/* GLOBALS ********************************************************************/
|
||||
|
||||
//
|
||||
// METAFIXME: We need to stop using 1MB Section Entry TTEs!
|
||||
//
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmUpdatePageDir(IN PEPROCESS Process,
|
||||
IN PVOID Address,
|
||||
IN ULONG Size)
|
||||
{
|
||||
//
|
||||
// Nothing to do
|
||||
//
|
||||
UNIMPLEMENTED;
|
||||
return;
|
||||
}
|
|
@ -62,9 +62,11 @@
|
|||
<file first="true">boot.s</file>
|
||||
<file>arm_kprintf.c</file>
|
||||
<file>cpu.c</file>
|
||||
<file>exp.c</file>
|
||||
<file>kiinit.c</file>
|
||||
<file>stubs_asm.s</file>
|
||||
<file>stubs.c</file>
|
||||
<file>thrdini.c</file>
|
||||
</directory>
|
||||
</if>
|
||||
<if property="ARCH" value="powerpc">
|
||||
|
@ -332,6 +334,11 @@
|
|||
<file>page.c</file>
|
||||
</directory>
|
||||
</if>
|
||||
<if property="ARCH" value="arm">
|
||||
<directory name="arm">
|
||||
<file>stubs.c</file>
|
||||
</directory>
|
||||
</if>
|
||||
<if property="ARCH" value="powerpc">
|
||||
<directory name="powerpc">
|
||||
<file>pfault.c</file>
|
||||
|
|
Loading…
Reference in a new issue