* 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");
- return;
- }
+ /* Initialize memory manager */
+ if (!MmInitializeMemoryManager())
+ {
+ UiMessageBoxCritical("Unable to initialize memory manager.");
+ goto Quit;
+ }
- if (!MmInitializeMemoryManager())
- {
- UiMessageBoxCritical("Unable to initialize memory manager");
- return;
- }
+ /* 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 */
+ Reboot();
}
// We need to emulate these, because the original ones don't work in freeldr
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);
}
-