15 extern void Heap_Install(void);
16 extern void Desctab_Install(void);
17 extern void MM_PreinitVirtual(void);
18 extern void MM_Install(tMBoot_Info *MBoot);
19 extern void MM_InstallVirtual(void);
20 extern void Threads_Init(void);
21 extern int Time_Setup(void);
22 extern Uint Proc_Clone(Uint *Err, Uint Flags);
23 extern void Threads_Sleep(void);
24 extern void Threads_Exit(void);
26 extern int Modules_LoadBuiltins(void);
31 int kmain(Uint MbMagic, tMBoot_Info *MbInfo)
36 // Adjust Multiboot structure address
37 MbInfo = (void*)( (Uint)MbInfo + KERNEL_BASE );
39 Desctab_Install(); // Set up GDT and IDT
40 MM_PreinitVirtual(); // Initialise vital mappings
41 MM_Install( MbInfo ); // Set up physical memory manager
42 MM_InstallVirtual(); // Clean up virtual address space
43 Heap_Install(); // Create initial heap
45 Log("Starting Multitasking...");
52 Log("Starting VFS...");
53 // Load Virtual Filesystem
56 // Initialise builtin modules
57 Log("Initialising builtin modules...");
58 Modules_LoadBuiltins();
60 Log("Loading %i Modules...", MbInfo->ModuleCount);
62 // Load initial modules
63 mods = (void*)( MbInfo->Modules + KERNEL_BASE );
64 for( i = 0; i < MbInfo->ModuleCount; i ++ )
66 // Adjust into higher half
67 mods[i].Start += KERNEL_BASE;
68 mods[i].End += KERNEL_BASE;
69 mods[i].String += KERNEL_BASE;
71 Log("Loading '%s'", mods[i].String);
73 if( !Module_LoadMem( (void *)mods[i].Start, mods[i].End-mods[i].Start, (char *)mods[i].String ) )
75 Log_Warning("ARCH", "Unable to load module\n");
79 // Pass on to Independent Loader
80 Log("Loading Configuration...");
81 System_Init( (char*)(MbInfo->CommandLine + KERNEL_BASE) );
83 // Sleep forever (sleeping beauty)