Migrate HL subsystem to C++
This commit is contained in:
@@ -11,7 +11,15 @@
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
#include <hl/acpi.hh>
|
||||
#include <hl/cport.hh>
|
||||
#include <hl/cpu.hh>
|
||||
#include <hl/fbdev.hh>
|
||||
#include <hl/init.hh>
|
||||
#include <hl/ioport.hh>
|
||||
#include <hl/ioreg.hh>
|
||||
#include <hl/pic.hh>
|
||||
#include <hl/runlevel.hh>
|
||||
|
||||
|
||||
#endif /* __XTOSKRNL_HL_HH */
|
||||
|
48
xtoskrnl/includes/hl/acpi.hh
Normal file
48
xtoskrnl/includes/hl/acpi.hh
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/acpi.hh
|
||||
* DESCRIPTION: Advanced Configuration and Power Interface (ACPI) support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_ACPI_HH
|
||||
#define __XTOSKRNL_HL_ACPI_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class Acpi
|
||||
{
|
||||
private:
|
||||
STATIC LIST_ENTRY CacheList;
|
||||
STATIC PACPI_RSDP RsdpStructure;
|
||||
STATIC ACPI_SYSTEM_INFO SystemInfo;
|
||||
STATIC ACPI_TIMER_INFO TimerInfo;
|
||||
|
||||
public:
|
||||
STATIC XTAPI XTSTATUS GetAcpiSystemDescriptionPointer(OUT PACPI_RSDP *Rsdp);
|
||||
STATIC XTAPI XTSTATUS GetAcpiTable(IN ULONG Signature,
|
||||
OUT PACPI_DESCRIPTION_HEADER *AcpiTable);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpi(VOID);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpiSystemInformation(VOID);
|
||||
|
||||
private:
|
||||
STATIC XTAPI VOID CacheAcpiTable(IN PACPI_DESCRIPTION_HEADER AcpiTable);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpiCache(VOID);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *AcpiTable);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpiSystemStructure(VOID);
|
||||
STATIC XTAPI XTSTATUS InitializeAcpiTimer(VOID);
|
||||
STATIC XTAPI XTSTATUS QueryAcpiCache(IN ULONG Signature,
|
||||
OUT PACPI_DESCRIPTION_HEADER *AcpiTable);
|
||||
STATIC XTAPI XTSTATUS QueryAcpiTables(IN ULONG Signature,
|
||||
OUT PACPI_DESCRIPTION_HEADER *AcpiTable);
|
||||
STATIC XTAPI BOOLEAN ValidateAcpiTable(IN PVOID Buffer,
|
||||
IN UINT_PTR Size);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_ACPI_HH */
|
35
xtoskrnl/includes/hl/cport.hh
Normal file
35
xtoskrnl/includes/hl/cport.hh
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/cpu.hh
|
||||
* DESCRIPTION: Serial (COM) port support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_CPORT_HH
|
||||
#define __XTOSKRNL_HL_CPORT_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class ComPort
|
||||
{
|
||||
public:
|
||||
STATIC XTCDECL XTSTATUS ReadComPort(IN PCPPORT Port,
|
||||
OUT PUCHAR Byte,
|
||||
IN BOOLEAN Wait,
|
||||
IN BOOLEAN Poll);
|
||||
STATIC XTCDECL UCHAR ReadComPortLsr(IN PCPPORT Port,
|
||||
IN UCHAR Byte);
|
||||
STATIC XTCDECL XTSTATUS InitializeComPort(IN OUT PCPPORT Port,
|
||||
IN PUCHAR PortAddress,
|
||||
IN ULONG BaudRate);
|
||||
STATIC XTCDECL XTSTATUS WriteComPort(IN PCPPORT Port,
|
||||
IN UCHAR Byte);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_CPORT_HH */
|
27
xtoskrnl/includes/hl/cpu.hh
Normal file
27
xtoskrnl/includes/hl/cpu.hh
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/cpu.hh
|
||||
* DESCRIPTION: HAL processor support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_CPU_HH
|
||||
#define __XTOSKRNL_HL_CPU_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class Cpu
|
||||
{
|
||||
private:
|
||||
STATIC KAFFINITY ActiveProcessors;
|
||||
public:
|
||||
STATIC XTAPI VOID InitializeProcessor(VOID);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_CPU_HH */
|
50
xtoskrnl/includes/hl/fbdev.hh
Normal file
50
xtoskrnl/includes/hl/fbdev.hh
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/fbdev.hh
|
||||
* DESCRIPTION: FrameBuffer support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_FBDEV_HH
|
||||
#define __XTOSKRNL_HL_FBDEV_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class FrameBuffer
|
||||
{
|
||||
private:
|
||||
STATIC HL_FRAMEBUFFER_DATA FrameBufferData;
|
||||
STATIC HL_SCROLL_REGION_DATA ScrollRegionData;
|
||||
|
||||
public:
|
||||
STATIC XTAPI VOID ClearScreen(IN ULONG Color);
|
||||
STATIC XTCDECL XTSTATUS DisplayCharacter(IN WCHAR Character);
|
||||
STATIC XTAPI VOID GetFrameBufferResolution(OUT PULONG Width,
|
||||
OUT PULONG Height);
|
||||
STATIC XTAPI XTSTATUS InitializeFrameBuffer(VOID);
|
||||
STATIC XTAPI VOID InitializeScrollRegion(IN ULONG Left,
|
||||
IN ULONG Top,
|
||||
IN ULONG Right,
|
||||
IN ULONG Bottom,
|
||||
IN ULONG FontColor);
|
||||
|
||||
|
||||
private:
|
||||
STATIC XTAPI VOID DrawCharacter(IN ULONG PositionX,
|
||||
IN ULONG PositionY,
|
||||
IN ULONG Color,
|
||||
IN WCHAR WideCharacter);
|
||||
STATIC XTAPI VOID DrawPixel(IN ULONG PositionX,
|
||||
IN ULONG PositionY,
|
||||
IN ULONG Color);
|
||||
STATIC XTAPI ULONG GetRGBColor(IN ULONG Color);
|
||||
STATIC XTAPI VOID ScrollRegion(VOID);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_FBDEV_HH */
|
25
xtoskrnl/includes/hl/init.hh
Normal file
25
xtoskrnl/includes/hl/init.hh
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/init.hh
|
||||
* DESCRIPTION: Hardware layer initialization
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_INIT_HH
|
||||
#define __XTOSKRNL_HL_INIT_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class Init
|
||||
{
|
||||
public:
|
||||
STATIC XTAPI XTSTATUS InitializeSystem(VOID);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_INIT_HH */
|
33
xtoskrnl/includes/hl/ioport.hh
Normal file
33
xtoskrnl/includes/hl/ioport.hh
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/ioport.hh
|
||||
* DESCRIPTION: I/O port access routines
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_IOPORT_HH
|
||||
#define __XTOSKRNL_HL_IOPORT_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class IoPort
|
||||
{
|
||||
public:
|
||||
STATIC XTCDECL UCHAR ReadPort8(IN USHORT Port);
|
||||
STATIC XTCDECL USHORT ReadPort16(IN USHORT Port);
|
||||
STATIC XTCDECL ULONG ReadPort32(IN USHORT Port);
|
||||
STATIC XTCDECL VOID WritePort8(IN USHORT Port,
|
||||
IN UCHAR Value);
|
||||
STATIC XTCDECL VOID WritePort16(IN USHORT Port,
|
||||
IN USHORT Value);
|
||||
STATIC XTCDECL VOID WritePort32(IN USHORT Port,
|
||||
IN ULONG Value);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_IOPORT_HH */
|
43
xtoskrnl/includes/hl/pic.hh
Normal file
43
xtoskrnl/includes/hl/pic.hh
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/pic.hh
|
||||
* DESCRIPTION: HAL processor support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_PIC_HH
|
||||
#define __XTOSKRNL_HL_PIC_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class Pic
|
||||
{
|
||||
private:
|
||||
STATIC APIC_MODE ApicMode;
|
||||
|
||||
public:
|
||||
STATIC XTAPI VOID ClearApicErrors(VOID);
|
||||
STATIC XTAPI ULONG GetCpuApicId(VOID);
|
||||
STATIC XTAPI VOID InitializePic(VOID);
|
||||
STATIC XTFASTCALL ULONGLONG ReadApicRegister(IN APIC_REGISTER Register);
|
||||
STATIC XTAPI VOID SendEoi(VOID);
|
||||
STATIC XTAPI VOID SendIpi(ULONG ApicId,
|
||||
ULONG Vector);
|
||||
STATIC XTFASTCALL VOID WriteApicRegister(IN APIC_REGISTER Register,
|
||||
IN ULONGLONG Value);
|
||||
|
||||
private:
|
||||
STATIC XTAPI BOOLEAN CheckX2ApicSupport(VOID);
|
||||
STATIC XTCDECL VOID HandleApicSpuriousService(VOID);
|
||||
STATIC XTCDECL VOID HandlePicSpuriousService(VOID);
|
||||
STATIC XTAPI VOID InitializeApic(VOID);
|
||||
STATIC XTAPI VOID InitializeLegacyPic(VOID);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_PIC_HH */
|
30
xtoskrnl/includes/hl/runlevel.hh
Normal file
30
xtoskrnl/includes/hl/runlevel.hh
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/includes/hl/runlevel.hh
|
||||
* DESCRIPTION: Run Level management support
|
||||
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __XTOSKRNL_HL_RUNLEVEL_HH
|
||||
#define __XTOSKRNL_HL_RUNLEVEL_HH
|
||||
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Hardware Layer */
|
||||
namespace HL
|
||||
{
|
||||
class RunLevel
|
||||
{
|
||||
public:
|
||||
STATIC XTFASTCALL KRUNLEVEL GetRunLevel(VOID);
|
||||
STATIC XTFASTCALL VOID SetRunLevel(IN KRUNLEVEL RunLevel);
|
||||
|
||||
private:
|
||||
STATIC XTFASTCALL KRUNLEVEL TransformApicTprToRunLevel(IN UCHAR Tpr);
|
||||
STATIC XTFASTCALL UCHAR TransformRunLevelToApicTpr(IN KRUNLEVEL RunLevel);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* __XTOSKRNL_HL_RUNLEVEL_HH */
|
@@ -26,8 +26,8 @@ HlComPortGetByte(IN PCPPORT Port,
|
||||
|
||||
XTCDECL
|
||||
XTSTATUS
|
||||
HlComPortPutByte(IN PCPPORT Port,
|
||||
IN UCHAR Byte);
|
||||
HlWriteComPort8(IN PCPPORT Port,
|
||||
IN UCHAR Byte);
|
||||
|
||||
XTCDECL
|
||||
UCHAR
|
||||
|
Reference in New Issue
Block a user