Author: axeld Date: 2010-04-13 20:25:56 +0200 (Tue, 13 Apr 2010) New Revision: 36233 Changeset: http://dev.haiku-os.org/changeset/36233/haiku Ticket: http://dev.haiku-os.org/ticket/5163 Modified: haiku/trunk/src/system/boot/platform/bios_ia32/bios.S haiku/trunk/src/system/boot/platform/bios_ia32/bios.h haiku/trunk/src/system/boot/platform/bios_ia32/keyboard.cpp Log: * Removed F8 and F12 keys again, see comments to bug #5163. * Some cleanup. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/bios.S =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/bios.S 2010-04-13 17:42:10 UTC (rev 36232) +++ haiku/trunk/src/system/boot/platform/bios_ia32/bios.S 2010-04-13 18:25:56 UTC (rev 36233) @@ -1,17 +1,18 @@ /* -** Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Distributed under the terms of the MIT License. + */ -/** This file contains code to call BIOS functions out of a protected - * mode environment. It doesn't use the virtual86 mode - it switches - * to real mode, make the BIOS call, and switch back to protected - * mode again. It's meant to be used in a single-threaded boot loader, - * not in a multi-tasking operating system. - * It relies on the real mode segment descriptors found in shell.S. - */ +/*! This file contains code to call BIOS functions out of a protected + mode environment. It doesn't use the virtual86 mode - it switches + to real mode, make the BIOS call, and switch back to protected + mode again. It's meant to be used in a single-threaded boot loader, + not in a multi-tasking operating system. + It relies on the real mode segment descriptors found in shell.S. +*/ + #define FUNCTION(x) .globl x ; x ## : #define REAL_MODE_STACK 0x9000 @@ -31,12 +32,12 @@ .text .code32 -/** This function brings you back to protected mode after you've - * switched to it using switch_to_real_mode(). - * Should restore the whole environment to what it looked like - * before. Clobbers %eax. - */ +/*! This function brings you back to protected mode after you've + switched to it using switch_to_real_mode(). + Should restore the whole environment to what it looked like + before. Clobbers %eax. +*/ FUNCTION(switch_to_protected_mode) cli // turn off interrupts @@ -85,13 +86,13 @@ //-------------------------------------------------------------- -/** Switches from protected mode back to real mode. - * It will disable paging and set the real mode segment selectors to 0x1000, - * except for the stack selector, which will be 0x0 (the stack is at 0x9000 - * which is where the BFS boot loader puts it as well). - * Clobbers %eax. - */ +/*! Switches from protected mode back to real mode. + It will disable paging and set the real mode segment selectors to 0x1000, + except for the stack selector, which will be 0x0 (the stack is at 0x9000 + which is where the BFS boot loader puts it as well). + Clobbers %eax. +*/ FUNCTION(switch_to_real_mode) // save the %esp register movl %esp, %eax @@ -156,11 +157,11 @@ //-------------------------------------------------------------- -/** void call_bios(uint8 num, struct bios_regs *regs) - * Does a BIOS call by triggering a software interrupt in real - * mode. - */ +/*! void call_bios(uint8 num, struct bios_regs *regs) + Does a BIOS call by triggering a software interrupt in real + mode. +*/ FUNCTION(call_bios) pushal pushfl @@ -235,12 +236,12 @@ //-------------------------------------------------------------- -/** uint32 search_keyboard_buffer() - * Search in keyboard buffer keycodes for F8, F12 or Space - * if not found - search ESC keycode at the end of this buffer (2 positions) - */ -FUNCTION(search_keyboard_buffer) +/*! uint32 boot_key_in_keyboard_buffer() + Search keyboard buffer for the keycodes for space in the first run, and, + if not found - for the escape key at the last two positions of this buffer +*/ +FUNCTION(boot_key_in_keyboard_buffer) pushal pushfl @@ -253,27 +254,23 @@ cld push %ds xorl %eax, %eax - mov %ax, %ds - mov $0x41E, %si // BIOS kbd buffer + mov %ax, %ds + mov $0x41E, %si // BIOS kbd buffer search_cycle1: lodsw - cmp $0x4200, %ax // test F8 key - jz to_ret - cmp $0x8600, %ax // test F12 key - jz to_ret - cmp $0x3920, %ax // test Space key - jz to_ret - cmp $0x440, %si - jnz search_cycle1 + cmp $0x3920, %ax // test space key + jz to_ret + cmp $0x440, %si + jnz search_cycle1 addw 0x41C, %si movw -0x42(%si), %ax - cmp $0x011B, %ax // test ESC key - jz to_ret + cmp $0x011B, %ax // test ESC key + jz to_ret movw -0x44(%si), %ax - cmp $0x011B, %ax // test ESC key + cmp $0x011B, %ax // test ESC key to_ret: - pop %ds + pop %ds // save %eax movl %eax, (SAVED_EAX - 0x10000) @@ -291,6 +288,7 @@ //-------------------------------------------------------------- + .globl idt_descriptor idt_descriptor: .short 0x7ff // IDT at 0x0, default real mode location Modified: haiku/trunk/src/system/boot/platform/bios_ia32/bios.h =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/bios.h 2010-04-13 17:42:10 UTC (rev 36232) +++ haiku/trunk/src/system/boot/platform/bios_ia32/bios.h 2010-04-13 18:25:56 UTC (rev 36233) @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2004-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Distributed under the terms of the MIT License. + */ #ifndef BIOS_H #define BIOS_H @@ -28,23 +28,27 @@ #define ADDRESS_SEGMENT(address) ((addr_t)(address) >> 4) #define ADDRESS_OFFSET(address) ((addr_t)(address) & 0xf) -#define LINEAR_ADDRESS(segment, offset) (((addr_t)(segment) << 4) + (addr_t)(offset)) +#define LINEAR_ADDRESS(segment, offset) \ + (((addr_t)(segment) << 4) + (addr_t)(offset)) #define SEGMENTED_TO_LINEAR(segmented) \ LINEAR_ADDRESS((addr_t)(segmented) >> 16, (addr_t)(segmented) & 0xffff) + static const addr_t kDataSegmentScratch = 0x10020; // about 768 bytes static const addr_t kDataSegmentBase = 0x10000; static const addr_t kExtraSegmentScratch = 0x2000; // about 24 kB -extern + #ifdef __cplusplus -"C" +extern "C" { #endif -void call_bios(uint8 num, struct bios_regs *regs); -extern + +void call_bios(uint8 num, struct bios_regs* regs); +uint32 boot_key_in_keyboard_buffer(void); + #ifdef __cplusplus -"C" +} #endif -uint32 search_keyboard_buffer(); + #endif /* BIOS_H */ Modified: haiku/trunk/src/system/boot/platform/bios_ia32/keyboard.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/keyboard.cpp 2010-04-13 17:42:10 UTC (rev 36232) +++ haiku/trunk/src/system/boot/platform/bios_ia32/keyboard.cpp 2010-04-13 18:25:56 UTC (rev 36233) @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2004-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Distributed under the terms of the MIT License. + */ #include "keyboard.h" @@ -10,10 +10,9 @@ #include <boot/platform.h> -/** Note, checking for keys doesn't seem to work in graphics - * mode, at least in Bochs. - */ - +/*! Note, checking for keys doesn't seem to work in graphics + mode, at least in Bochs. +*/ static uint16 check_for_key(void) { @@ -68,9 +67,9 @@ // LShift or RShift - option menu options |= BOOT_OPTION_MENU; } else { - keycode = search_keyboard_buffer(); - if (keycode == 0x4200 || keycode == 0x8600 || keycode == 0x3920) { - // F8 or F12 or Space - option menu + keycode = boot_key_in_keyboard_buffer(); + if (keycode == 0x3920) { + // space - option menu options |= BOOT_OPTION_MENU; } else if (keycode == 0x011B) { // ESC - debug output