Misc Changes, Added Logging Subsystem, Fixes to InitRD, Working on RTL8139 driver
[tpg/acess2.git] / Kernel / arch / x86 / main.c
index 304c3dd..fd257db 100644 (file)
@@ -3,7 +3,7 @@
  * x86 Kernel Main
  * arch/x86/main.c
  */
-#include <common.h>
+#include <acess.h>
 #include <mboot.h>
 #include <init.h>
 #include <mm_virt.h>
 #define        VGA_ERRORS      0
 
 // === IMPORTS ===
-extern void    Heap_Install();
-extern void    Desctab_Install();
-extern void    MM_PreinitVirtual();
+extern void    Heap_Install(void);
+extern void    Desctab_Install(void);
+extern void    MM_PreinitVirtual(void);
 extern void    MM_Install(tMBoot_Info *MBoot);
-extern void MM_InstallVirtual();
-extern void    Threads_Init();
+extern void MM_InstallVirtual(void);
+extern void    Threads_Init(void);
+extern int     Time_Setup(void);
 extern Uint    Proc_Clone(Uint *Err, Uint Flags);
-extern void    Threads_Sleep();
-extern void    Threads_Exit();
+extern void    Threads_Sleep(void);
+extern void    Threads_Exit(void);
+
+extern int     Modules_LoadBuiltins(void);
 
 // === GLOBALS ===
 
@@ -43,15 +46,23 @@ int kmain(Uint MbMagic, tMBoot_Info *MbInfo)
        // Start Multitasking
        Threads_Init();
        
+       // Start Timers
+       Time_Setup();
+       
        Log("Starting VFS...");
        // Load Virtual Filesystem
        VFS_Init();
        
-       Log("Loading Modules...");
+       // Initialise builtin modules
+       Log("Initialising builtin modules...");
+       Modules_LoadBuiltins();
+       
+       Log("Loading Modules... (%i of them)", MbInfo->ModuleCount);
        
        // Load initial modules
        mods = (void*)( MbInfo->Modules + KERNEL_BASE );
-       for(i=0;i<MbInfo->ModuleCount;i++)
+       Log("MbInfo = %p", MbInfo);
+       for( i = 0; i < MbInfo->ModuleCount; i ++ )
        {
                // Adjust into higher half
                mods[i].Start += KERNEL_BASE;
@@ -64,6 +75,7 @@ int kmain(Uint MbMagic, tMBoot_Info *MbInfo)
                {
                        Warning("Unable to load module\n");
                }
+               Log("Done. (MbInfo = %p)", MbInfo);
        }
        
        // Pass on to Independent Loader
@@ -71,6 +83,7 @@ int kmain(Uint MbMagic, tMBoot_Info *MbInfo)
        System_Init( (char*)(MbInfo->CommandLine + KERNEL_BASE) );
        
        // Sleep forever (sleeping beauty)
-       for(;;) Threads_Sleep();
+       for(;;)
+               Threads_Sleep();
        return 0;
 }

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