Ticket #5341: r35050-reverted.diff

File r35050-reverted.diff, 4.9 KB (added by andreasf, 12 years ago)

workaround: revert hrev35050

  • src/system/boot/platform/bios_ia32/bios.S

    From 61f777c7c0afe5b0a37c2d3464499fa34deaf0f0 Mon Sep 17 00:00:00 2001
    From: =?utf-8?q?Andreas=20F=C3=A4rber?= <andreas.faerber@web.de>
    Date: Tue, 2 Feb 2010 20:45:14 +0100
    Subject: [PATCH] Revert "Applied patch by "Grey":"
    
    This reverts commit d72f520778e9a775194164b33a4c7a952be2143e.
    ---
     src/system/boot/platform/bios_ia32/bios.S       |   62 +----------------------
     src/system/boot/platform/bios_ia32/bios.h       |    5 --
     src/system/boot/platform/bios_ia32/keyboard.cpp |   32 ++++++------
     src/system/boot/platform/bios_ia32/start.c      |    3 +
     4 files changed, 19 insertions(+), 83 deletions(-)
    
    diff --git a/src/system/boot/platform/bios_ia32/bios.S b/src/system/boot/platform/bios_ia32/bios.S
    index 7842062..a1bd5fc 100644
    a b  
    2222#define SAVED_EAX       0x10008
    2323#define SAVED_ES        0x1000c
    2424#define SAVED_FLAGS     0x10010
    25 #define SAVED_EBP       0x10014
    2625    // we're overwriting the start of our boot loader to hold some
    2726    // temporary values - the first 1024 bytes of it are used at
    2827    // startup only, and we avoid some linking issues this way
    _no_paging:  
    7574    // setup protected stack frame again
    7675    movl    SAVED_ESP, %eax
    7776    movl    %eax, %esp
    78     movl    SAVED_EBP, %ebp
     77    movl    %eax, %ebp
    7978
    8079    // copy the return address to the current stack
    8180    movl    REAL_MODE_STACK, %eax
    FUNCTION(switch_to_real_mode)  
    9796    movl    %esp, %eax
    9897    movl    %eax, SAVED_ESP
    9998
    100     movl    %ebp, SAVED_EBP
    101 
    10299    // put the return address on the real mode stack
    103100    movl    (%esp), %eax
    104101    movl    %eax, REAL_MODE_STACK
    int_number:  
    235232
    236233//--------------------------------------------------------------
    237234
    238 /** uint32  search_keyboard_buffer()
    239  *  Search in keyboard buffer keycodes for F8, F12 or Space
    240  *  if not found - search ESC keycode.
    241  */
    242 
    243 FUNCTION(search_keyboard_buffer)
    244     pushal
    245     pushfl
    246 
    247     // make sure the correct IDT is in place
    248     lidt    idt_descriptor
    249 
    250     call    switch_to_real_mode
    251     .code16
    252 
    253     cld
    254     push    %ds
    255     xorl    %eax, %eax
    256     mov %ax, %ds
    257     mov $0x41E, %si // BIOS kbd buffer
    258 search_cycle1:
    259     lodsw
    260     cmp $0x4200, %ax    // test F8 key
    261     jz  to_ret
    262     cmp $0x8600, %ax    // test F12 key
    263     jz  to_ret
    264     cmp $0x3920, %ax    // test Space key
    265     jz  to_ret
    266     cmp $0x440, %si
    267     jnz search_cycle1
    268 
    269     movw    $0x41E, %si // BIOS kbd buffer
    270 search_cycle2:
    271     lodsw
    272     cmp $0x011B, %ax    // test ESC key
    273     jz  to_ret
    274     cmp $0x440, %si
    275     jnz search_cycle2
    276 to_ret:
    277     pop %ds
    278 
    279     // save %eax
    280     movl    %eax, (SAVED_EAX - 0x10000)
    281 
    282     call    switch_to_protected_mode
    283     .code32
    284 
    285     popfl
    286     popal
    287 
    288     // restore %eax
    289     movl    SAVED_EAX, %eax
    290 
    291     ret
    292 
    293 //--------------------------------------------------------------
    294 
    295235.globl idt_descriptor
    296236idt_descriptor:
    297237    .short  0x7ff               // IDT at 0x0, default real mode location
  • src/system/boot/platform/bios_ia32/bios.h

    diff --git a/src/system/boot/platform/bios_ia32/bios.h b/src/system/boot/platform/bios_ia32/bios.h
    index 4468551..f18d267 100644
    a b extern  
    4141"C"
    4242#endif
    4343void call_bios(uint8 num, struct bios_regs *regs);
    44 extern
    45 #ifdef __cplusplus
    46 "C"
    47 #endif
    48 uint32 search_keyboard_buffer();
    4944
    5045#endif  /* BIOS_H */
  • src/system/boot/platform/bios_ia32/keyboard.cpp

    diff --git a/src/system/boot/platform/bios_ia32/keyboard.cpp b/src/system/boot/platform/bios_ia32/keyboard.cpp
    index 80dfc79..ed0838c 100644
    a b wait_for_key(void)  
    5858extern "C" uint32
    5959check_for_boot_keys(void)
    6060{
    61     bios_regs regs;
     61    union key key;
    6262    uint32 options = 0;
    63     uint32 keycode = 0;
    64     regs.eax = 0x0200;
    65     call_bios(0x16, &regs);
    66         // Read Keyboard flags. bit 0 LShift, bit 1 RShift
    67     if ((regs.eax & 0x03) != 0) {
    68         // LShift or RShift - option menu
    69         options |= BOOT_OPTION_MENU;
    70     } else {
    71         keycode = search_keyboard_buffer();
    72         if (keycode == 0x4200 || keycode == 0x8600 || keycode == 0x3920) {
    73             // F8 or F12 or Space - option menu
    74             options |= BOOT_OPTION_MENU;
    75         } else if (keycode == 0x011B) {
    76             // ESC - debug output
    77             options |= BOOT_OPTION_DEBUG_OUTPUT;
    78         }
     63
     64    while ((key.ax = check_for_key()) != 0) {
     65        switch (key.code.ascii) {
     66            case ' ':
     67                options |= BOOT_OPTION_MENU;
     68                break;
     69            case 0x1b:  // escape
     70                options |= BOOT_OPTION_DEBUG_OUTPUT;
     71                break;
     72            case 0:
     73                // evaluate BIOS scan codes
     74                // ...
     75                break;
     76        }
    7977    }
    8078
    8179    dprintf("options = %ld\n", options);
  • src/system/boot/platform/bios_ia32/start.c

    diff --git a/src/system/boot/platform/bios_ia32/start.c b/src/system/boot/platform/bios_ia32/start.c
    index 5dc91bc..8877442 100644
    a b _start(void)  
    129129    mmu_init();
    130130    parse_multiboot_commandline(&args);
    131131
     132    // wait a bit to give the user the opportunity to press a key
     133    spin(750000);
     134
    132135    // reading the keyboard doesn't seem to work in graphics mode
    133136    // (maybe a bochs problem)
    134137    sBootOptions = check_for_boot_keys();