20 #include "pedigree/kernel/processor/Processor.h" 21 #include "../x86_common/PhysicalMemoryManager.h" 22 #include "InterruptManager.h" 23 #include "SyscallManager.h" 24 #include "VirtualAddressSpace.h" 26 #include "pedigree/kernel/process/initialiseMultitasking.h" 27 #include "pedigree/kernel/processor/IoPortManager.h" 28 #include "pedigree/kernel/processor/NMFaultHandler.h" 29 #include "pedigree/kernel/processor/PageFaultHandler.h" 30 #include "pedigree/kernel/utilities/utility.h" 33 #if defined(MULTIPROCESSOR) 34 #include "../x86_common/Multiprocessor.h" 42 #define PAT_UCMINUS 0x07 89 asm volatile(
"mov %%cr3, %0" :
"=r"(cr3));
95 asm volatile(
"mov %0, %%cr3" ::
"r"(x64AddressSpace.
m_PhysicalPML4));
99 processorInformation.setVirtualAddressSpace(AddressSpace);
105 shutdownMultitasking();
125 asm volatile(
"mov %%cr0, %%rax; or $0x10000, %%rax; mov %%rax, %%cr0" ::
160 uint32_t pat_lo, pat_hi;
161 asm volatile(
"rdmsr" :
"=a"(pat_lo),
"=d"(pat_hi) :
"c"(0x277));
164 p.x = pat_lo | (
static_cast<uint64_t
>(pat_hi) << 32ULL);
168 p.s.pa2 = PAT_UCMINUS;
172 p.s.pa6 = PAT_UCMINUS;
174 pat_lo =
static_cast<uint32_t
>(p.x);
175 pat_hi =
static_cast<uint32_t
>(p.x >> 32ULL);
177 asm volatile(
"wrmsr" ::
"a"(pat_lo),
"d"(pat_hi),
"c"(0x277));
184 #if defined(MULTIPROCESSOR) 187 size_t nProcessors = 1;
194 initialiseMultitasking();
196 doInitialise64(Info);
200 #if defined(MULTIPROCESSOR) 201 if (nProcessors != 1)
208 uint32_t eax, ebx, ecx, edx;
210 cpuid(0, 0, eax, ebx, ecx, edx);
211 MemoryCopy(ident, &ebx, 4);
212 MemoryCopy(&ident[4], &edx, 4);
213 MemoryCopy(&ident[8], &ecx, 4);
222 "wrmsr" ::
"a"(newBase),
"d"(newBase >> 32ULL),
"c"(0xC0000100));
Bootstrap structure passed to the kernel entry point.
static X86CommonPhysicalMemoryManager & instance()
virtual ~X64InterruptManager()
static void setTlsBase(uintptr_t newBase)
static X64GdtManager & instance()
static void initialise2(const BootstrapStruct_t &Info) INITIALISATION_ONLY
second/last stage in the initialisation of the processor-specific interface
static IoPortManager & instance()
void initialise(size_t processorCount) INITIALISATION_ONLY
static ProcessorInformation & information()
void initialise64(const BootstrapStruct_t &Info) INITIALISATION_ONLY
static void switchAddressSpace(VirtualAddressSpace &AddressSpace)
bool initialiseProcessor()
virtual ~X64SyscallManager()
Manages hardware I/O port (de)allocations.
static PageFaultHandler & instance()
static size_t initialise1() INITIALISATION_ONLY
void initialise(io_port_t ioPortBase, size_t size) INITIALISATION_ONLY
static void initialise1(const BootstrapStruct_t &Info) INITIALISATION_ONLY
first stage in the initialisation of the processor-specific interface
static void initialise2() INITIALISATION_ONLY
static X64SyscallManager & instance()
static NMFaultHandler & instance()
static void deinitialise()
static void identify(HugeStaticString &str)
static void initialiseProcessor() INITIALISATION_ONLY
static void initialiseProcessor() INITIALISATION_ONLY
void initialise(const BootstrapStruct_t &Info) INITIALISATION_ONLY
Implementation of the PhysicalMemoryManager for common x86.
static void initialiseProcessor() INITIALISATION_ONLY
physical_uintptr_t m_PhysicalPML4
static X64InterruptManager & instance()