20 #include "pedigree/kernel/processor/Processor.h" 21 #include "../ppc_common/PhysicalMemoryManager.h" 22 #include "HashedPageTable.h" 23 #include "InterruptManager.h" 24 #include "Translation.h" 25 #include "VirtualAddressSpace.h" 26 #include "pedigree/kernel/Log.h" 27 #include "pedigree/kernel/machine/openfirmware/Device.h" 28 #include "pedigree/kernel/machine/openfirmware/OpenFirmware.h" 29 #include "pedigree/kernel/panic.h" 30 #include "pedigree/kernel/process/initialiseMultitasking.h" 31 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 33 static uint32_t detectMemory()
39 uint32_t registersLength = memory.getPropertyLength(
"reg");
40 if (registersLength == static_cast<uint32_t>(-1))
42 ERROR(
"getproplen failed for /memory:reg.");
45 uint32_t registers[32];
46 if (memory.getProperty(
47 "reg", reinterpret_cast<OFParam>(registers),
48 32 *
sizeof(uint32_t)) == -1)
50 ERROR(
"getprop failed for /memory:reg.");
55 uint32_t currentMax = 0;
58 for (uint32_t i = 0; i < registersLength / (2 *
sizeof(uint32_t)); i++)
60 uint32_t address = registers[i * 2];
61 uint32_t size = registers[i * 2 + 1];
62 if (address != currentMax && size > 0)
65 panic(
"Memory hole detected, and not handled");
70 "Detected " <<
Dec << (currentMax / 0x100000)
71 <<
"MB of installed RAM.");
80 reinterpret_cast<OpenFirmware::OFInterface>(Info.prom));
83 uint32_t ramMax = detectMemory();
110 p.initialise(translations, ramMax);
119 asm volatile(
"mfmsr %0" :
"=r"(msr));
121 asm volatile(
"mtmsr %0" ::
"r"(msr));
123 initialiseMultitasking();
137 uint32_t vsid =
static_cast<uint32_t
>(s.
m_Vsid) * 8;
139 asm volatile(
"mtsr 0, %0" ::
"r"(vsid + 0));
140 asm volatile(
"mtsr 1, %0" ::
"r"(vsid + 1));
141 asm volatile(
"mtsr 2, %0" ::
"r"(vsid + 2));
142 asm volatile(
"mtsr 3, %0" ::
"r"(vsid + 3));
143 asm volatile(
"mtsr 4, %0" ::
"r"(vsid + 4));
144 asm volatile(
"mtsr 5, %0" ::
"r"(vsid + 5));
145 asm volatile(
"mtsr 6, %0" ::
"r"(vsid + 6));
146 asm volatile(
"mtsr 7, %0" ::
"r"(vsid + 7));
147 asm volatile(
"sync; isync");
Bootstrap structure passed to the kernel entry point.
static HashedPageTable & instance()
void removeRange(uintptr_t start, uintptr_t end)
static OpenFirmware & instance()
static void initialise2(const BootstrapStruct_t &Info) INITIALISATION_ONLY
second/last stage in the initialisation of the processor-specific interface
static PpcCommonPhysicalMemoryManager & instance()
static EXPORTED_PUBLIC VirtualAddressSpace & getKernelAddressSpace()
static ProcessorInformation & information()
static void switchAddressSpace(VirtualAddressSpace &AddressSpace)
static size_t m_Initialised
static void initialise1(const BootstrapStruct_t &Info) INITIALISATION_ONLY
first stage in the initialisation of the processor-specific interface
bool initialise(Translations &translations)
void initialise(OFInterface interface)
Implementation of the PhysicalMemoryManager for common ppc.
static void identify(HugeStaticString &str)
void EXPORTED_PUBLIC panic(const char *msg) NORETURN
void initialise(Translations &translations, uint32_t ramMax)
void initialRoster(Translations &translations)