cleanup ntoskrnl.exe:

- Move the last stubs into better places
- implement KeQueryActiveProcessors, KeInvalidateAllCaches, KeGetRecommendedSharedDataAlignment, KeSaveStateForHibernate, KeSetDmaIoCoherency, PsGetContext, PsSetContext based on x86 implementations.
- remove KdbpGetCommandLine from kd.c where it wasn't supposed to be
- remove amd64stubs.c

svn path=/branches/ros-amd64-bringup/; revision=37430
This commit is contained in:
Timo Kreuzer
2008-11-18 02:25:41 +00:00
parent 6496939b20
commit eda691f786
9 changed files with 453 additions and 74 deletions
-47
View File
@@ -1,47 +0,0 @@
unsigned long (*FrLdrDbgPrint)(const char *Format, ...);
#define STUB(x) void x() {FrLdrDbgPrint("Sorry, %s is only a stub!\n", __FUNCTION__);}
STUB(KeActiveProcessors)
STUB(KeConnectInterrupt)
STUB(KeContextToTrapFrame)
STUB(KeDisableInterrupts)
STUB(KeDisconnectInterrupt)
STUB(KeFeatureBits)
STUB(KeFlushEntireTb)
STUB(KeGetRecommendedSharedDataAlignment)
STUB(KeInitializeInterrupt)
STUB(KeInvalidateAllCaches)
STUB(KeProcessorArchitecture)
STUB(KeProcessorLevel)
STUB(KeProcessorRevision)
STUB(KeQueryActiveProcessors)
STUB(KeRaiseUserException)
STUB(KeRestoreFloatingPointState)
STUB(KeSaveFloatingPointState)
STUB(KeSaveStateForHibernate)
STUB(KeSetDmaIoCoherency)
STUB(KeSwitchKernelStack)
STUB(KeSynchronizeExecution)
STUB(KeUpdateRunTime)
STUB(KeUpdateSystemTime)
STUB(KeUserModeCallback)
STUB(KiComputeTimerTableIndex)
STUB(KiDispatchException)
STUB(KiIdleLoop)
STUB(KiInitializeUserApc)
STUB(KiSwapProcess)
STUB(KiSystemService)
STUB(KdbEnterDebuggerException)
STUB(KdbpCliModuleLoaded)
STUB(KdbpCliInit)
STUB(KdpGdbStubInit)
STUB(NtContinue)
STUB(NtCallbackReturn)
STUB(NtRaiseException)
STUB(NtSetLdtEntries)
STUB(NtVdmControl)
STUB(PspGetOrSetContextKernelRoutine)
+14 -21
View File
@@ -1,30 +1,23 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/ke/i386/cpu.c
* PURPOSE: Routines for CPU-level support
* PROGRAMMERS: Timo Kreuzer ([email protected])
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
VOID
STDCALL
KdbpGetCommandLineSettings(PCHAR p1)
KdpGdbStubInit(PKD_DISPATCH_TABLE WrapperTable,
ULONG BootPhase)
{
PCHAR p2;
while (p1 && (p2 = strchr(p1, ' ')))
{
p2++;
if (!_strnicmp(p2, "KDSERIAL", 8))
{
p2 += 8;
KdbDebugState |= KD_DEBUG_KDSERIAL;
KdpDebugMode.Serial = TRUE;
}
else if (!_strnicmp(p2, "KDNOECHO", 8))
{
p2 += 8;
KdbDebugState |= KD_DEBUG_KDNOECHO;
}
p1 = p2;
}
UNIMPLEMENTED;
}
+26 -2
View File
@@ -1,10 +1,10 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/kdbg/kdb.c
* FILE: ntoskrnl/kdbg/amd64/kdb.c
* PURPOSE: Kernel Debugger
*
* PROGRAMMERS: Gregor Anich
* Timo Kreuzer ([email protected])
*/
/* INCLUDES ******************************************************************/
@@ -45,3 +45,27 @@ KdbpGetCommandLineSettings(PCHAR p1)
}
}
KD_CONTINUE_TYPE
KdbEnterDebuggerException(
IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT Context,
IN OUT PKTRAP_FRAME TrapFrame,
IN BOOLEAN FirstChance)
{
UNIMPLEMENTED;
return 0;
}
VOID
KdbpCliModuleLoaded(IN PUNICODE_STRING Name)
{
UNIMPLEMENTED;
}
VOID
KdbpCliInit()
{
UNIMPLEMENTED;
}
+36
View File
@@ -0,0 +1,36 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: CONTEXT related functions
* PROGRAMMERS: Timo Kreuzer ([email protected])
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
/* 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;
}
VOID
NTAPI
KeTrapFrameToContext(IN PKTRAP_FRAME TrapFrame,
IN PKEXCEPTION_FRAME ExceptionFrame,
IN OUT PCONTEXT Context)
{
UNIMPLEMENTED;
}
+89 -1
View File
@@ -3,7 +3,8 @@
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/ke/amd64/cpu.c
* PURPOSE: Routines for CPU-level support
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
* Timo Kreuzer ([email protected])
*/
/* INCLUDES *****************************************************************/
@@ -26,11 +27,18 @@ KTSS64 KiBootTss;
/* CPU Features and Flags */
ULONG KeI386CpuType;
ULONG KeI386CpuStep;
ULONG KeProcessorArchitecture;
ULONG KeProcessorLevel;
ULONG KeProcessorRevision;
ULONG KeFeatureBits;
ULONG KeI386MachineType;
ULONG KeI386NpxPresent = 1;
ULONG KeI386XMMIPresent = 0;
ULONG KeI386FxsrPresent = 0;
ULONG KeLargestCacheLine = 0x40;
ULONG KiDmaIoCoherency = 0;
CHAR KeNumberProcessors = 0;
KAFFINITY KeActiveProcessors = 1;
BOOLEAN KiI386PentiumLockErrataPresent;
BOOLEAN KiSMTProcessorsPresent;
@@ -598,4 +606,84 @@ KiInitializeMachineType(VOID)
KeI386MachineType = KeLoaderBlock->u.I386.MachineType & 0x000FF;
}
VOID
NTAPI
KeFlushEntireTb(IN BOOLEAN Invalid,
IN BOOLEAN AllProcessors)
{
UNIMPLEMENTED;
}
KAFFINITY
NTAPI
KeQueryActiveProcessors(VOID)
{
PAGED_CODE();
/* Simply return the number of active processors */
return KeActiveProcessors;
}
NTSTATUS
NTAPI
KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSTATUS
NTAPI
KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
BOOLEAN
NTAPI
KeInvalidateAllCaches(VOID)
{
/* Only supported on Pentium Pro and higher */
if (KeI386CpuType < 6) return FALSE;
/* Invalidate all caches */
__wbinvd();
return TRUE;
}
/*
* @implemented
*/
ULONG
NTAPI
KeGetRecommendedSharedDataAlignment(VOID)
{
/* Return the global variable */
return KeLargestCacheLine;
}
/*
* @implemented
*/
VOID
__cdecl
KeSaveStateForHibernate(IN PKPROCESSOR_STATE State)
{
/* Capture the context */
RtlCaptureContext(&State->ContextFrame);
/* Capture the control state */
KiSaveProcessorControlState(State);
}
/*
* @implemented
*/
VOID
NTAPI
KeSetDmaIoCoherency(IN ULONG Coherency)
{
/* Save the coherency globally */
KiDmaIoCoherency = Coherency;
}
+19
View File
@@ -91,3 +91,22 @@ KeInitExceptions(VOID)
__lidt(&KiIdtDescriptor.Limit);
}
VOID
NTAPI
KiDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
IN PKEXCEPTION_FRAME ExceptionFrame,
IN PKTRAP_FRAME TrapFrame,
IN KPROCESSOR_MODE PreviousMode,
IN BOOLEAN FirstChance)
{
UNIMPLEMENTED;
}
NTSTATUS
NTAPI
KeRaiseUserException(IN NTSTATUS ExceptionCode)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
+161
View File
@@ -0,0 +1,161 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* PURPOSE: stubs
* PROGRAMMERS: Timo Kreuzer ([email protected])
*/
/* INCLUDES ******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
BOOLEAN
NTAPI
KeConnectInterrupt(IN PKINTERRUPT Interrupt)
{
UNIMPLEMENTED;
return FALSE;
}
PVOID
NTAPI
KeSwitchKernelStack(PVOID StackBase, PVOID StackLimit)
{
UNIMPLEMENTED;
return NULL;
}
BOOLEAN
NTAPI
KeSynchronizeExecution(
IN OUT PKINTERRUPT Interrupt,
IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
IN PVOID SynchronizeContext)
{
UNIMPLEMENTED;
return FALSE;
}
VOID
NTAPI
KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame,
IN KIRQL Irql)
{
UNIMPLEMENTED;
}
VOID
NTAPI
KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,
IN KIRQL Irql,
IN ULONG Increment)
{
UNIMPLEMENTED;
}
NTSTATUS
NTAPI
KeUserModeCallback(IN ULONG RoutineIndex,
IN PVOID Argument,
IN ULONG ArgumentLength,
OUT PVOID *Result,
OUT PULONG ResultLength)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
ULONG
NTAPI
KiComputeTimerTableIndex(LONGLONG Timer)
{
UNIMPLEMENTED;
return 0;
}
VOID
KiIdleLoop()
{
UNIMPLEMENTED;
for(;;);
}
VOID
NTAPI
KiInitializeUserApc(IN PKEXCEPTION_FRAME ExceptionFrame,
IN PKTRAP_FRAME TrapFrame,
IN PKNORMAL_ROUTINE NormalRoutine,
IN PVOID NormalContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
{
UNIMPLEMENTED;
}
VOID
NTAPI
KiSwapProcess(IN PKPROCESS NewProcess,
IN PKPROCESS OldProcess)
{
UNIMPLEMENTED;
}
VOID
KiSystemService(IN PKTHREAD Thread,
IN PKTRAP_FRAME TrapFrame,
IN ULONG Instruction)
{
UNIMPLEMENTED;
}
NTSYSAPI
NTSTATUS
NTAPI
NtCallbackReturn
( IN PVOID Result OPTIONAL, IN ULONG ResultLength, IN NTSTATUS Status )
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSYSAPI
NTSTATUS
NTAPI
NtContinue(
IN PCONTEXT ThreadContext, IN BOOLEAN RaiseAlert)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSYSAPI
NTSTATUS
NTAPI
NtRaiseException
(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ThreadContext, IN BOOLEAN HandleException )
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSTATUS
STDCALL
NtSetLdtEntries
(ULONG Selector1, LDT_ENTRY LdtEntry1, ULONG Selector2, LDT_ENTRY LdtEntry2)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSTATUS
NTAPI
NtVdmControl(IN ULONG ControlCode,
IN PVOID ControlData)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
+13 -3
View File
@@ -36,9 +36,6 @@
<directory name="include">
<pch>ntoskrnl.h</pch>
</directory>
<if property="ARCH" value="amd64">
<file>amd64stubs.c</file>
</if>
<directory name="ke">
<if property="ARCH" value="i386">
<directory name="i386">
@@ -93,12 +90,15 @@
<if property="ARCH" value="amd64">
<directory name="amd64">
<file first="true">boot.S</file>
<file>context.c</file>
<file>cpu.c</file>
<file>ctxswitch.S</file>
<file>except.c</file>
<file>interrupt.c</file>
<file>irql.c</file>
<file>kiinit.c</file>
<file>spinlock.c</file>
<file>stubs.c</file>
<file>thrdini.c</file>
<file>trap.S</file>
</directory>
@@ -343,6 +343,11 @@
</if>
<file>kdbg.c</file>
</directory>
<if property="ARCH" value="amd64">
<directory name="amd64">
<file>kd.c</file>
</directory>
</if>
<file>kdinit.c</file>
<file>kdio.c</file>
<file>kdmain.c</file>
@@ -451,6 +456,11 @@
<file>psctx.c</file>
</directory>
</if>
<if property="ARCH" value="amd64">
<directory name="amd64">
<file>psctx.c</file>
</directory>
</if>
<file>debug.c</file>
<file>job.c</file>
<file>kill.c</file>
+95
View File
@@ -0,0 +1,95 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/ps/amd64/pxctx.c
* PURPOSE: Process Manager: Set/Get Context for i386
* PROGRAMMERS: Alex Ionescu ([email protected])
* Timo Kreuzer ([email protected])
*/
/* INCLUDES *******************************************************************/
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
/* FUNCTIONS ******************************************************************/
VOID
NTAPI
PspGetContext(IN PKTRAP_FRAME TrapFrame,
IN PVOID NonVolatileContext,
IN OUT PCONTEXT Context)
{
PAGED_CODE();
/* Convert the trap frame to a context */
KeTrapFrameToContext(TrapFrame, NULL, Context);
}
VOID
NTAPI
PspSetContext(OUT PKTRAP_FRAME TrapFrame,
OUT PVOID NonVolatileContext,
IN PCONTEXT Context,
IN KPROCESSOR_MODE Mode)
{
PAGED_CODE();
/* Convert the context to a trap frame structure */
KeContextToTrapFrame(Context, NULL, TrapFrame, Context->ContextFlags, Mode);
}
VOID
NTAPI
PspGetOrSetContextKernelRoutine(IN PKAPC Apc,
IN OUT PKNORMAL_ROUTINE* NormalRoutine,
IN OUT PVOID* NormalContext,
IN OUT PVOID* SystemArgument1,
IN OUT PVOID* SystemArgument2)
{
PGET_SET_CTX_CONTEXT GetSetContext;
PKEVENT Event;
PCONTEXT Context;
PKTHREAD Thread;
KPROCESSOR_MODE Mode;
PKTRAP_FRAME TrapFrame = NULL;
PAGED_CODE();
/* Get the Context Structure */
GetSetContext = CONTAINING_RECORD(Apc, GET_SET_CTX_CONTEXT, Apc);
Context = &GetSetContext->Context;
Event = &GetSetContext->Event;
Mode = GetSetContext->Mode;
Thread = Apc->SystemArgument2;
/* If this is a kernel-mode request, grab the saved trap frame */
if (Mode == KernelMode) TrapFrame = Thread->TrapFrame;
/* If we don't have one, grab it from the stack */
if (!TrapFrame)
{
FPRINT1("FIXME!!!!\n");
/* Trap frame is right under our initial stack */
// TrapFrame = (PKTRAP_FRAME)((ULONG_PTR)Thread->InitialStack -
// ROUND_UP(sizeof(KTRAP_FRAME), KTRAP_FRAME_ALIGN) -
// sizeof(FX_SAVE_AREA));
}
/* Check if it's a set or get */
if (Apc->SystemArgument1)
{
/* Get the Context */
PspSetContext(TrapFrame, NULL, Context, Mode);
}
else
{
/* Set the Context */
PspGetContext(TrapFrame, NULL, Context);
}
/* Notify the Native API that we are done */
KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
}
/* EOF */