Author: hbelusca Date: Mon Dec 17 00:22:11 2012 New Revision: 57935
URL: http://svn.reactos.org/svn/reactos?rev=57935&view=rev Log: [FREELDR] - Effectively reboot instead of exiting the bootloader and hanging. - Do a cold reboot instead of a (soft) warm reboot, to let the user be able to choose another boot support or do anything else, instead of directly rebooting to the bootloader. Rename the concerned function accordingly.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S trunk/reactos/boot/freeldr/freeldr/freeldr.c trunk/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h trunk/reactos/boot/freeldr/freeldr/ui/tui.c trunk/reactos/boot/freeldr/freeldr/ui/ui.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/custom.c [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -359,5 +359,5 @@ UiMessageBox("The system will now reboot.");
DiskStopFloppyMotor(); - SoftReboot(); -} + Reboot(); +}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -198,10 +198,10 @@ ret
-PUBLIC _SoftReboot -_SoftReboot: +PUBLIC _Reboot +_Reboot: /* Set the function ID */ - mov bx, FNID_SoftReboot + mov bx, FNID_Reboot
/*Switch to real mode (We don't return) */ jmp SwitchToReal
Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/r... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -50,7 +50,7 @@
/* Wait for a keypress */ int HEX(16) - jmp SoftReboot + jmp Reboot
Msg_Unsupported: .ascii "This CPU is not supported.", CR, LF @@ -330,11 +330,11 @@ .long 0, 0
int HEX(16) - jmp SoftReboot + jmp Reboot
CallbackTable: .word Int386 - .word SoftReboot + .word Reboot .word ChainLoadBiosBootSectorCode .word PxeCallApi .word PnpBiosGetDeviceNodeCount
Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/r... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/helpers.inc [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -92,20 +92,17 @@ popfd ret
-SoftReboot: - mov ax, HEX(40) - mov ds, ax - mov si, HEX(72) +Reboot: + cli
- /* Set the word at location 40:72 to 1234h */ - mov word ptr [si], HEX(1234) + /* Set the word at location 40h:72h to 0 (cold reboot) */ + mov word ptr ds:[HEX(0472)], HEX(0)
- /* and jump to location FFFF:0 in ROM */ - ljmp16 HEX(0FFFF), HEX(0000) + /* and jump to location F000h:FFF0h in ROM */ + ljmp16 HEX(0F000), HEX(0FFF0)
ChainLoadBiosBootSectorCode: - /* Load segment registers */ cli xor ax, ax @@ -117,4 +114,4 @@ mov esp, HEX(7C00)
/* Jump to the bootsector code */ - ljmp16 HEX(0000), HEX(7C00) + ljmp16 HEX(0000), HEX(7C00)
Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/r... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/i386.S [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -142,7 +142,7 @@
callback_table: .word Int386 - .word SoftReboot + .word Reboot .word ChainLoadBiosBootSectorCode .word PxeCallApi .word PnpBiosGetDeviceNodeCount
Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freeld... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr.c [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -40,13 +40,13 @@ if (!UiInitialize(FALSE)) { UiMessageBoxCritical("Unable to initialize UI.\n"); - return; + goto quit; }
if (!MmInitializeMemoryManager()) { UiMessageBoxCritical("Unable to initialize memory manager"); - return; + goto quit; }
#ifdef _M_IX86 @@ -54,6 +54,11 @@ HalpInitBusHandler(); #endif RunLoader(); + +quit: + /* If we reach this point, something went wrong before, therefore reboot */ + DiskStopFloppyMotor(); + Reboot(); }
// We need to emulate these, because the original ones don't work in freeldr
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -119,7 +119,7 @@
void EnableA20(void); VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S -VOID SoftReboot(VOID); // Implemented in boot.S +VOID Reboot(VOID); // Implemented in boot.S VOID DetectHardware(VOID); // Implemented in hardware.c
#endif /* ! __ASM__ */
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -48,7 +48,7 @@
/* Realmode function IDs */ #define FNID_Int386 0 -#define FNID_SoftReboot 1 +#define FNID_Reboot 1 #define FNID_ChainLoadBiosBootSectorCode 2 #define FNID_PxeCallApi 3 #define FNID_PnpBiosGetDeviceNodeCount 4
Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tui... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -48,8 +48,8 @@
BOOLEAN TuiInitialize(VOID) { - MachVideoClearScreen(ATTR(COLOR_WHITE, COLOR_BLACK)); MachVideoHideShowTextCursor(FALSE); + MachVideoClearScreen(ATTR(COLOR_GRAY, COLOR_BLACK));
TextVideoBuffer = VideoAllocateOffScreenBuffer(); if (TextVideoBuffer == NULL) @@ -71,7 +71,7 @@ MachVideoSetDisplayMode(NULL, FALSE); }
- //VideoClearScreen(); + MachVideoClearScreen(ATTR(COLOR_GRAY, COLOR_BLACK)); MachVideoHideShowTextCursor(TRUE); }
Modified: trunk/reactos/boot/freeldr/freeldr/ui/ui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/ui.... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/ui.c [iso-8859-1] Mon Dec 17 00:22:11 2012 @@ -229,7 +229,7 @@ VOID UiUnInitialize(PCSTR BootText) { UiDrawBackdrop(); - UiDrawStatusText("Booting..."); + UiDrawStatusText(BootText); UiInfoBox(BootText);
UiVtbl.UnInitialize();