Kernel - Fixing x86_64 compile errors from MM_GetPhysAddr change
[tpg/acess2.git] / KernelLand / Kernel / arch / x86_64 / main.c
1 /*
2  * Acess2 x86_64 Project
3  */
4 #include <acess.h>
5 #include <mboot.h>
6 #include <init.h>
7
8 // === IMPORTS ===
9 extern void     Desctab_Init(void);
10 extern void     MM_InitVirt(void);
11 extern void     Heap_Install(void);
12 extern int      Time_Setup(void);
13
14 extern void     MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
15
16 // === PROTOTYPES ===
17 void    kmain(Uint MbMagic, void *MbInfoPtr);
18
19 // === GLOBALS ==
20 char    *gsBootCmdLine = NULL;
21
22 // === CODE ===
23 void kmain(Uint MbMagic, void *MbInfoPtr)
24 {
25         tMBoot_Info     *mbInfo;
26
27         LogF("Acess2 x86_64 v"EXPAND_STR(KERNEL_VERSION)"\n");
28         LogF(" Build %i, Git Hash %s\n", BUILD_NUM, gsGitHash);
29         
30         Desctab_Init();
31
32         MM_InitVirt();
33         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'C';
34         
35         switch(MbMagic)
36         {
37         // Multiboot 1
38         case MULTIBOOT_MAGIC:
39                 // Adjust Multiboot structure address
40                 mbInfo = (void*)( (Uint)MbInfoPtr + KERNEL_BASE );
41                 gsBootCmdLine = (char*)( (Uint)mbInfo->CommandLine + KERNEL_BASE);
42                 MM_InitPhys_Multiboot( mbInfo );        // Set up physical memory manager
43                 break;
44         default:
45                 Panic("Multiboot magic invalid %08x, expected %08x\n",
46                         MbMagic, MULTIBOOT_MAGIC);
47                 return ;
48         }
49         
50         Log("gsBootCmdLine = '%s'", gsBootCmdLine);
51         
52         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'D';
53         Heap_Install();
54         
55         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'E';
56         Threads_Init();
57         
58         Time_Setup();
59         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'F';
60         
61         // Load Virtual Filesystem
62         Log_Log("Arch", "Starting VFS...");
63         VFS_Init();
64         
65         *(Uint16*)(KERNEL_BASE|0xB8000) = 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(const char *String)
82 {
83         
84 }

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