extern C int kernel_main(u32 r0, u32 r1, u32 r2) { // Invalidate all caches now Arch::Cache cache; cache.invalidate(Cache::Unified); #ifdef ARMV7 // Raise the SMP bit for ARMv7 ARMControl ctrl; ctrl.set(ARMControl::SMPBit); #endif // Retrieve boot image from ATAGS Arch::MemoryMap mem; BroadcomInterrupt irq; ARMTags tags(r2); Memory::Range initrd = tags.getInitRd2(); // Fill coreInfo MemoryBlock::set(&coreInfo, 0, sizeof(CoreInfo)); coreInfo.bootImageAddress = initrd.phys; coreInfo.bootImageSize = initrd.size; coreInfo.kernel.phys = 0; coreInfo.kernel.size = MegaByte(4); coreInfo.memory.phys = 0; coreInfo.memory.size = MegaByte(512); // Initialize heap Kernel::heap( MegaByte(3), MegaByte(1) ); // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something. constructors(); // Open the serial console as default Log RaspiSerial console; console.setMinimumLogLevel(Log::Notice); // Create the kernel ARMKernel kernel(&irq, &coreInfo); // Run the kernel return kernel.run(); }
extern C int kernel_main(void) { // Initialize heap Memory::initialize(0x00300000); RaspiSerial console; // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something. constructors(); // TODO: this should be done from the support library too. // Later, a user-process should monitor the kernel console buffer and write // it to the selected console for the kernel. #define BANNER \ "FreeNOS " RELEASE " [" ARCH "/" SYSTEM "] (" BUILDUSER "@" BUILDHOST ") (" COMPILER_VERSION ") " DATETIME "\r\n" console.setMinimumLogLevel(Log::Debug); console.write(BANNER); console.write(COPYRIGHT "\r\n"); NOTICE("Initializing subsystems"); ARMMemory mem(128 * 1024 * 1024); ARMFactory fac; ProcessScheduler sched; ProcessManager procs(&fac, &sched); ARMKernel kernel(&mem, &procs); while (true) console.put(console.get()); return 0; }
extern C int kernel_main(u32 r0, u32 r1, u32 r2) { Arch::MemoryMap mem; BroadcomInterrupt irq; ARMTags tags(r2); Memory::Range initrd = tags.getInitRd2(); // Fill coreInfo MemoryBlock::set(&coreInfo, 0, sizeof(CoreInfo)); coreInfo.bootImageAddress = initrd.phys; coreInfo.bootImageSize = initrd.size; coreInfo.kernel.phys = 0; coreInfo.kernel.size = MegaByte(4); coreInfo.memory.phys = 0; coreInfo.memory.size = MegaByte(512); // Initialize heap Kernel::heap( MegaByte(3), MegaByte(1) ); // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something. constructors(); // Open the serial console as default Log RaspiSerial console; console.setMinimumLogLevel(Log::Notice); // Create the kernel ARMKernel kernel(&irq, &coreInfo); // Print some info DEBUG("ATAGS = " << r2); ARMControl ctrl; DEBUG("MainID = " << ctrl.read(ARMControl::MainID)); ctrl.write(ARMControl::UserProcID, 11223344); DEBUG("UserProcID = " << ctrl.read(ARMControl::UserProcID)); // Run the kernel return kernel.run(); }
extern C int kernel_main(u32 r0, u32 r1, u32 r2) { Arch::MemoryMap mem; BCM2835Interrupt irq; // Initialize heap Kernel::heap( MegaByte(3), MegaByte(1) ); // TODO: put this in the boot.S, or maybe hide it in the support library? maybe a _run_main() or something. constructors(); // Open the serial console as default Log RaspiSerial console; console.setMinimumLogLevel(Log::Notice); // Kernel memory range Memory::Range kernelRange; kernelRange.phys = 0; kernelRange.size = MegaByte(4); // RAM physical range Memory::Range ramRange; ramRange.phys = 0; ramRange.size = MegaByte(512); // Create the kernel ARMKernel kernel(kernelRange, ramRange, &irq, r2); // Print some info DEBUG("ATAGS = " << r2); ARMControl ctrl; DEBUG("MainID = " << ctrl.read(ARMControl::MainID)); ctrl.write(ARMControl::UserProcID, 11223344); DEBUG("UserProcID = " << ctrl.read(ARMControl::UserProcID)); // Run the kernel return kernel.run(); }