3 * - By John Hodge (thePowersGang)
6 * - Kernel C entrypoint
15 #define KERNEL_LOAD 0x100000
16 #define MAX_PMEMMAP_ENTS 16
19 extern void Desctab_Init(void);
20 extern void MM_InitVirt(void);
21 extern void Heap_Install(void);
22 extern int Time_Setup(void);
24 extern char gKernelEnd[];
27 void kmain(Uint MbMagic, void *MbInfoPtr);
30 char *gsBootCmdLine = NULL;
33 void kmain(Uint MbMagic, void *MbInfoPtr)
36 tPMemMapEnt pmemmap[MAX_PMEMMAP_ENTS];
39 LogF("%s\r\n", gsBuildInfo);
44 *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'C';
50 // Adjust Multiboot structure address
51 mbInfo = (void*)( (Uint)MbInfoPtr + KERNEL_BASE );
52 gsBootCmdLine = (char*)( (Uint)mbInfo->CommandLine + KERNEL_BASE);
53 nPMemMapEnts = Multiboot_LoadMemoryMap(mbInfo, KERNEL_BASE, pmemmap, MAX_PMEMMAP_ENTS,
54 KERNEL_LOAD, (tVAddr)&gKernelEnd - KERNEL_BASE
58 Panic("Multiboot magic invalid %08x, expected %08x\n",
59 MbMagic, MULTIBOOT_MAGIC);
63 MM_InitPhys( nPMemMapEnts, pmemmap ); // Set up physical memory manager
64 Log("gsBootCmdLine = '%s'", gsBootCmdLine);
66 *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'D';
69 *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'E';
73 *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'F';
75 // Load Virtual Filesystem
76 Log_Log("Arch", "Starting VFS...");
79 *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'Z';
81 // Pass on to Independent Loader
82 Log_Log("Arch", "Starting system");
83 System_Init(gsBootCmdLine);
85 // Sleep forever (sleeping beauty)
90 void Arch_LoadBootModules(void)
95 void StartupPrint(const char *String)