[FREELDR] Limit the usage of DiskStopFloppyMotor() in hardware/platform-specific...
[reactos.git] / boot / freeldr / freeldr / freeldr.c
index 01af41e..f266081 100644 (file)
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+/* INCLUDES *******************************************************************/
+
 #include <freeldr.h>
-#include <debug.h>
 
+#include <debug.h>
 DBG_DEFAULT_CHANNEL(WARNING);
 
-VOID NTAPI HalpInitializePciStubs(VOID);
-VOID NTAPI HalpInitBusHandler(VOID);
+/* GLOBALS ********************************************************************/
+
+CCHAR FrldrBootPath[MAX_PATH] = "";
 
-VOID BootMain(LPSTR CmdLine)
+/* FUNCTIONS ******************************************************************/
+
+VOID __cdecl BootMain(IN PCCH CmdLine)
 {
-       CmdLineParse(CmdLine);
+    CmdLineParse(CmdLine);
+
+    /* Debugger pre-initialization */
+    DebugInit(0);
 
-       MachInit(CmdLine);
+    TRACE("BootMain() called.\n");
 
-       FsInit();
+    MachInit(CmdLine);
 
-       DebugInit();
+    /* Check if the CPU is new enough */
+    FrLdrCheckCpuCompatibility(); // FIXME: Should be done inside MachInit!
 
-       TRACE("BootMain() called.\n");
+    /* UI pre-initialization */
+    if (!UiInitialize(FALSE))
+    {
+        UiMessageBoxCritical("Unable to initialize UI.");
+        goto Quit;
+    }
 
-       if (!UiInitialize(FALSE))
-       {
-               UiMessageBoxCritical("Unable to initialize UI.\n");
-               goto quit;
-       }
+    /* Initialize memory manager */
+    if (!MmInitializeMemoryManager())
+    {
+        UiMessageBoxCritical("Unable to initialize memory manager.");
+        goto Quit;
+    }
 
-       if (!MmInitializeMemoryManager())
-       {
-               UiMessageBoxCritical("Unable to initialize memory manager");
-               goto quit;
-       }
+    /* Initialize I/O subsystem */
+    FsInit();
 
-#ifdef _M_IX86
-       HalpInitializePciStubs();
-       HalpInitBusHandler();
-#endif
-       RunLoader();
+    RunLoader();
 
-quit:
-       /* If we reach this point, something went wrong before, therefore reboot */
-       DiskStopFloppyMotor();
-       Reboot();
+Quit:
+    /* If we reach this point, something went wrong before, therefore reboot */
+    Reboot();
 }
 
 // We need to emulate these, because the original ones don't work in freeldr
@@ -70,15 +77,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);
 }
-