20 #include "pedigree/kernel/processor/Processor.h" 21 #include "InterruptManager.h" 22 #include "PhysicalMemoryManager.h" 23 #include "VirtualAddressSpace.h" 24 #include "pedigree/kernel/Log.h" 25 #include "pedigree/kernel/process/initialiseMultitasking.h" 39 uintptr_t mapBase =
reinterpret_cast<uintptr_t
>(Info.getModuleBase());
40 size_t mapLen = Info.getModuleCount();
42 for (
size_t i = 0; i < mapLen; i += 0x1000)
45 mapBase + i, reinterpret_cast<void *>(mapBase + i),
56 initialiseMultitasking();
71 uint32_t revision : 4;
72 uint32_t partnum : 10;
78 asm volatile(
"mrc p15, 0, %0, c0, c0, 0" :
"=r"(mainID.data));
81 switch (mainID.implementer)
90 str +=
"Motorola/Freescale ";
131 str +=
"ARMv7 or above ";
134 str +=
"(unknown architecture) ";
139 str +=
"(part number: ";
140 str.append(mainID.partnum);
141 str +=
", revision maj=";
144 str.append(mainID.variant);
146 str.append(mainID.revision);
156 size_t nBpNumber, DebugFlags::FaultType &nFaultType,
size_t &nLength,
164 size_t nBpNumber, uintptr_t nLinearAddress,
165 DebugFlags::FaultType nFaultType,
size_t nLength)
178 if (bCurrent == bEnable)
185 asm volatile(
"MRS %0, cpsr" :
"=r"(cpsr));
190 asm volatile(
"MSR cpsr_c, %0" : :
"r"(cpsr));
200 asm volatile(
"MRS %0, cpsr" :
"=r"(cpsr));
201 return !(cpsr & 0x80);
210 ERROR(
"Single step unavailable on ARM.");
226 processorInformation.setVirtualAddressSpace(AddressSpace);
230 physical_uintptr_t Processor::readTTBR0()
232 physical_uintptr_t ret = 0;
233 asm volatile(
"MRC p15,0,%0,c2,c0,0" :
"=r"(ret));
236 physical_uintptr_t Processor::readTTBR1()
238 physical_uintptr_t ret = 0;
239 asm volatile(
"MRC p15,0,%0,c2,c0,1" :
"=r"(ret));
242 physical_uintptr_t Processor::readTTBCR()
244 physical_uintptr_t ret = 0;
245 asm volatile(
"MRC p15,0,%0,c2,c0,2" :
"=r"(ret));
249 void Processor::writeTTBR0(physical_uintptr_t value)
251 asm volatile(
"MCR p15,0,%0,c2,c0,0" : :
"r"(value));
253 void Processor::writeTTBR1(physical_uintptr_t value)
255 asm volatile(
"MCR p15,0,%0,c2,c0,1" : :
"r"(value));
257 void Processor::writeTTBCR(uint32_t value)
259 asm volatile(
"MCR p15,0,%0,c2,c0,2" : :
"r"(value));
266 asm volatile(
"MCR p15,0,%0,c13,c0,3" : :
"r"(newBase));
Bootstrap structure passed to the kernel entry point.
static bool getInterrupts()
static void setTlsBase(uintptr_t newBase)
static uintptr_t getDebugBreakpoint(size_t nBpNumber, DebugFlags::FaultType &nFaultType, size_t &nLength, bool &bEnabled)
static void initialise2(const BootstrapStruct_t &Info) INITIALISATION_ONLY
second/last stage in the initialisation of the processor-specific interface
virtual bool map(physical_uintptr_t physicalAddress, void *virtualAddress, size_t flags)=0
static EXPORTED_PUBLIC VirtualAddressSpace & getKernelAddressSpace()
static ProcessorInformation & information()
static void switchAddressSpace(VirtualAddressSpace &AddressSpace)
static void enableDebugBreakpoint(size_t nBpNumber, uintptr_t nLinearAddress, DebugFlags::FaultType nFaultType, size_t nLength)
static void setSingleStep(bool bEnable, InterruptState &state)
static size_t m_Initialised
static const size_t KernelMode
static void initialise1(const BootstrapStruct_t &Info) INITIALISATION_ONLY
first stage in the initialisation of the processor-specific interface
physical_uintptr_t m_PhysicalPageDirectory
static void disableDebugBreakpoint(size_t nBpNumber)
static void setInterrupts(bool bEnable)
static void identify(HugeStaticString &str)
static void initialiseProcessor()
static ArmV7PhysicalMemoryManager & instance()
static size_t getDebugBreakpointCount()