mirror of https://github.com/bochs-emu/Bochs
- commit patch from David Haslam <dch@sirius.clara.co.uk>
posted to bochs-developers on Wed, 29 Aug 2001 00:08:45 +0100 David Haslam wrote: > I have been looking at the keyboard problem with Minix, which for > those that haven't tried Minix results in every key press giving the > response: ^@ > > I am aware of the comments in the changelog that suggest removing 2 > keyboard ACKs in iodev/keyboard.cc, but this is a bit of a hack, > (which is presumably why it was never incorporated). > > The problem seems to be that the Minix keyboard driver doesn't obey > the rules, and Bochs doesn't model the 8042 accurately. When issuing > commands to set the LEDs, Minix polls the 8042 output data register > waiting for an ACK even though the OBF flag isn't set. > > Bochs returns zero under these circumstances, which seems to > trigger obscure behaviour that messes up the Minix internal > keyboard queue. I don't fully understand why Minix breaks, but I > think the fact that the ACK generates an interrupt, and Minix treats > it as a scan code also has something to do with it. > > In any case, I believe, the fix is for Bochs to return the output > buffer contents, regardless of whether the OBF flag (called outb in > Bochs) is set. > > I expect the real hardware allows the register to be read at anytime, > and with this fix we are modelling the behaviour of the hardware more > accurately. > > I have tested it with Minix 2.0.0. Also DOS 6.22 still works after this fix. > Does anyone think this will break anything else? > > This diff is against the latest CVS of iodev/keyboard.cc, version 1.29 > The last part of the diff is a minor fix to an unrelated debug print.
This commit is contained in:
parent
fabdff5a16
commit
55ed69273b
|
@ -57,7 +57,7 @@ bx_keyb_c::bx_keyb_c(void)
|
|||
memset( &s, 0, sizeof(s) );
|
||||
BX_KEY_THIS put("KBD");
|
||||
BX_KEY_THIS settype(KBDLOG);
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.30 2001-08-31 22:02:29 fries Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.31 2001-09-11 16:49:54 bdenney Exp $"));
|
||||
}
|
||||
|
||||
bx_keyb_c::~bx_keyb_c(void)
|
||||
|
@ -92,7 +92,7 @@ bx_keyb_c::resetinternals(Boolean powerup)
|
|||
void
|
||||
bx_keyb_c::init(bx_devices_c *d, bx_cmos_c *cmos)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.30 2001-08-31 22:02:29 fries Exp $"));
|
||||
BX_DEBUG(("Init $Id: keyboard.cc,v 1.31 2001-09-11 16:49:54 bdenney Exp $"));
|
||||
Bit32u i;
|
||||
|
||||
BX_KEY_THIS devices = d;
|
||||
|
@ -233,7 +233,6 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
|
|||
}
|
||||
else if (BX_KEY_THIS s.kbd_controller.outb) { /* kbd byte available */
|
||||
val = BX_KEY_THIS s.kbd_controller.kbd_output_buffer;
|
||||
BX_KEY_THIS s.kbd_controller.kbd_output_buffer = 0;
|
||||
// BX_INFO(("kbd: %04d outb 0 auxb 0",__LINE__)); // das
|
||||
BX_KEY_THIS s.kbd_controller.outb = 0;
|
||||
BX_KEY_THIS s.kbd_controller.auxb = 0;
|
||||
|
@ -262,7 +261,7 @@ bx_keyb_c::read(Bit32u address, unsigned io_len)
|
|||
else {
|
||||
BX_DEBUG(("num_elements = %d", BX_KEY_THIS s.kbd_internal_buffer.num_elements));
|
||||
BX_DEBUG(("read from port 60h with outb empty"));
|
||||
val = 0;
|
||||
val = BX_KEY_THIS s.kbd_controller.kbd_output_buffer;
|
||||
RETURN(val);
|
||||
}
|
||||
}
|
||||
|
@ -915,7 +914,7 @@ bx_keyb_c::mouse_enQ(Bit8u mouse_data)
|
|||
void
|
||||
bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
|
||||
{
|
||||
BX_DEBUG(("controller passed byte %02xh to keyboard"));
|
||||
BX_DEBUG(("controller passed byte %02xh to keyboard", value));
|
||||
|
||||
if (BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic) {
|
||||
BX_KEY_THIS s.kbd_internal_buffer.expecting_typematic = 0;
|
||||
|
|
Loading…
Reference in New Issue