Opened 15 years ago
Last modified 15 years ago
#5113 closed enhancement
[PATCH] Warm boot for Bootloader — at Initial Version
Reported by: | Grey | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System/Boot Loader | Version: | R1/alpha1 |
Keywords: | Warm boot | Cc: | |
Blocked By: | Blocking: | ||
Platform: | x86 |
Description
This is small patch for bootloader. X86 only! Function war_boot() added to src/system/boot/platform/bios_ia32/bios.S Press 'W' or 'w' for warm boot.
Index: src/system/boot/platform/bios_ia32/keyboard.h =================================================================== --- src/system/boot/platform/bios_ia32/keyboard.h (revision 34640) +++ src/system/boot/platform/bios_ia32/keyboard.h (working copy) @@ -29,6 +29,7 @@
extern void clear_key_buffer(void); extern union key wait_for_key(void); extern uint32 check_for_boot_keys(void);
+extern void warm_boot(void);
#ifdef cplusplus }
Index: src/system/boot/platform/bios_ia32/bios.S =================================================================== --- src/system/boot/platform/bios_ia32/bios.S (revision 34640) +++ src/system/boot/platform/bios_ia32/bios.S (working copy) @@ -231,7 +231,49 @@
ret
--------------------------------------------------------------
+/ void warm_boot() + * Warm booting computer via BIOS int 0x19. save_crx() have to be called before paging setup. + */ +FUNCTION(warm_boot) + cli + movl saved_cr0,%eax + movl %eax,%cr0 + movl saved_cr3,%eax + movl %eax,%cr3 + movl saved_cr4,%eax + movl %eax,%cr4 + lidt saved_idt + call switch_to_real_mode + .byte 0xCD + .byte 0x19 + ret +-------------------------------------------------------------- +/ void save_crx() + * Save CRx registers state. Required for warm_boot. + */ +FUNCTION(save_crx) + cli + movl %cr0,%eax + movl %eax,saved_cr0 + movl %cr3,%eax + movl %eax,saved_cr3 + movl %cr4,%eax + movl %eax,saved_cr4 + sidt saved_idt + ret +-------------------------------------------------------------- + .p2align 4 +saved_idt: + .long 0x0 + .long 0x0 +saved_cr0: + .long 0x0 +saved_cr3: + .long 0x0 +saved_cr4: + .long 0x0 + .p2align 4
.globl idt_descriptor idt_descriptor:
.short 0x7ff IDT at 0x0, default real mode location
Index: src/system/boot/platform/bios_ia32/keyboard.cpp =================================================================== --- src/system/boot/platform/bios_ia32/keyboard.cpp (revision 34640) +++ src/system/boot/platform/bios_ia32/keyboard.cpp (working copy) @@ -69,6 +69,9 @@
case 0x1b: escape
options |= BOOT_OPTION_DEBUG_OUTPUT; break;
+ case 'w': + case 'W': + warm_boot();
case 0:
evaluate BIOS scan codes ...
Index: src/system/boot/platform/bios_ia32/start.c =================================================================== --- src/system/boot/platform/bios_ia32/start.c (revision 34640) +++ src/system/boot/platform/bios_ia32/start.c (working copy) @@ -107,7 +107,6 @@
out8(0xfe, 0x64);
}
-
void _start(void) {
@@ -126,6 +125,7 @@
serial_init(); console_init(); cpu_init();
+ save_crx();
mmu_init(); parse_multiboot_commandline(&args);
warm_boot_patch