[FREELDR] Diverse enhancements.
[reactos.git] / boot / freeldr / freeldr / freeldr.c
index 70f2369..b1f7296 100644 (file)
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+/* INCLUDES *******************************************************************/
+
 #include <freeldr.h>
 #include <debug.h>
 
 DBG_DEFAULT_CHANNEL(WARNING);
 
-VOID NTAPI HalpInitializePciStubs(VOID);
-VOID NTAPI HalpInitBusHandler(VOID);
+/* FUNCTIONS ******************************************************************/
 
-VOID BootMain(LPSTR CmdLine)
+VOID __cdecl BootMain(IN PCCH CmdLine)
 {
     CmdLineParse(CmdLine);
 
-    MachInit(CmdLine);
-
-    FsInit();
-
-    DebugInit();
+    /* Debugger pre-initialization */
+    DebugInit(FALSE);
 
     TRACE("BootMain() called.\n");
 
+    MachInit(CmdLine);
+
     /* Check if the CPU is new enough */
-    FrLdrCheckCpuCompatiblity();
+    FrLdrCheckCpuCompatibility(); // FIXME: Should be done inside MachInit!
 
+    /* UI pre-initialization */
     if (!UiInitialize(FALSE))
     {
-        UiMessageBoxCritical("Unable to initialize UI.\n");
-        goto quit;
+        UiMessageBoxCritical("Unable to initialize UI.");
+        goto Quit;
     }
 
+    /* Initialize memory manager */
     if (!MmInitializeMemoryManager())
     {
-        UiMessageBoxCritical("Unable to initialize memory manager");
-        goto quit;
+        UiMessageBoxCritical("Unable to initialize memory manager.");
+        goto Quit;
     }
 
-#ifdef _M_IX86
-       HalpInitializePciStubs();
-       HalpInitBusHandler();
-#endif
-       RunLoader();
+    /* Initialize I/O subsystem */
+    FsInit();
 
-quit:
+    RunLoader();
+
+Quit:
     /* If we reach this point, something went wrong before, therefore reboot */
+#if defined(__i386__) || defined(_M_AMD64)
     DiskStopFloppyMotor();
+#endif
     Reboot();
 }
 
@@ -73,15 +76,14 @@ int __cdecl wctomb(char *mbchar, wchar_t wchar)
     return 1;
 }
 
-int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count)
+int __cdecl mbtowc(wchar_t *wchar, const char *mbchar, size_t count)
 {
     *wchar = (wchar_t)*mbchar;
     return 1;
 }
 
 // The wctype table is 144 KB, too much for poor freeldr
-int iswctype(wint_t wc, wctype_t wctypeFlags)
+int __cdecl iswctype(wint_t wc, wctype_t wctypeFlags)
 {
     return _isctype((char)wc, wctypeFlags);
 }
-