Ticket #5113: warm_boot.2.patch

File warm_boot.2.patch, 2.5 KB (added by Grey, 14 years ago)

corrected warm_boot.patch

  • src/system/boot/platform/bios_ia32/keyboard.h

     
    2929extern void clear_key_buffer(void);
    3030extern union key wait_for_key(void);
    3131extern uint32 check_for_boot_keys(void);
     32extern void warm_boot(void);
    3233
    3334#ifdef __cplusplus
    3435}
  • src/system/boot/platform/bios_ia32/bios.S

     
    231231    ret
    232232
    233233//--------------------------------------------------------------
     234/** void warm_boot()
     235 *  Warm booting computer via BIOS int 0x19. save_crx() have to be called before paging setup.
     236 */
     237FUNCTION(warm_boot)
     238    cli
     239    movl    saved_cr0,%eax
     240    movl    %eax,%cr0
     241    movl    saved_cr3,%eax
     242    movl    %eax,%cr3
     243    movl    saved_cr4,%eax
     244    movl    %eax,%cr4
     245    lidt    saved_idt
     246    call    switch_to_real_mode
     247    .byte  0xCD
     248    .byte  0x19
     249    ret
     250//--------------------------------------------------------------
     251/** void save_crx()
     252 *  Save CRx registers state. Required for warm_boot.
     253 */
     254FUNCTION(save_crx)
     255    cli
     256    movl    %cr0,%eax
     257    movl    %eax,saved_cr0
     258    movl    %cr3,%eax
     259    movl    %eax,saved_cr3
     260    movl    %cr4,%eax
     261    movl    %eax,saved_cr4
     262    sidt    saved_idt
     263    ret
     264//--------------------------------------------------------------
     265    .p2align 4
     266saved_idt:
     267    .long   0x0
     268    .long   0x0
     269saved_cr0:
     270    .long   0x0
     271saved_cr3:
     272    .long   0x0
     273saved_cr4:
     274    .long   0x0
    234275
     276    .p2align 4
    235277.globl idt_descriptor
    236278idt_descriptor:
    237279    .short  0x7ff               // IDT at 0x0, default real mode location
  • src/system/boot/platform/bios_ia32/keyboard.cpp

     
    6969            case 0x1b:  // escape
    7070                options |= BOOT_OPTION_DEBUG_OUTPUT;
    7171                break;
     72            case 'w':
     73            case 'W':
     74                warm_boot();
    7275            case 0:
    7376                // evaluate BIOS scan codes
    7477                // ...
  • src/system/boot/platform/bios_ia32/start.c

     
    126126    serial_init();
    127127    console_init();
    128128    cpu_init();
     129    save_crx();
    129130    mmu_init();
    130131    parse_multiboot_commandline(&args);
    131132