* Added warm reboot functionality based on a patch by Grey, thanks! It can be
invoked using the 'w' key. * Checking allocations doesn't hurt. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2009, Axel Dörfler, [email protected].
|
* Copyright 2004-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,42 +12,84 @@
|
|||||||
#include <safemode.h>
|
#include <safemode.h>
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
platform_add_menus(Menu *menu)
|
warm_reboot(char key)
|
||||||
{
|
{
|
||||||
MenuItem *item;
|
asm(" cli ;"
|
||||||
|
" movl $0x11, %eax ;"
|
||||||
|
" movl %eax, %cr0 ;"
|
||||||
|
" movl $0x0, %eax ;"
|
||||||
|
" movl %eax, %cr3 ;"
|
||||||
|
" movl $0x200, %eax ;"
|
||||||
|
" movl %eax, %cr4 ;"
|
||||||
|
" lidt saved_idt ;"
|
||||||
|
" call switch_to_real_mode ;"
|
||||||
|
" int $0x19 ;"
|
||||||
|
" .p2align 4 ;"
|
||||||
|
"saved_idt: ;"
|
||||||
|
" .short 0x7ff ;"
|
||||||
|
" .long 0x0 ;"
|
||||||
|
" .long 0x0 ;");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
platform_add_menus(Menu* menu)
|
||||||
|
{
|
||||||
|
MenuItem* item;
|
||||||
|
|
||||||
switch (menu->Type()) {
|
switch (menu->Type()) {
|
||||||
case MAIN_MENU:
|
case MAIN_MENU:
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Select fail-safe video mode", video_mode_menu()));
|
item = new(std::nothrow) MenuItem("Select fail-safe video mode",
|
||||||
item->SetTarget(video_mode_hook);
|
video_mode_menu());
|
||||||
|
if (item != NULL) {
|
||||||
|
menu->AddItem(item);
|
||||||
|
item->SetTarget(video_mode_hook);
|
||||||
|
item->SetShortcut('v');
|
||||||
|
}
|
||||||
|
|
||||||
|
menu->AddShortcut('w', warm_reboot);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAFE_MODE_MENU:
|
case SAFE_MODE_MENU:
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe video mode"));
|
item = new(std::nothrow) MenuItem("Use fail-safe video mode");
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
if (item != NULL) {
|
||||||
item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
|
menu->AddItem(item);
|
||||||
item->SetHelpText("The system will use VESA mode "
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
"and won't try to use any video graphics drivers.");
|
item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
|
||||||
|
item->SetHelpText("The system will use VESA mode "
|
||||||
|
"and won't try to use any video graphics drivers.");
|
||||||
|
}
|
||||||
|
|
||||||
smp_add_safemode_menus(menu);
|
smp_add_safemode_menus(menu);
|
||||||
|
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
|
item = new(std::nothrow) MenuItem("Don't call the BIOS");
|
||||||
item->SetHelpText("Stops the system from calling BIOS functions.");
|
if (item != NULL) {
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
menu->AddItem(item);
|
||||||
|
item->SetHelpText("Stops the system from calling BIOS "
|
||||||
|
"functions.");
|
||||||
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
|
}
|
||||||
|
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Disable APM"));
|
item = new(std::nothrow) MenuItem("Disable APM");
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
if (item != NULL) {
|
||||||
item->SetData(B_SAFEMODE_DISABLE_APM);
|
menu->AddItem(item);
|
||||||
item->SetHelpText("Disables Advanced Power Management hardware "
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
"support, overriding the APM setting in the kernel settings "
|
item->SetData(B_SAFEMODE_DISABLE_APM);
|
||||||
"file.");
|
item->SetHelpText("Disables Advanced Power Management hardware "
|
||||||
|
"support, overriding the APM setting in the kernel "
|
||||||
|
"settings file.");
|
||||||
|
}
|
||||||
|
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Disable ACPI"));
|
item = new(std::nothrow) MenuItem("Disable ACPI");
|
||||||
item->SetType(MENU_ITEM_MARKABLE);
|
if (item != NULL) {
|
||||||
item->SetData(B_SAFEMODE_DISABLE_ACPI);
|
menu->AddItem(item);
|
||||||
item->SetHelpText("Disables Advanced Configuration and Power "
|
item->SetType(MENU_ITEM_MARKABLE);
|
||||||
"Interface hardware support, overriding the ACPI setting "
|
item->SetData(B_SAFEMODE_DISABLE_ACPI);
|
||||||
"in the kernel settings file.");
|
item->SetHelpText("Disables Advanced Configuration and Power "
|
||||||
|
"Interface hardware support, overriding the ACPI setting "
|
||||||
|
"in the kernel settings file.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -57,14 +99,14 @@ platform_add_menus(Menu *menu)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
platform_update_menu_item(Menu *menu, MenuItem *item)
|
platform_update_menu_item(Menu* menu, MenuItem* item)
|
||||||
{
|
{
|
||||||
platform_generic_update_text_menu_item(menu, item);
|
platform_generic_update_text_menu_item(menu, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
platform_run_menu(Menu *menu)
|
platform_run_menu(Menu* menu)
|
||||||
{
|
{
|
||||||
platform_generic_run_text_menu(menu);
|
platform_generic_run_text_menu(menu);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user