It's been too long since I committed
[tpg/acess2.git] / Kernel / arch / x86_64 / main.c
1 /*
2  * Acess2 x86_64 Project
3  */
4 #include <acess.h>
5 #include <mboot.h>
6
7 // === IMPORTS ===
8 extern void     Desctab_Init(void);
9 extern void     MM_InitVirt(void);
10 extern void     Heap_Install(void);
11 extern void     Threads_Init(void);
12 //extern void   Time_Setup(void);
13 extern void     System_Init(char *Commandline);
14
15 extern void     MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
16
17 // === PROTOTYPES ===
18
19 // === GLOBALS ==
20 char    *gsBootCmdLine = NULL;
21
22 // === CODE ===
23 void kmain(Uint MbMagic, void *MbInfoPtr)
24 {
25         tMBoot_Info     *mbInfo;
26         
27         Desctab_Init();
28         
29         MM_InitVirt();
30         *(Uint16*)(0xB8000) = 0x1F00|'C';
31         
32         switch(MbMagic)
33         {
34         // Multiboot 1
35         case MULTIBOOT_MAGIC:
36                 // Adjust Multiboot structure address
37                 mbInfo = (void*)( (Uint)MbInfoPtr + KERNEL_BASE );
38                 gsBootCmdLine = (char*)( (Uint)mbInfo->CommandLine + KERNEL_BASE);
39                 
40                 MM_InitPhys_Multiboot( mbInfo );        // Set up physical memory manager
41                 break;
42         default:
43                 Panic("Multiboot magic invalid %08x, expected %08x\n",
44                         MbMagic, MULTIBOOT_MAGIC);
45                 return ;
46         }
47         
48         *(Uint16*)(0xB8000) = 0x1F00|'D';
49         Heap_Install();
50         
51         *(Uint16*)(0xB8000) = 0x1F00|'E';
52         Log_Log("Arch", "Starting threading...");
53         Threads_Init();
54         
55         //Time_Setup();
56         *(Uint16*)(0xB8000) = 0x1F00|'F';
57         
58         Log_Log("Arch", "Starting VFS...");
59         // Load Virtual Filesystem
60         VFS_Init();
61         
62         *(Uint16*)(0xB8000) = 0x1F00|'Z';
63         *(Uint16*)(0xB8002) = 0x1F00|'Z';
64         *(Uint16*)(0xB8004) = 0x1F00|'Z';
65         *(Uint16*)(0xB8006) = 0x1F00|'Z';
66         
67         // Pass on to Independent Loader
68         Log_Log("Arch", "Starting system");
69         System_Init(gsBootCmdLine);
70         
71         // Sleep forever (sleeping beauty)
72         for(;;)
73                 Threads_Sleep();
74 }
75
76 void Arch_LoadBootModules(void)
77 {
78         
79 }
80
81 void StartupPrint(char *String)
82 {
83         
84 }

UCC git Repository :: git.ucc.asn.au