Migrate HL subsystem to C++
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/hl/i686/cpu.c
|
||||
* FILE: xtoskrnl/hl/i686/cpu.cc
|
||||
* DESCRIPTION: HAL i686 processor support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Include common CPU interface */
|
||||
#include ARCH_COMMON(cpu.c)
|
||||
#include ARCH_COMMON(cpu.cc)
|
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/hl/i686/ioport.c
|
||||
* FILE: xtoskrnl/hl/i686/ioport.cc
|
||||
* DESCRIPTION: I/O port access routines for i686 platform
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
XTCDECL
|
||||
UCHAR
|
||||
HlIoPortInByte(IN USHORT Port)
|
||||
HL::IoPort::ReadPort8(IN USHORT Port)
|
||||
{
|
||||
UCHAR Value;
|
||||
__asm__ volatile("inb %1, %0"
|
||||
@@ -30,27 +30,6 @@ HlIoPortInByte(IN USHORT Port)
|
||||
return Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the 32-bit data from the specified I/O port.
|
||||
*
|
||||
* @param Port
|
||||
* Specifies the address to read from, in the range of 0-0xFFFF.
|
||||
*
|
||||
* @return The value read from the port.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
ULONG
|
||||
HlIoPortInLong(IN USHORT Port)
|
||||
{
|
||||
ULONG Value;
|
||||
__asm__ volatile("inl %1, %0"
|
||||
: "=a" (Value)
|
||||
: "Nd" (Port));
|
||||
return Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the 16-bit data from the specified I/O port.
|
||||
*
|
||||
@@ -63,7 +42,7 @@ HlIoPortInLong(IN USHORT Port)
|
||||
*/
|
||||
XTCDECL
|
||||
USHORT
|
||||
HlIoPortInShort(IN USHORT Port)
|
||||
HL::IoPort::ReadPort16(IN USHORT Port)
|
||||
{
|
||||
USHORT Value;
|
||||
__asm__ volatile("inw %1, %0"
|
||||
@@ -72,6 +51,27 @@ HlIoPortInShort(IN USHORT Port)
|
||||
return Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the 32-bit data from the specified I/O port.
|
||||
*
|
||||
* @param Port
|
||||
* Specifies the address to read from, in the range of 0-0xFFFF.
|
||||
*
|
||||
* @return The value read from the port.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
ULONG
|
||||
HL::IoPort::ReadPort32(IN USHORT Port)
|
||||
{
|
||||
ULONG Value;
|
||||
__asm__ volatile("inl %1, %0"
|
||||
: "=a" (Value)
|
||||
: "Nd" (Port));
|
||||
return Value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the 8-bit data to the specified I/O port.
|
||||
*
|
||||
@@ -87,8 +87,8 @@ HlIoPortInShort(IN USHORT Port)
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlIoPortOutByte(IN USHORT Port,
|
||||
IN UCHAR Value)
|
||||
HL::IoPort::WritePort8(IN USHORT Port,
|
||||
IN UCHAR Value)
|
||||
{
|
||||
__asm__ volatile("outb %0, %1"
|
||||
:
|
||||
@@ -96,30 +96,6 @@ HlIoPortOutByte(IN USHORT Port,
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the 32-bit data to the specified I/O port.
|
||||
*
|
||||
* @param Port
|
||||
* Specifies the address to write to, in the range of 0-0xFFFF.
|
||||
*
|
||||
* @param Value
|
||||
* Supplies the value to write.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlIoPortOutLong(IN USHORT Port,
|
||||
IN ULONG Value)
|
||||
{
|
||||
__asm__ volatile("outl %0, %1"
|
||||
:
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the 16-bit data to the specified I/O port.
|
||||
*
|
||||
@@ -135,11 +111,35 @@ HlIoPortOutLong(IN USHORT Port,
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HlIoPortOutShort(IN USHORT Port,
|
||||
IN USHORT Value)
|
||||
HL::IoPort::WritePort16(IN USHORT Port,
|
||||
IN USHORT Value)
|
||||
{
|
||||
__asm__ volatile("outw %0, %1"
|
||||
:
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the 32-bit data to the specified I/O port.
|
||||
*
|
||||
* @param Port
|
||||
* Specifies the address to write to, in the range of 0-0xFFFF.
|
||||
*
|
||||
* @param Value
|
||||
* Supplies the value to write.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
VOID
|
||||
HL::IoPort::WritePort32(IN USHORT Port,
|
||||
IN ULONG Value)
|
||||
{
|
||||
__asm__ volatile("outl %0, %1"
|
||||
:
|
||||
: "a" (Value),
|
||||
"Nd" (Port));
|
||||
}
|
@@ -1,13 +1,13 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/hl/i686/pic.c
|
||||
* FILE: xtoskrnl/hl/i686/pic.cc
|
||||
* DESCRIPTION: Programmable Interrupt Controller (PIC) for i686 support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/* Include common PIC interface */
|
||||
#include ARCH_COMMON(pic.c)
|
||||
#include ARCH_COMMON(pic.cc)
|
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/hl/i686/runlevel.c
|
||||
* FILE: xtoskrnl/hl/i686/runlevel.cc
|
||||
* DESCRIPTION: Run Level management support for i686 architecture
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
#include <xtos.hh>
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
XTFASTCALL
|
||||
KRUNLEVEL
|
||||
HlGetRunLevel(VOID)
|
||||
HL::RunLevel::GetRunLevel(VOID)
|
||||
{
|
||||
return HlpTransformApicTprToRunLevel(HlReadApicRegister(APIC_TPR));
|
||||
return TransformApicTprToRunLevel(HL::Pic::ReadApicRegister(APIC_TPR));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,9 +35,9 @@ HlGetRunLevel(VOID)
|
||||
*/
|
||||
XTFASTCALL
|
||||
VOID
|
||||
HlSetRunLevel(IN KRUNLEVEL RunLevel)
|
||||
HL::RunLevel::SetRunLevel(IN KRUNLEVEL RunLevel)
|
||||
{
|
||||
HlWriteApicRegister(APIC_TPR, HlpTransformRunLevelToApicTpr(RunLevel));
|
||||
HL::Pic::WriteApicRegister(APIC_TPR, TransformRunLevelToApicTpr(RunLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ HlSetRunLevel(IN KRUNLEVEL RunLevel)
|
||||
*/
|
||||
XTFASTCALL
|
||||
KRUNLEVEL
|
||||
HlpTransformApicTprToRunLevel(IN UCHAR Tpr)
|
||||
HL::RunLevel::TransformApicTprToRunLevel(IN UCHAR Tpr)
|
||||
{
|
||||
STATIC KRUNLEVEL TransformationTable[16] =
|
||||
{
|
||||
@@ -90,7 +90,7 @@ HlpTransformApicTprToRunLevel(IN UCHAR Tpr)
|
||||
*/
|
||||
XTFASTCALL
|
||||
UCHAR
|
||||
HlpTransformRunLevelToApicTpr(IN KRUNLEVEL RunLevel)
|
||||
HL::RunLevel::TransformRunLevelToApicTpr(IN KRUNLEVEL RunLevel)
|
||||
{
|
||||
STATIC UCHAR TransformationTable[32] =
|
||||
{
|
Reference in New Issue
Block a user