Kernel/x86_64 - Implemented SYSCALL in x86_64 port
[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 #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 void     Threads_Init(void);
13 extern int      Time_Setup(void);
14 extern void     System_Init(char *Commandline);
15
16 extern void     MM_InitPhys_Multiboot(tMBoot_Info *MBoot);
17
18 // === PROTOTYPES ===
19 void    kmain(Uint MbMagic, void *MbInfoPtr);
20
21 // === GLOBALS ==
22 char    *gsBootCmdLine = NULL;
23
24 // === CODE ===
25 void kmain(Uint MbMagic, void *MbInfoPtr)
26 {
27         tMBoot_Info     *mbInfo;
28         
29         Desctab_Init();
30
31         MM_InitVirt();
32         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'C';
33         
34         switch(MbMagic)
35         {
36         // Multiboot 1
37         case MULTIBOOT_MAGIC:
38                 // Adjust Multiboot structure address
39                 mbInfo = (void*)( (Uint)MbInfoPtr + KERNEL_BASE );
40                 gsBootCmdLine = (char*)( (Uint)mbInfo->CommandLine + KERNEL_BASE);
41                 Log("gsBootCmdLine = '%s'", gsBootCmdLine);
42                 
43                 MM_InitPhys_Multiboot( mbInfo );        // Set up physical memory manager
44                 break;
45         default:
46                 Panic("Multiboot magic invalid %08x, expected %08x\n",
47                         MbMagic, MULTIBOOT_MAGIC);
48                 return ;
49         }
50         
51         Log("gsBootCmdLine = '%s'", gsBootCmdLine);
52         
53         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'D';
54         Heap_Install();
55         
56         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'E';
57         Log_Log("Arch", "Starting threading...");
58         Threads_Init();
59         
60         Time_Setup();
61         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'F';
62         
63         Log_Log("Arch", "Starting VFS...");
64         // Load Virtual Filesystem
65         VFS_Init();
66         
67         *(Uint16*)(KERNEL_BASE|0xB8000) = 0x1F00|'Z';
68         
69         // Pass on to Independent Loader
70         Log_Log("Arch", "Starting system");
71         System_Init(gsBootCmdLine);
72         
73         // Sleep forever (sleeping beauty)
74         for(;;)
75                 Threads_Sleep();
76 }
77
78 void Arch_LoadBootModules(void)
79 {
80         
81 }
82
83 void StartupPrint(const char *String)
84 {
85         
86 }

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