- Move all amd64 specific files to one amd64 folder
- Compile x86 specific timer code only on x86
- Use KeRegisterInterruptHandler instead of manual idt manipulation
- add missing stubs for amd64

svn path=/trunk/; revision=47565
This commit is contained in:
Timo Kreuzer 2010-06-04 10:59:19 +00:00
parent a95f10c476
commit 2b0533a1b0
11 changed files with 239 additions and 31 deletions

View file

@ -0,0 +1,31 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: GPL - See COPYING in the top level directory
* FILE: hal/halx86/amd64/halinit.c
* PURPOSE: HAL Entrypoint and Initialization
* PROGRAMMERS:
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS *******************************************************************/
/* PRIVATE FUNCTIONS *********************************************************/
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
BOOLEAN
NTAPI
HalInitSystem(IN ULONG BootPhase,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
UNIMPLEMENTED;
return FALSE;
}

View file

@ -0,0 +1,97 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: GPL - See COPYING in the top level directory
* FILE: hal/halx86/amd64/processor.c
* PURPOSE: HAL Processor Routines
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
KAFFINITY HalpActiveProcessors;
KAFFINITY HalpDefaultInterruptAffinity;
/* PRIVATE FUNCTIONS *********************************************************/
VOID
NTAPI
HaliHaltSystem(VOID)
{
/* Disable interrupts and halt the CPU */
_disable();
__halt();
}
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
VOID
NTAPI
HalInitializeProcessor(IN ULONG ProcessorNumber,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
/* Set default stall count */
KeGetPcr()->StallScaleFactor = INITIAL_STALL_COUNT;
/* Update the interrupt affinity and processor mask */
InterlockedBitTestAndSet((PLONG)&HalpActiveProcessors, ProcessorNumber);
InterlockedBitTestAndSet((PLONG)&HalpDefaultInterruptAffinity,
ProcessorNumber);
/* Register routines for KDCOM */
//HalpRegisterKdSupportFunctions();
}
/*
* @implemented
*/
BOOLEAN
NTAPI
HalAllProcessorsStarted(VOID)
{
/* Do nothing */
return TRUE;
}
/*
* @implemented
*/
BOOLEAN
NTAPI
HalStartNextProcessor(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
IN PKPROCESSOR_STATE ProcessorState)
{
/* Ready to start */
return FALSE;
}
/*
* @implemented
*/
VOID
NTAPI
HalProcessorIdle(VOID)
{
/* Enable interrupts and halt the processor */
_enable();
__halt();
}
/*
* @implemented
*/
VOID
NTAPI
HalRequestIpi(KAFFINITY TargetProcessors)
{
UNIMPLEMENTED;
__debugbreak();
}
/* EOF */

View file

@ -0,0 +1,97 @@
/*
* PROJECT: ReactOS HAL
* LICENSE: GPL - See COPYING.ARM in the top level directory
* FILE: hal/halx86/amd64/stubs.c
* PURPOSE: HAL stubs
* PROGRAMMERS:
*/
/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
LARGE_INTEGER HalpPerformanceFrequency;
/* FUNCTIONS ******************************************************************/
VOID
FASTCALL
HalClearSoftwareInterrupt(
IN KIRQL Irql)
{
UNIMPLEMENTED;
}
VOID
FASTCALL
HalRequestSoftwareInterrupt(
IN KIRQL Irql)
{
UNIMPLEMENTED;
}
BOOLEAN
NTAPI
HalBeginSystemInterrupt(
IN KIRQL Irql,
IN UCHAR Vector,
OUT PKIRQL OldIrql)
{
UNIMPLEMENTED;
return FALSE;
}
BOOLEAN
NTAPI
HalEnableSystemInterrupt(
IN UCHAR Vector,
IN KIRQL Irql,
IN KINTERRUPT_MODE InterruptMode)
{
UNIMPLEMENTED;
return FALSE;
}
VOID
NTAPI
HalDisableSystemInterrupt(
IN UCHAR Vector,
IN KIRQL Irql)
{
UNIMPLEMENTED;
}
VOID
NTAPI
HalEndSystemInterrupt(
IN KIRQL OldIrql,
IN PKTRAP_FRAME TrapFrame)
{
UNIMPLEMENTED;
}
LARGE_INTEGER
NTAPI
KeQueryPerformanceCounter(
OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL)
{
LARGE_INTEGER Result;
// ASSERT(HalpPerformanceFrequency.QuadPart != 0);
/* Does the caller want the frequency? */
if (PerformanceFrequency)
{
/* Return value */
*PerformanceFrequency = HalpPerformanceFrequency;
}
Result.QuadPart = __rdtsc();
return Result;
}

View file

@ -12,7 +12,7 @@
//#define NDEBUG
#include <debug.h>
#include "x86emu.h"
//#include "x86emu.h"
/* This page serves as fallback for pages used by Mm */
#define DEFAULT_PAGE 0x21
@ -216,6 +216,7 @@ x86BiosWriteMemory(
return STATUS_SUCCESS;
}
#if 0
BOOLEAN
NTAPI
x86BiosCall(
@ -261,11 +262,13 @@ x86BiosCall(
return TRUE;
}
#endif
BOOLEAN
NTAPI
HalpBiosDisplayReset(VOID)
{
#if 0
X86_BIOS_REGISTERS Registers;
ULONG OldEflags;
@ -283,7 +286,7 @@ HalpBiosDisplayReset(VOID)
/* Restore previous flags */
__writeeflags(OldEflags);
#endif
return TRUE;
}

View file

@ -109,6 +109,7 @@ HalpInitializeClock(VOID)
HalpCurrentRollOver = RollOver;
}
#ifdef _M_IX86
#ifndef _MINIHAL_
VOID
FASTCALL
@ -163,6 +164,7 @@ HalpProfileInterruptHandler(IN PKTRAP_FRAME TrapFrame)
}
#endif
#endif
/* PUBLIC FUNCTIONS ***********************************************************/

View file

@ -509,17 +509,11 @@ HalpEnableInterruptHandler(IN UCHAR Flags,
IN PVOID Handler,
IN KINTERRUPT_MODE Mode)
{
UCHAR Entry;
/* Convert the vector into the IDT entry */
Entry = HalVectorToIDTEntry(SystemVector);
/* Register the vector */
HalpRegisterVector(Flags, BusVector, SystemVector, Irql);
/* Connect the interrupt */
((PKIPCR)KeGetPcr())->IDT[Entry].ExtendedOffset = (USHORT)(((ULONG_PTR)Handler >> 16) & 0xFFFF);
((PKIPCR)KeGetPcr())->IDT[Entry].Offset = (USHORT)((ULONG_PTR)Handler);
KeRegisterInterruptHandler(SystemVector, Handler);
/* Enable the interrupt */
HalEnableSystemInterrupt(SystemVector, Irql, Mode);

View file

@ -36,19 +36,6 @@
<file>trap.S</file>
</directory>
</if>
<if property="ARCH" value="amd64">
<define name="_X86BIOS_" />
<!-- include base="x86emu">.</include -->
<directory name="amd64">
<file>x86bios.c</file>
<!-- file>halinit.c</file -->
<!-- file>irq.S</file -->
<!-- file>misc.c</file -->
<!-- file>apic.c</file -->
<file>systimer.S</file>
<!-- file>usage.c</file -->
</directory>
</if>
</directory>
<directory name="include">
<pch>hal.h</pch>

View file

@ -8,6 +8,7 @@
<include base="ntoskrnl">include</include>
<!-- include base="x86emu">.</include -->
<define name="_DISABLE_TIDENTS" />
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<define name="_X86BIOS_" />
<library>hal_generic</library>
@ -19,18 +20,14 @@
<file>spinlock.c</file>
</directory>
<directory name="up">
<directory name="amd64">
<file>x86bios.c</file>
<file>halinit.c</file>
<file>stubs.c</file>
<file>systimer.S</file>
<file>processor.c</file>
</directory>
<!-- directory name="mp">
<file>halinit_mp.c</file>
<file>processor_mp.c</file>
<file>halmp.rc</file>
<directory name="amd64">
<file>mps.S</file>
</directory>
</directory -->
</module>
</group>