Refactor AR subsystem
This commit is contained in:
@@ -9,11 +9,7 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
/**
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instructs the processor to clear the interrupt flag.
|
* Instructs the processor to clear the interrupt flag.
|
||||||
*
|
*
|
||||||
* @return This routine does not return any value.
|
* @return This routine does not return any value.
|
||||||
@@ -22,7 +18,7 @@ namespace AR
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::ClearInterruptFlag(VOID)
|
AR::CpuFunc::ClearInterruptFlag(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("cli");
|
__asm__ volatile("cli");
|
||||||
}
|
}
|
||||||
@@ -39,7 +35,7 @@ CpuFunc::ClearInterruptFlag(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
AR::CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
||||||
{
|
{
|
||||||
UINT32 MaxLeaf;
|
UINT32 MaxLeaf;
|
||||||
|
|
||||||
@@ -80,7 +76,7 @@ CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::FlushTlb(VOID)
|
AR::CpuFunc::FlushTlb(VOID)
|
||||||
{
|
{
|
||||||
/* Flush the TLB by resetting the CR3 */
|
/* Flush the TLB by resetting the CR3 */
|
||||||
WriteControlRegister(3, ReadControlRegister(3));
|
WriteControlRegister(3, ReadControlRegister(3));
|
||||||
@@ -95,7 +91,7 @@ CpuFunc::FlushTlb(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG
|
ULONG
|
||||||
CpuFunc::GetCpuFlags(VOID)
|
AR::CpuFunc::GetCpuFlags(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
@@ -120,7 +116,7 @@ CpuFunc::GetCpuFlags(VOID)
|
|||||||
XTASSEMBLY
|
XTASSEMBLY
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::GetStackPointer(VOID)
|
AR::CpuFunc::GetStackPointer(VOID)
|
||||||
{
|
{
|
||||||
/* Get current stack pointer */
|
/* Get current stack pointer */
|
||||||
__asm__ volatile("movq %%rsp, %%rax\n"
|
__asm__ volatile("movq %%rsp, %%rax\n"
|
||||||
@@ -139,7 +135,7 @@ CpuFunc::GetStackPointer(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::Halt(VOID)
|
AR::CpuFunc::Halt(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("hlt");
|
__asm__ volatile("hlt");
|
||||||
}
|
}
|
||||||
@@ -153,7 +149,7 @@ CpuFunc::Halt(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CpuFunc::InterruptsEnabled(VOID)
|
AR::CpuFunc::InterruptsEnabled(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
@@ -176,7 +172,7 @@ CpuFunc::InterruptsEnabled(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::InvalidateTlbEntry(IN PVOID Address)
|
AR::CpuFunc::InvalidateTlbEntry(IN PVOID Address)
|
||||||
{
|
{
|
||||||
__asm__ volatile("invlpg (%0)"
|
__asm__ volatile("invlpg (%0)"
|
||||||
:
|
:
|
||||||
@@ -196,7 +192,7 @@ CpuFunc::InvalidateTlbEntry(IN PVOID Address)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
AR::CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lgdt %0"
|
__asm__ volatile("lgdt %0"
|
||||||
:
|
:
|
||||||
@@ -216,7 +212,7 @@ CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
AR::CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lidt %0"
|
__asm__ volatile("lidt %0"
|
||||||
:
|
:
|
||||||
@@ -236,7 +232,7 @@ CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
AR::CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lldtw %0"
|
__asm__ volatile("lldtw %0"
|
||||||
:
|
:
|
||||||
@@ -255,7 +251,7 @@ CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadMxcsrRegister(IN ULONG Source)
|
AR::CpuFunc::LoadMxcsrRegister(IN ULONG Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("ldmxcsr %0"
|
__asm__ volatile("ldmxcsr %0"
|
||||||
:
|
:
|
||||||
@@ -277,7 +273,7 @@ CpuFunc::LoadMxcsrRegister(IN ULONG Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadSegment(IN USHORT Segment,
|
AR::CpuFunc::LoadSegment(IN USHORT Segment,
|
||||||
IN ULONG Source)
|
IN ULONG Source)
|
||||||
{
|
{
|
||||||
switch(Segment)
|
switch(Segment)
|
||||||
@@ -339,7 +335,7 @@ CpuFunc::LoadSegment(IN USHORT Segment,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadTaskRegister(USHORT Source)
|
AR::CpuFunc::LoadTaskRegister(USHORT Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("ltr %0"
|
__asm__ volatile("ltr %0"
|
||||||
:
|
:
|
||||||
@@ -355,7 +351,7 @@ CpuFunc::LoadTaskRegister(USHORT Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::MemoryBarrier(VOID)
|
AR::CpuFunc::MemoryBarrier(VOID)
|
||||||
{
|
{
|
||||||
LONG Barrier;
|
LONG Barrier;
|
||||||
__asm__ volatile("lock; orl $0, %0;"
|
__asm__ volatile("lock; orl $0, %0;"
|
||||||
@@ -375,7 +371,7 @@ CpuFunc::MemoryBarrier(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
AR::CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
||||||
{
|
{
|
||||||
ULONG_PTR Value;
|
ULONG_PTR Value;
|
||||||
|
|
||||||
@@ -439,7 +435,7 @@ CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
AR::CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
||||||
{
|
{
|
||||||
ULONG_PTR Value;
|
ULONG_PTR Value;
|
||||||
|
|
||||||
@@ -508,7 +504,7 @@ CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
CpuFunc::ReadGSQuadWord(ULONG Offset)
|
AR::CpuFunc::ReadGSQuadWord(ULONG Offset)
|
||||||
{
|
{
|
||||||
ULONGLONG Value;
|
ULONGLONG Value;
|
||||||
|
|
||||||
@@ -531,7 +527,7 @@ CpuFunc::ReadGSQuadWord(ULONG Offset)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
AR::CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
||||||
{
|
{
|
||||||
ULONG Low, High;
|
ULONG Low, High;
|
||||||
|
|
||||||
@@ -552,7 +548,7 @@ CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UINT
|
UINT
|
||||||
CpuFunc::ReadMxCsrRegister(VOID)
|
AR::CpuFunc::ReadMxCsrRegister(VOID)
|
||||||
{
|
{
|
||||||
return __builtin_ia32_stmxcsr();
|
return __builtin_ia32_stmxcsr();
|
||||||
}
|
}
|
||||||
@@ -566,7 +562,7 @@ CpuFunc::ReadMxCsrRegister(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
CpuFunc::ReadTimeStampCounter(VOID)
|
AR::CpuFunc::ReadTimeStampCounter(VOID)
|
||||||
{
|
{
|
||||||
ULONGLONG Low, High;
|
ULONGLONG Low, High;
|
||||||
|
|
||||||
@@ -586,7 +582,7 @@ CpuFunc::ReadTimeStampCounter(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::ReadWriteBarrier(VOID)
|
AR::CpuFunc::ReadWriteBarrier(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile(""
|
__asm__ volatile(""
|
||||||
:
|
:
|
||||||
@@ -603,7 +599,7 @@ CpuFunc::ReadWriteBarrier(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::SetInterruptFlag(VOID)
|
AR::CpuFunc::SetInterruptFlag(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sti");
|
__asm__ volatile("sti");
|
||||||
}
|
}
|
||||||
@@ -620,7 +616,7 @@ CpuFunc::SetInterruptFlag(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sgdt %0"
|
__asm__ volatile("sgdt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -640,7 +636,7 @@ CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sidt %0"
|
__asm__ volatile("sidt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -660,7 +656,7 @@ CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sldt %0"
|
__asm__ volatile("sldt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -683,7 +679,7 @@ CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreSegment(IN USHORT Segment,
|
AR::CpuFunc::StoreSegment(IN USHORT Segment,
|
||||||
OUT PVOID Destination)
|
OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
switch(Segment)
|
switch(Segment)
|
||||||
@@ -730,7 +726,7 @@ CpuFunc::StoreSegment(IN USHORT Segment,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
AR::CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("str %0"
|
__asm__ volatile("str %0"
|
||||||
: "=m" (*(PULONG)Destination)
|
: "=m" (*(PULONG)Destination)
|
||||||
@@ -753,7 +749,7 @@ CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
AR::CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
||||||
IN UINT_PTR Value)
|
IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
/* Write a value into specified control register */
|
/* Write a value into specified control register */
|
||||||
@@ -812,7 +808,7 @@ CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
AR::CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
||||||
IN UINT_PTR Value)
|
IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
/* Write a value into specified debug register */
|
/* Write a value into specified debug register */
|
||||||
@@ -889,7 +885,7 @@ CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
AR::CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
__asm__ volatile("push %0\n"
|
__asm__ volatile("push %0\n"
|
||||||
"popf"
|
"popf"
|
||||||
@@ -912,7 +908,7 @@ CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
AR::CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
||||||
IN ULONGLONG Value)
|
IN ULONGLONG Value)
|
||||||
{
|
{
|
||||||
ULONG Low = Value & 0xFFFFFFFF;
|
ULONG Low = Value & 0xFFFFFFFF;
|
||||||
@@ -934,7 +930,7 @@ CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::YieldProcessor(VOID)
|
AR::CpuFunc::YieldProcessor(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("pause"
|
__asm__ volatile("pause"
|
||||||
:
|
:
|
||||||
@@ -942,7 +938,7 @@ CpuFunc::YieldProcessor(VOID)
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
/* NEEDED BY XTLDR */
|
/* NEEDED BY XTLDR */
|
||||||
XTCLINK
|
XTCLINK
|
||||||
|
@@ -9,26 +9,20 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Initial kernel boot stack */
|
/* Initial kernel boot stack */
|
||||||
UCHAR ProcSup::BootStack[KERNEL_STACK_SIZE] = {};
|
UCHAR AR::ProcSup::BootStack[KERNEL_STACK_SIZE] = {};
|
||||||
|
|
||||||
/* Initial kernel fault stack */
|
/* Initial kernel fault stack */
|
||||||
UCHAR ProcSup::FaultStack[KERNEL_STACK_SIZE] = {};
|
UCHAR AR::ProcSup::FaultStack[KERNEL_STACK_SIZE] = {};
|
||||||
|
|
||||||
/* Initial GDT */
|
/* Initial GDT */
|
||||||
KGDTENTRY ProcSup::InitialGdt[GDT_ENTRIES] = {};
|
KGDTENTRY AR::ProcSup::InitialGdt[GDT_ENTRIES] = {};
|
||||||
|
|
||||||
/* Initial IDT */
|
/* Initial IDT */
|
||||||
KIDTENTRY ProcSup::InitialIdt[IDT_ENTRIES] = {};
|
KIDTENTRY AR::ProcSup::InitialIdt[IDT_ENTRIES] = {};
|
||||||
|
|
||||||
/* Initial Processor Block */
|
/* Initial Processor Block */
|
||||||
KPROCESSOR_BLOCK ProcSup::InitialProcessorBlock;
|
KPROCESSOR_BLOCK AR::ProcSup::InitialProcessorBlock;
|
||||||
|
|
||||||
/* Initial TSS */
|
/* Initial TSS */
|
||||||
KTSS ProcSup::InitialTss;
|
KTSS AR::ProcSup::InitialTss;
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base address of the kernel boot stack.
|
* Gets the base address of the kernel boot stack.
|
||||||
*
|
*
|
||||||
@@ -20,7 +16,9 @@ namespace AR
|
|||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
PVOID ProcSup::GetBootStack(VOID)
|
XTAPI
|
||||||
|
PVOID
|
||||||
|
AR::ProcSup::GetBootStack(VOID)
|
||||||
{
|
{
|
||||||
return (PVOID)BootStack;
|
return (PVOID)BootStack;
|
||||||
}
|
}
|
||||||
@@ -35,7 +33,7 @@ PVOID ProcSup::GetBootStack(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::IdentifyProcessor(VOID)
|
AR::ProcSup::IdentifyProcessor(VOID)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
||||||
CPUID_REGISTERS CpuRegisters;
|
CPUID_REGISTERS CpuRegisters;
|
||||||
@@ -111,7 +109,7 @@ ProcSup::IdentifyProcessor(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
AR::ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
||||||
{
|
{
|
||||||
KDESCRIPTOR GdtDescriptor, IdtDescriptor;
|
KDESCRIPTOR GdtDescriptor, IdtDescriptor;
|
||||||
PVOID KernelBootStack, KernelFaultStack;
|
PVOID KernelBootStack, KernelFaultStack;
|
||||||
@@ -189,7 +187,7 @@ ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
AR::ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
||||||
{
|
{
|
||||||
/* Initialize GDT entries */
|
/* Initialize GDT entries */
|
||||||
SetGdtEntry(ProcessorBlock->GdtBase, KGDT_NULL, 0x0, 0x0, KGDT_TYPE_NONE, KGDT_DPL_SYSTEM, 1);
|
SetGdtEntry(ProcessorBlock->GdtBase, KGDT_NULL, 0x0, 0x0, KGDT_TYPE_NONE, KGDT_DPL_SYSTEM, 1);
|
||||||
@@ -218,7 +216,7 @@ ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
AR::ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
||||||
{
|
{
|
||||||
UINT Vector;
|
UINT Vector;
|
||||||
|
|
||||||
@@ -277,11 +275,11 @@ ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PKGDTENTRY Gdt,
|
IN PKGDTENTRY Gdt,
|
||||||
IN PKIDTENTRY Idt,
|
IN PKIDTENTRY Idt,
|
||||||
IN PKTSS Tss,
|
IN PKTSS Tss,
|
||||||
IN PVOID DpcStack)
|
IN PVOID DpcStack)
|
||||||
{
|
{
|
||||||
/* Set processor block and processor control block */
|
/* Set processor block and processor control block */
|
||||||
ProcessorBlock->Self = ProcessorBlock;
|
ProcessorBlock->Self = ProcessorBlock;
|
||||||
@@ -327,7 +325,7 @@ ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorRegisters(VOID)
|
AR::ProcSup::InitializeProcessorRegisters(VOID)
|
||||||
{
|
{
|
||||||
ULONGLONG PatAttributes;
|
ULONGLONG PatAttributes;
|
||||||
|
|
||||||
@@ -400,12 +398,12 @@ ProcSup::InitializeProcessorRegisters(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
AR::ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
||||||
OUT PKGDTENTRY *Gdt,
|
OUT PKGDTENTRY *Gdt,
|
||||||
OUT PKTSS *Tss,
|
OUT PKTSS *Tss,
|
||||||
OUT PKPROCESSOR_BLOCK *ProcessorBlock,
|
OUT PKPROCESSOR_BLOCK *ProcessorBlock,
|
||||||
OUT PVOID *KernelBootStack,
|
OUT PVOID *KernelBootStack,
|
||||||
OUT PVOID *KernelFaultStack)
|
OUT PVOID *KernelFaultStack)
|
||||||
{
|
{
|
||||||
UINT_PTR Address;
|
UINT_PTR Address;
|
||||||
|
|
||||||
@@ -440,7 +438,7 @@ ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeSegments(VOID)
|
AR::ProcSup::InitializeSegments(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
||||||
@@ -466,9 +464,9 @@ ProcSup::InitializeSegments(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PVOID KernelBootStack,
|
IN PVOID KernelBootStack,
|
||||||
IN PVOID KernelFaultStack)
|
IN PVOID KernelFaultStack)
|
||||||
{
|
{
|
||||||
/* Fill TSS with zeroes */
|
/* Fill TSS with zeroes */
|
||||||
RtlZeroMemory(ProcessorBlock->TssBase, sizeof(KTSS));
|
RtlZeroMemory(ProcessorBlock->TssBase, sizeof(KTSS));
|
||||||
@@ -510,13 +508,13 @@ ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
AR::ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN ULONG_PTR Base,
|
IN ULONG_PTR Base,
|
||||||
IN ULONG Limit,
|
IN ULONG Limit,
|
||||||
IN UCHAR Type,
|
IN UCHAR Type,
|
||||||
IN UCHAR Dpl,
|
IN UCHAR Dpl,
|
||||||
IN UCHAR SegmentMode)
|
IN UCHAR SegmentMode)
|
||||||
{
|
{
|
||||||
PKGDTENTRY GdtEntry;
|
PKGDTENTRY GdtEntry;
|
||||||
UCHAR Granularity;
|
UCHAR Granularity;
|
||||||
@@ -576,9 +574,9 @@ ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
AR::ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN ULONG_PTR Base)
|
IN ULONG_PTR Base)
|
||||||
{
|
{
|
||||||
PKGDTENTRY GdtEntry;
|
PKGDTENTRY GdtEntry;
|
||||||
|
|
||||||
@@ -619,12 +617,12 @@ ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
AR::ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
||||||
IN USHORT Vector,
|
IN USHORT Vector,
|
||||||
IN PVOID Handler,
|
IN PVOID Handler,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN USHORT Ist,
|
IN USHORT Ist,
|
||||||
IN USHORT Access)
|
IN USHORT Access)
|
||||||
{
|
{
|
||||||
/* Setup the gate */
|
/* Setup the gate */
|
||||||
Idt[Vector].OffsetLow = ((ULONG_PTR)Handler & 0xFFFF);
|
Idt[Vector].OffsetLow = ((ULONG_PTR)Handler & 0xFFFF);
|
||||||
@@ -636,24 +634,3 @@ ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
|||||||
Idt[Vector].Selector = Selector;
|
Idt[Vector].Selector = Selector;
|
||||||
Idt[Vector].Type = 0xE;
|
Idt[Vector].Type = 0xE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
|
||||||
XTCLINK
|
|
||||||
XTAPI
|
|
||||||
PVOID
|
|
||||||
ArGetBootStack(VOID)
|
|
||||||
{
|
|
||||||
return AR::ProcSup::GetBootStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
|
||||||
XTCLINK
|
|
||||||
XTAPI
|
|
||||||
VOID
|
|
||||||
ArInitializeProcessor(IN PVOID ProcessorStructures)
|
|
||||||
{
|
|
||||||
AR::ProcSup::InitializeProcessor(ProcessorStructures);
|
|
||||||
}
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches the trap provided by common trap handler.
|
* Dispatches the trap provided by common trap handler.
|
||||||
*
|
*
|
||||||
@@ -25,7 +21,7 @@ namespace AR
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
/* Check vector and call appropriate handler */
|
/* Check vector and call appropriate handler */
|
||||||
switch(TrapFrame->Vector)
|
switch(TrapFrame->Vector)
|
||||||
@@ -142,7 +138,7 @@ Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleSystemCall32(VOID)
|
AR::Traps::HandleSystemCall32(VOID)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled 32-bit system call!\n");
|
DebugPrint(L"Handled 32-bit system call!\n");
|
||||||
}
|
}
|
||||||
@@ -156,7 +152,7 @@ Traps::HandleSystemCall32(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleSystemCall64(VOID)
|
AR::Traps::HandleSystemCall64(VOID)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled 64-bit system call!\n");
|
DebugPrint(L"Handled 64-bit system call!\n");
|
||||||
}
|
}
|
||||||
@@ -173,7 +169,7 @@ Traps::HandleSystemCall64(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
|
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -191,7 +187,7 @@ Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Debug exception (0x01)!\n");
|
DebugPrint(L"Handled Debug exception (0x01)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -209,7 +205,7 @@ Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
|
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -227,7 +223,7 @@ Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled INT3 (0x03)!\n");
|
DebugPrint(L"Handled INT3 (0x03)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -245,7 +241,7 @@ Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Overflow exception (0x04)!\n");
|
DebugPrint(L"Handled Overflow exception (0x04)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -263,7 +259,7 @@ Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
|
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -281,7 +277,7 @@ Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
|
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -299,7 +295,7 @@ Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
|
DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -317,7 +313,7 @@ Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
|
DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -335,7 +331,7 @@ Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
|
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -353,7 +349,7 @@ Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
|
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -371,7 +367,7 @@ Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
|
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -389,7 +385,7 @@ Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
|
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -407,7 +403,7 @@ Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
|
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -425,7 +421,7 @@ Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
|
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -443,7 +439,7 @@ Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
|
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -461,7 +457,7 @@ Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
|
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -479,7 +475,7 @@ Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
|
DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -497,7 +493,7 @@ Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
|
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -515,7 +511,7 @@ Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap1F(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap1F(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled software interrupt at APC level (0x1F)!\n");
|
DebugPrint(L"Unhandled software interrupt at APC level (0x1F)!\n");
|
||||||
}
|
}
|
||||||
@@ -532,7 +528,7 @@ Traps::HandleTrap1F(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Assertion (0x2C)!\n");
|
DebugPrint(L"Handled Assertion (0x2C)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -550,7 +546,7 @@ Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
|
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -568,7 +564,7 @@ Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2F(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2F(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled software interrupt at DISPATCH level (0x2F)!\n");
|
DebugPrint(L"Unhandled software interrupt at DISPATCH level (0x2F)!\n");
|
||||||
}
|
}
|
||||||
@@ -585,7 +581,7 @@ Traps::HandleTrap2F(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrapE1(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrapE1(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled IPI interrupt (0xE1)!\n");
|
DebugPrint(L"Unhandled IPI interrupt (0xE1)!\n");
|
||||||
}
|
}
|
||||||
@@ -602,7 +598,7 @@ Traps::HandleTrapE1(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
|
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -617,7 +613,7 @@ Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::InitializeSystemCallMsrs(VOID)
|
AR::Traps::InitializeSystemCallMsrs(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize system calls MSR */
|
/* Initialize system calls MSR */
|
||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_STAR, (((ULONG64)KGDT_R3_CMCODE | RPL_MASK) << 48) | ((ULONG64)KGDT_R0_CODE << 32));
|
CpuFunc::WriteModelSpecificRegister(X86_MSR_STAR, (((ULONG64)KGDT_R3_CMCODE | RPL_MASK) << 48) | ((ULONG64)KGDT_R0_CODE << 32));
|
||||||
@@ -629,8 +625,6 @@ Traps::InitializeSystemCallMsrs(VOID)
|
|||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_EFER, CpuFunc::ReadModelSpecificRegister(X86_MSR_EFER) | X86_MSR_EFER_SCE);
|
CpuFunc::WriteModelSpecificRegister(X86_MSR_EFER, CpuFunc::ReadModelSpecificRegister(X86_MSR_EFER) | X86_MSR_EFER_SCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C-linkage wrapper for dispatching the trap provided by common trap handler.
|
* C-linkage wrapper for dispatching the trap provided by common trap handler.
|
||||||
*
|
*
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instructs the processor to clear the interrupt flag.
|
* Instructs the processor to clear the interrupt flag.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace AR
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::ClearInterruptFlag(VOID)
|
AR::CpuFunc::ClearInterruptFlag(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("cli");
|
__asm__ volatile("cli");
|
||||||
}
|
}
|
||||||
@@ -39,7 +35,7 @@ CpuFunc::ClearInterruptFlag(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
AR::CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
||||||
{
|
{
|
||||||
UINT32 MaxLeaf;
|
UINT32 MaxLeaf;
|
||||||
|
|
||||||
@@ -80,7 +76,7 @@ CpuFunc::CpuId(IN OUT PCPUID_REGISTERS Registers)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::FlushTlb(VOID)
|
AR::CpuFunc::FlushTlb(VOID)
|
||||||
{
|
{
|
||||||
/* Flush the TLB by resetting the CR3 */
|
/* Flush the TLB by resetting the CR3 */
|
||||||
ArWriteControlRegister(3, ArReadControlRegister(3));
|
ArWriteControlRegister(3, ArReadControlRegister(3));
|
||||||
@@ -95,7 +91,7 @@ CpuFunc::FlushTlb(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG
|
ULONG
|
||||||
CpuFunc::GetCpuFlags(VOID)
|
AR::CpuFunc::GetCpuFlags(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
@@ -120,7 +116,7 @@ CpuFunc::GetCpuFlags(VOID)
|
|||||||
XTASSEMBLY
|
XTASSEMBLY
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::GetStackPointer(VOID)
|
AR::CpuFunc::GetStackPointer(VOID)
|
||||||
{
|
{
|
||||||
/* Get current stack pointer */
|
/* Get current stack pointer */
|
||||||
__asm__ volatile("mov %%esp, %%eax\n"
|
__asm__ volatile("mov %%esp, %%eax\n"
|
||||||
@@ -139,7 +135,7 @@ CpuFunc::GetStackPointer(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::Halt(VOID)
|
AR::CpuFunc::Halt(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("hlt");
|
__asm__ volatile("hlt");
|
||||||
}
|
}
|
||||||
@@ -153,7 +149,7 @@ CpuFunc::Halt(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CpuFunc::InterruptsEnabled(VOID)
|
AR::CpuFunc::InterruptsEnabled(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Flags;
|
ULONG_PTR Flags;
|
||||||
|
|
||||||
@@ -176,7 +172,7 @@ CpuFunc::InterruptsEnabled(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::InvalidateTlbEntry(PVOID Address)
|
AR::CpuFunc::InvalidateTlbEntry(PVOID Address)
|
||||||
{
|
{
|
||||||
__asm__ volatile("invlpg (%0)"
|
__asm__ volatile("invlpg (%0)"
|
||||||
:
|
:
|
||||||
@@ -196,7 +192,7 @@ CpuFunc::InvalidateTlbEntry(PVOID Address)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
AR::CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lgdt %0"
|
__asm__ volatile("lgdt %0"
|
||||||
:
|
:
|
||||||
@@ -216,7 +212,7 @@ CpuFunc::LoadGlobalDescriptorTable(IN PVOID Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
AR::CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lidt %0"
|
__asm__ volatile("lidt %0"
|
||||||
:
|
:
|
||||||
@@ -236,7 +232,7 @@ CpuFunc::LoadInterruptDescriptorTable(IN PVOID Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
AR::CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("lldtw %0"
|
__asm__ volatile("lldtw %0"
|
||||||
:
|
:
|
||||||
@@ -258,7 +254,7 @@ CpuFunc::LoadLocalDescriptorTable(IN USHORT Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadSegment(IN USHORT Segment,
|
AR::CpuFunc::LoadSegment(IN USHORT Segment,
|
||||||
IN ULONG Source)
|
IN ULONG Source)
|
||||||
{
|
{
|
||||||
switch(Segment)
|
switch(Segment)
|
||||||
@@ -320,7 +316,7 @@ CpuFunc::LoadSegment(IN USHORT Segment,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::LoadTaskRegister(USHORT Source)
|
AR::CpuFunc::LoadTaskRegister(USHORT Source)
|
||||||
{
|
{
|
||||||
__asm__ volatile("ltr %0"
|
__asm__ volatile("ltr %0"
|
||||||
:
|
:
|
||||||
@@ -336,7 +332,7 @@ CpuFunc::LoadTaskRegister(USHORT Source)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::MemoryBarrier(VOID)
|
AR::CpuFunc::MemoryBarrier(VOID)
|
||||||
{
|
{
|
||||||
LONG Barrier;
|
LONG Barrier;
|
||||||
__asm__ volatile("xchg %%eax, %0"
|
__asm__ volatile("xchg %%eax, %0"
|
||||||
@@ -357,7 +353,7 @@ CpuFunc::MemoryBarrier(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
AR::CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
||||||
{
|
{
|
||||||
ULONG_PTR Value;
|
ULONG_PTR Value;
|
||||||
|
|
||||||
@@ -414,7 +410,7 @@ CpuFunc::ReadControlRegister(IN USHORT ControlRegister)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG_PTR
|
ULONG_PTR
|
||||||
CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
AR::CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
||||||
{
|
{
|
||||||
ULONG_PTR Value;
|
ULONG_PTR Value;
|
||||||
|
|
||||||
@@ -483,7 +479,7 @@ CpuFunc::ReadDebugRegister(IN USHORT DebugRegister)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONG
|
ULONG
|
||||||
CpuFunc::ReadFSDualWord(ULONG Offset)
|
AR::CpuFunc::ReadFSDualWord(ULONG Offset)
|
||||||
{
|
{
|
||||||
ULONG Value;
|
ULONG Value;
|
||||||
__asm__ volatile("movl %%fs:%a[Offset], %k[Value]"
|
__asm__ volatile("movl %%fs:%a[Offset], %k[Value]"
|
||||||
@@ -504,7 +500,7 @@ CpuFunc::ReadFSDualWord(ULONG Offset)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
AR::CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
||||||
{
|
{
|
||||||
ULONGLONG Value;
|
ULONGLONG Value;
|
||||||
|
|
||||||
@@ -523,7 +519,7 @@ CpuFunc::ReadModelSpecificRegister(IN ULONG Register)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UINT
|
UINT
|
||||||
CpuFunc::ReadMxCsrRegister(VOID)
|
AR::CpuFunc::ReadMxCsrRegister(VOID)
|
||||||
{
|
{
|
||||||
return __builtin_ia32_stmxcsr();
|
return __builtin_ia32_stmxcsr();
|
||||||
}
|
}
|
||||||
@@ -537,7 +533,7 @@ CpuFunc::ReadMxCsrRegister(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
CpuFunc::ReadTimeStampCounter(VOID)
|
AR::CpuFunc::ReadTimeStampCounter(VOID)
|
||||||
{
|
{
|
||||||
ULONGLONG Value;
|
ULONGLONG Value;
|
||||||
|
|
||||||
@@ -556,7 +552,7 @@ CpuFunc::ReadTimeStampCounter(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::ReadWriteBarrier(VOID)
|
AR::CpuFunc::ReadWriteBarrier(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile(""
|
__asm__ volatile(""
|
||||||
:
|
:
|
||||||
@@ -573,7 +569,7 @@ CpuFunc::ReadWriteBarrier(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::SetInterruptFlag(VOID)
|
AR::CpuFunc::SetInterruptFlag(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sti");
|
__asm__ volatile("sti");
|
||||||
}
|
}
|
||||||
@@ -590,7 +586,7 @@ CpuFunc::SetInterruptFlag(VOID)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sgdt %0"
|
__asm__ volatile("sgdt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -610,7 +606,7 @@ CpuFunc::StoreGlobalDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sidt %0"
|
__asm__ volatile("sidt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -630,7 +626,7 @@ CpuFunc::StoreInterruptDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
AR::CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("sldt %0"
|
__asm__ volatile("sldt %0"
|
||||||
: "=m" (*(PSHORT)Destination)
|
: "=m" (*(PSHORT)Destination)
|
||||||
@@ -653,7 +649,7 @@ CpuFunc::StoreLocalDescriptorTable(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreSegment(IN USHORT Segment,
|
AR::CpuFunc::StoreSegment(IN USHORT Segment,
|
||||||
OUT PVOID Destination)
|
OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
switch(Segment)
|
switch(Segment)
|
||||||
@@ -700,7 +696,7 @@ CpuFunc::StoreSegment(IN USHORT Segment,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
AR::CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
||||||
{
|
{
|
||||||
__asm__ volatile("str %0"
|
__asm__ volatile("str %0"
|
||||||
: "=m" (*(PULONG)Destination)
|
: "=m" (*(PULONG)Destination)
|
||||||
@@ -723,7 +719,7 @@ CpuFunc::StoreTaskRegister(OUT PVOID Destination)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
AR::CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
||||||
IN UINT_PTR Value)
|
IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
/* Write a value into specified control register */
|
/* Write a value into specified control register */
|
||||||
@@ -775,7 +771,7 @@ CpuFunc::WriteControlRegister(IN USHORT ControlRegister,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
AR::CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
||||||
IN UINT_PTR Value)
|
IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
/* Write a value into specified debug register */
|
/* Write a value into specified debug register */
|
||||||
@@ -844,7 +840,7 @@ CpuFunc::WriteDebugRegister(IN USHORT DebugRegister,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
AR::CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
||||||
{
|
{
|
||||||
__asm__ volatile("push %0\n"
|
__asm__ volatile("push %0\n"
|
||||||
"popf"
|
"popf"
|
||||||
@@ -867,7 +863,7 @@ CpuFunc::WriteEflagsRegister(IN UINT_PTR Value)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
AR::CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
||||||
IN ULONGLONG Value)
|
IN ULONGLONG Value)
|
||||||
{
|
{
|
||||||
__asm__ volatile("wrmsr"
|
__asm__ volatile("wrmsr"
|
||||||
@@ -885,7 +881,7 @@ CpuFunc::WriteModelSpecificRegister(IN ULONG Register,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
CpuFunc::YieldProcessor(VOID)
|
AR::CpuFunc::YieldProcessor(VOID)
|
||||||
{
|
{
|
||||||
__asm__ volatile("pause"
|
__asm__ volatile("pause"
|
||||||
:
|
:
|
||||||
@@ -893,7 +889,7 @@ CpuFunc::YieldProcessor(VOID)
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
/* NEEDED BY XTLDR */
|
/* NEEDED BY XTLDR */
|
||||||
XTCLINK
|
XTCLINK
|
||||||
|
@@ -9,32 +9,26 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Initial kernel boot stack */
|
/* Initial kernel boot stack */
|
||||||
UCHAR ProcSup::BootStack[KERNEL_STACK_SIZE] = {};
|
UCHAR AR::ProcSup::BootStack[KERNEL_STACK_SIZE] = {};
|
||||||
|
|
||||||
/* Double Fault gate */
|
/* Double Fault gate */
|
||||||
UCHAR ProcSup::DoubleFaultTss[KTSS_IO_MAPS];
|
UCHAR AR::ProcSup::DoubleFaultTss[KTSS_IO_MAPS];
|
||||||
|
|
||||||
/* Initial kernel fault stack */
|
/* Initial kernel fault stack */
|
||||||
UCHAR ProcSup::FaultStack[KERNEL_STACK_SIZE] = {};
|
UCHAR AR::ProcSup::FaultStack[KERNEL_STACK_SIZE] = {};
|
||||||
|
|
||||||
/* Initial GDT */
|
/* Initial GDT */
|
||||||
KGDTENTRY ProcSup::InitialGdt[GDT_ENTRIES] = {};
|
KGDTENTRY AR::ProcSup::InitialGdt[GDT_ENTRIES] = {};
|
||||||
|
|
||||||
/* Initial IDT */
|
/* Initial IDT */
|
||||||
KIDTENTRY ProcSup::InitialIdt[IDT_ENTRIES] = {};
|
KIDTENTRY AR::ProcSup::InitialIdt[IDT_ENTRIES] = {};
|
||||||
|
|
||||||
/* Initial Processor Block */
|
/* Initial Processor Block */
|
||||||
KPROCESSOR_BLOCK ProcSup::InitialProcessorBlock;
|
KPROCESSOR_BLOCK AR::ProcSup::InitialProcessorBlock;
|
||||||
|
|
||||||
/* Initial TSS */
|
/* Initial TSS */
|
||||||
KTSS ProcSup::InitialTss;
|
KTSS AR::ProcSup::InitialTss;
|
||||||
|
|
||||||
/* NMI task gate */
|
/* NMI task gate */
|
||||||
UCHAR ProcSup::NonMaskableInterruptTss[KTSS_IO_MAPS];
|
UCHAR AR::ProcSup::NonMaskableInterruptTss[KTSS_IO_MAPS];
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base address of the kernel boot stack.
|
* Gets the base address of the kernel boot stack.
|
||||||
*
|
*
|
||||||
@@ -20,7 +16,9 @@ namespace AR
|
|||||||
*
|
*
|
||||||
* @since XT 1.0
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
PVOID ProcSup::GetBootStack(VOID)
|
XTAPI
|
||||||
|
PVOID
|
||||||
|
AR::ProcSup::GetBootStack(VOID)
|
||||||
{
|
{
|
||||||
return (PVOID)BootStack;
|
return (PVOID)BootStack;
|
||||||
}
|
}
|
||||||
@@ -35,7 +33,7 @@ PVOID ProcSup::GetBootStack(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::IdentifyProcessor(VOID)
|
AR::ProcSup::IdentifyProcessor(VOID)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
||||||
CPUID_REGISTERS CpuRegisters;
|
CPUID_REGISTERS CpuRegisters;
|
||||||
@@ -111,7 +109,7 @@ ProcSup::IdentifyProcessor(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
AR::ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
||||||
{
|
{
|
||||||
KDESCRIPTOR GdtDescriptor, IdtDescriptor;
|
KDESCRIPTOR GdtDescriptor, IdtDescriptor;
|
||||||
PVOID KernelBootStack, KernelFaultStack;
|
PVOID KernelBootStack, KernelFaultStack;
|
||||||
@@ -185,7 +183,7 @@ ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
AR::ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
||||||
{
|
{
|
||||||
/* Initialize GDT entries */
|
/* Initialize GDT entries */
|
||||||
SetGdtEntry(ProcessorBlock->GdtBase, KGDT_NULL, 0x0, 0x0, KGDT_TYPE_NONE, KGDT_DPL_SYSTEM, 0);
|
SetGdtEntry(ProcessorBlock->GdtBase, KGDT_NULL, 0x0, 0x0, KGDT_TYPE_NONE, KGDT_DPL_SYSTEM, 0);
|
||||||
@@ -216,7 +214,7 @@ ProcSup::InitializeGdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
AR::ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
||||||
{
|
{
|
||||||
UINT Vector;
|
UINT Vector;
|
||||||
|
|
||||||
@@ -275,11 +273,11 @@ ProcSup::InitializeIdt(IN PKPROCESSOR_BLOCK ProcessorBlock)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PKGDTENTRY Gdt,
|
IN PKGDTENTRY Gdt,
|
||||||
IN PKIDTENTRY Idt,
|
IN PKIDTENTRY Idt,
|
||||||
IN PKTSS Tss,
|
IN PKTSS Tss,
|
||||||
IN PVOID DpcStack)
|
IN PVOID DpcStack)
|
||||||
{
|
{
|
||||||
/* Set processor block and processor control block */
|
/* Set processor block and processor control block */
|
||||||
ProcessorBlock->Self = ProcessorBlock;
|
ProcessorBlock->Self = ProcessorBlock;
|
||||||
@@ -321,7 +319,7 @@ ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorRegisters(VOID)
|
AR::ProcSup::InitializeProcessorRegisters(VOID)
|
||||||
{
|
{
|
||||||
/* Clear EFLAGS register */
|
/* Clear EFLAGS register */
|
||||||
CpuFunc::WriteEflagsRegister(0);
|
CpuFunc::WriteEflagsRegister(0);
|
||||||
@@ -357,12 +355,12 @@ ProcSup::InitializeProcessorRegisters(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
AR::ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
||||||
OUT PKGDTENTRY *Gdt,
|
OUT PKGDTENTRY *Gdt,
|
||||||
OUT PKTSS *Tss,
|
OUT PKTSS *Tss,
|
||||||
OUT PKPROCESSOR_BLOCK *ProcessorBlock,
|
OUT PKPROCESSOR_BLOCK *ProcessorBlock,
|
||||||
OUT PVOID *KernelBootStack,
|
OUT PVOID *KernelBootStack,
|
||||||
OUT PVOID *KernelFaultStack)
|
OUT PVOID *KernelFaultStack)
|
||||||
{
|
{
|
||||||
UINT_PTR Address;
|
UINT_PTR Address;
|
||||||
|
|
||||||
@@ -397,7 +395,7 @@ ProcSup::InitializeProcessorStructures(IN PVOID ProcessorStructures,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeSegments(VOID)
|
AR::ProcSup::InitializeSegments(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
||||||
@@ -418,9 +416,9 @@ ProcSup::InitializeSegments(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PVOID KernelBootStack,
|
IN PVOID KernelBootStack,
|
||||||
IN PVOID KernelFaultStack)
|
IN PVOID KernelFaultStack)
|
||||||
{
|
{
|
||||||
/* Clear I/O map */
|
/* Clear I/O map */
|
||||||
RtlSetMemory(ProcessorBlock->TssBase->IoMaps[0].IoMap, 0xFF, IOPM_FULL_SIZE);
|
RtlSetMemory(ProcessorBlock->TssBase->IoMaps[0].IoMap, 0xFF, IOPM_FULL_SIZE);
|
||||||
@@ -467,8 +465,8 @@ ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetDoubleFaultTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::SetDoubleFaultTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PVOID KernelFaultStack)
|
IN PVOID KernelFaultStack)
|
||||||
{
|
{
|
||||||
PKGDTENTRY TaskGateEntry, TssEntry;
|
PKGDTENTRY TaskGateEntry, TssEntry;
|
||||||
PKTSS Tss;
|
PKTSS Tss;
|
||||||
@@ -538,13 +536,13 @@ ProcSup::SetDoubleFaultTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
AR::ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN ULONG_PTR Base,
|
IN ULONG_PTR Base,
|
||||||
IN ULONG Limit,
|
IN ULONG Limit,
|
||||||
IN UCHAR Type,
|
IN UCHAR Type,
|
||||||
IN UCHAR Dpl,
|
IN UCHAR Dpl,
|
||||||
IN UCHAR SegmentMode)
|
IN UCHAR SegmentMode)
|
||||||
{
|
{
|
||||||
PKGDTENTRY GdtEntry;
|
PKGDTENTRY GdtEntry;
|
||||||
UCHAR Granularity;
|
UCHAR Granularity;
|
||||||
@@ -602,9 +600,9 @@ ProcSup::SetGdtEntry(IN PKGDTENTRY Gdt,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
AR::ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN ULONG_PTR Base)
|
IN ULONG_PTR Base)
|
||||||
{
|
{
|
||||||
PKGDTENTRY GdtEntry;
|
PKGDTENTRY GdtEntry;
|
||||||
|
|
||||||
@@ -644,12 +642,12 @@ ProcSup::SetGdtEntryBase(IN PKGDTENTRY Gdt,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
AR::ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
||||||
IN USHORT Vector,
|
IN USHORT Vector,
|
||||||
IN PVOID Handler,
|
IN PVOID Handler,
|
||||||
IN USHORT Selector,
|
IN USHORT Selector,
|
||||||
IN USHORT Ist,
|
IN USHORT Ist,
|
||||||
IN USHORT Access)
|
IN USHORT Access)
|
||||||
{
|
{
|
||||||
/* Setup the gate */
|
/* Setup the gate */
|
||||||
Idt[Vector].Offset = (USHORT)((ULONG)Handler & 0xFFFF);
|
Idt[Vector].Offset = (USHORT)((ULONG)Handler & 0xFFFF);
|
||||||
@@ -670,8 +668,8 @@ ProcSup::SetIdtGate(IN PKIDTENTRY Idt,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
ProcSup::SetNonMaskableInterruptTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
AR::ProcSup::SetNonMaskableInterruptTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
||||||
IN PVOID KernelFaultStack)
|
IN PVOID KernelFaultStack)
|
||||||
{
|
{
|
||||||
PKGDTENTRY TaskGateEntry, TssEntry;
|
PKGDTENTRY TaskGateEntry, TssEntry;
|
||||||
PKTSS Tss;
|
PKTSS Tss;
|
||||||
@@ -709,24 +707,3 @@ ProcSup::SetNonMaskableInterruptTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
TssEntry->Bits.Present = 1;
|
TssEntry->Bits.Present = 1;
|
||||||
TssEntry->Bits.Type = I686_TSS;
|
TssEntry->Bits.Type = I686_TSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
|
||||||
XTCLINK
|
|
||||||
XTAPI
|
|
||||||
PVOID
|
|
||||||
ArGetBootStack(VOID)
|
|
||||||
{
|
|
||||||
return AR::ProcSup::GetBootStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
|
||||||
XTCLINK
|
|
||||||
XTAPI
|
|
||||||
VOID
|
|
||||||
ArInitializeProcessor(IN PVOID ProcessorStructures)
|
|
||||||
{
|
|
||||||
AR::ProcSup::InitializeProcessor(ProcessorStructures);
|
|
||||||
}
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Architecture-specific Library */
|
|
||||||
namespace AR
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches the trap provided by common trap handler.
|
* Dispatches the trap provided by common trap handler.
|
||||||
*
|
*
|
||||||
@@ -25,7 +21,7 @@ namespace AR
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
/* Check vector and call appropriate handler */
|
/* Check vector and call appropriate handler */
|
||||||
switch(TrapFrame->Vector)
|
switch(TrapFrame->Vector)
|
||||||
@@ -145,7 +141,7 @@ Traps::DispatchTrap(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
|
DebugPrint(L"Handled Division-By-Zero Error (0x00)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -163,7 +159,7 @@ Traps::HandleTrap00(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Debug exception (0x01)!\n");
|
DebugPrint(L"Handled Debug exception (0x01)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -181,7 +177,7 @@ Traps::HandleTrap01(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
|
DebugPrint(L"Handled Non-Maskable-Interrupt (0x02)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -199,7 +195,7 @@ Traps::HandleTrap02(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled INT3 (0x03)!\n");
|
DebugPrint(L"Handled INT3 (0x03)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -217,7 +213,7 @@ Traps::HandleTrap03(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Overflow exception (0x04)!\n");
|
DebugPrint(L"Handled Overflow exception (0x04)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -235,7 +231,7 @@ Traps::HandleTrap04(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
|
DebugPrint(L"Handled Bound-Range-Exceeded exception (0x05)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -253,7 +249,7 @@ Traps::HandleTrap05(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
|
DebugPrint(L"Handled Invalid Opcode exception (0x06)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -271,7 +267,7 @@ Traps::HandleTrap06(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
|
DebugPrint(L"Handled Device Not Available exception (0x07)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -289,7 +285,7 @@ Traps::HandleTrap07(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
|
DebugPrint(L"Handled Double-Fault exception (0x08)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -307,7 +303,7 @@ Traps::HandleTrap08(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
|
DebugPrint(L"Handled Segment-Overrun exception (0x09)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -325,7 +321,7 @@ Traps::HandleTrap09(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
|
DebugPrint(L"Handled Invalid-TSS exception (0x0A)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -343,7 +339,7 @@ Traps::HandleTrap0A(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
|
DebugPrint(L"Handled Segment-Not-Present exception (0x0B)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -361,7 +357,7 @@ Traps::HandleTrap0B(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
|
DebugPrint(L"Handled Stack-Segment-Fault exception (0x0C)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -379,7 +375,7 @@ Traps::HandleTrap0C(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
|
DebugPrint(L"Handled General-Protection-Fault (0x0D)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -397,7 +393,7 @@ Traps::HandleTrap0D(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
|
DebugPrint(L"Handled Page-Fault exception (0x0E)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -415,7 +411,7 @@ Traps::HandleTrap0E(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
|
DebugPrint(L"Handled x87 Floating-Point exception (0x10)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -433,7 +429,7 @@ Traps::HandleTrap10(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
|
DebugPrint(L"Handled Alignment-Check exception (0x11)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -451,7 +447,7 @@ Traps::HandleTrap11(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
|
DebugPrint(L"Handled Machine-Check exception (0x12)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -469,7 +465,7 @@ Traps::HandleTrap12(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
|
DebugPrint(L"Handled SIMD Floating-Point exception (0x13)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -487,7 +483,7 @@ Traps::HandleTrap13(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2A(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2A(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled Tick Count service request (0x2A)!\n");
|
DebugPrint(L"Unhandled Tick Count service request (0x2A)!\n");
|
||||||
}
|
}
|
||||||
@@ -504,7 +500,7 @@ Traps::HandleTrap2A(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2B(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2B(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled Callback return service request (0x2B)!\n");
|
DebugPrint(L"Unhandled Callback return service request (0x2B)!\n");
|
||||||
}
|
}
|
||||||
@@ -521,7 +517,7 @@ Traps::HandleTrap2B(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Assertion (0x2C)!\n");
|
DebugPrint(L"Handled Assertion (0x2C)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -539,7 +535,7 @@ Traps::HandleTrap2C(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
|
DebugPrint(L"Handled Debug-Service-Request (0x2D)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
@@ -557,7 +553,7 @@ Traps::HandleTrap2D(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrap2E(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrap2E(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Unhandled system call (0x2E)!\n");
|
DebugPrint(L"Unhandled system call (0x2E)!\n");
|
||||||
}
|
}
|
||||||
@@ -574,14 +570,12 @@ Traps::HandleTrap2E(IN PKTRAP_FRAME TrapFrame)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
|
AR::Traps::HandleTrapFF(IN PKTRAP_FRAME TrapFrame)
|
||||||
{
|
{
|
||||||
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
|
DebugPrint(L"Handled Unexpected-Interrupt (0xFF)!\n");
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C-linkage wrapper for dispatching the trap provided by common trap handler.
|
* C-linkage wrapper for dispatching the trap provided by common trap handler.
|
||||||
*
|
*
|
||||||
|
@@ -103,7 +103,7 @@ KernelInit::StartKernel(VOID)
|
|||||||
CurrentProcess->Quantum = MAXCHAR;
|
CurrentProcess->Quantum = MAXCHAR;
|
||||||
|
|
||||||
/* Initialize Idle thread */
|
/* Initialize Idle thread */
|
||||||
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, ArGetBootStack(), TRUE);
|
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE);
|
||||||
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
||||||
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
||||||
CurrentThread->State = Running;
|
CurrentThread->State = Running;
|
||||||
@@ -131,7 +131,7 @@ KernelInit::SwitchBootStack(VOID)
|
|||||||
PVOID StartKernel;
|
PVOID StartKernel;
|
||||||
|
|
||||||
/* Calculate the stack pointer at the top of the buffer, ensuring it is properly aligned as required by the ABI */
|
/* Calculate the stack pointer at the top of the buffer, ensuring it is properly aligned as required by the ABI */
|
||||||
Stack = ((ULONG_PTR)ArGetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
||||||
|
|
||||||
/* Get address of KernelInit::StartKernel() */
|
/* Get address of KernelInit::StartKernel() */
|
||||||
StartKernel = (PVOID)KernelInit::StartKernel;
|
StartKernel = (PVOID)KernelInit::StartKernel;
|
||||||
|
@@ -103,7 +103,7 @@ KernelInit::StartKernel(VOID)
|
|||||||
CurrentProcess->Quantum = MAXCHAR;
|
CurrentProcess->Quantum = MAXCHAR;
|
||||||
|
|
||||||
/* Initialize Idle thread */
|
/* Initialize Idle thread */
|
||||||
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, ArGetBootStack(), TRUE);
|
KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE);
|
||||||
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
||||||
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
||||||
CurrentThread->State = Running;
|
CurrentThread->State = Running;
|
||||||
@@ -131,7 +131,7 @@ KernelInit::SwitchBootStack(VOID)
|
|||||||
PVOID StartKernel;
|
PVOID StartKernel;
|
||||||
|
|
||||||
/* Calculate the stack pointer at the top of the buffer, ensuring it is properly aligned as required by the ABI */
|
/* Calculate the stack pointer at the top of the buffer, ensuring it is properly aligned as required by the ABI */
|
||||||
Stack = ((ULONG_PTR)ArGetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
||||||
|
|
||||||
/* Get address of KernelInit::StartKernel() */
|
/* Get address of KernelInit::StartKernel() */
|
||||||
StartKernel = (PVOID)KernelInit::StartKernel;
|
StartKernel = (PVOID)KernelInit::StartKernel;
|
||||||
|
Reference in New Issue
Block a user