- apply Christophe's patch.paste-for-dos. I will make minor tweaks as

separate revisions.
This commit is contained in:
Bryce Denney 2002-03-26 13:51:48 +00:00
parent 8ef7c284fd
commit 34e02290eb
8 changed files with 56 additions and 248 deletions

View File

@ -254,6 +254,16 @@ vga_update_interval: 300000
#=======================================================================
keyboard_serial_delay: 250
#=======================================================================
# KEYBOARD_PASTE_DELAY:
# Approximate time in microseconds between attemps to paste
# characters to the keyboard controller. This leave time to the
# guest os to deal with the flow of characters.
# Examples:
# keyboard_paste_delay: 100000
#=======================================================================
keyboard_paste_delay: 100000
#=======================================================================
# FLOPPY_COMMAND_DELAY:
# Time in microseconds to wait before completing some floppy commands

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.59 2002-03-03 06:03:29 bdenney Exp $
// $Id: bochs.h,v 1.60 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -516,6 +516,9 @@ extern bx_devices_c bx_devices;
#define BX_RESET_SOFTWARE 10
#define BX_RESET_HARDWARE 11
// call periodic timers every N useconds
#define TIMER_DELTA 100
//#define TIMER_DELTA 10
char *bx_find_bochsrc (void);
int bx_parse_cmdline (int arg, int argc, char *argv[]);
@ -623,6 +626,7 @@ typedef struct {
bx_param_num_c *Obootdrive; //0=floppya, 0x80=diskc
bx_param_num_c *Ovga_update_interval;
bx_param_num_c *Okeyboard_serial_delay;
bx_param_num_c *Okeyboard_paste_delay;
bx_param_enum_c *Okeyboard_type;
bx_param_num_c *Ofloppy_command_delay;
bx_param_num_c *Oips;

View File

@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.33 2002-03-03 06:10:04 bdenney Exp $
// $Id: siminterface.h,v 1.34 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
/*
* gui/siminterface.h
* $Id: siminterface.h,v 1.33 2002-03-03 06:10:04 bdenney Exp $
* $Id: siminterface.h,v 1.34 2002-03-26 13:51:48 bdenney Exp $
*
* Interface to the simulator, currently only used by control.cc.
* The base class bx_simulator_interface_c, contains only virtual functions
@ -32,6 +32,7 @@ typedef enum {
BXP_ROM_ADDRESS,
BXP_VGA_ROM_PATH,
BXP_KBD_SERIAL_DELAY,
BXP_KBD_PASTE_DELAY,
BXP_KBD_TYPE,
BXP_FLOPPY_CMD_DELAY,
BXP_FLOPPYA_PATH,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: devices.cc,v 1.20 2002-01-29 17:20:11 vruppert Exp $
// $Id: devices.cc,v 1.21 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -36,9 +36,6 @@
*/
#define BASE_MEMORY_IN_K 640
// call periodic timers every N useconds
#define TIMER_DELTA 100
//#define TIMER_DELTA 10
bx_devices_c bx_devices;
@ -105,7 +102,7 @@ bx_devices_c::~bx_devices_c(void)
void
bx_devices_c::init(BX_MEM_C *newmem)
{
BX_DEBUG(("Init $Id: devices.cc,v 1.20 2002-01-29 17:20:11 vruppert Exp $"));
BX_DEBUG(("Init $Id: devices.cc,v 1.21 2002-03-26 13:51:48 bdenney Exp $"));
mem = newmem;
// Start with all IO port address registered to unmapped handler
// MUST be called first

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.cc,v 1.48 2002-03-11 16:25:52 bdenney Exp $
// $Id: keyboard.cc,v 1.49 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -70,7 +70,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.48 2002-03-11 16:25:52 bdenney Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.49 2002-03-26 13:51:48 bdenney Exp $"));
}
bx_keyb_c::~bx_keyb_c(void)
@ -110,7 +110,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.48 2002-03-11 16:25:52 bdenney Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.49 2002-03-26 13:51:48 bdenney Exp $"));
Bit32u i;
BX_KEY_THIS devices = d;
@ -179,6 +179,8 @@ bx_keyb_c::init(bx_devices_c *d, bx_cmos_c *cmos)
BX_KEY_THIS pastebuf = NULL;
BX_KEY_THIS pastebuf_len = 0;
BX_KEY_THIS pastebuf_ptr = 0;
BX_KEY_THIS pastedelay = bx_options.Okeyboard_paste_delay->get()/TIMER_DELTA;
BX_INFO(("will paste characters every %d keyboard ticks",BX_KEY_THIS pastedelay));
// mouse port installed on system board
cmos->s.reg[0x14] |= 0x04;
@ -1071,6 +1073,7 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
bx_keyb_c::periodic( Bit32u usec_delta )
{
static int multiple=0;
static int count_before_paste=0;
Bit8u retval;
UNUSED( usec_delta );
@ -1080,6 +1083,15 @@ bx_keyb_c::periodic( Bit32u usec_delta )
multiple=0;
bx_gui.handle_events();
}
if (BX_KEY_THIS s.kbd_controller.kbd_clock_enabled ) {
// if queue is empty, add more data from the paste buffer, if it exists.
if(++count_before_paste>=BX_KEY_THIS pastedelay) {
BX_KEY_THIS service_paste_buf ();
count_before_paste=0;
}
}
retval = BX_KEY_THIS s.kbd_controller.irq1_requested | (BX_KEY_THIS s.kbd_controller.irq12_requested << 1);
BX_KEY_THIS s.kbd_controller.irq1_requested = 0;
BX_KEY_THIS s.kbd_controller.irq12_requested = 0;
@ -1141,10 +1153,6 @@ bx_keyb_c::periodic( Bit32u usec_delta )
BX_DEBUG(("service_keyboard(): no keys waiting"));
}
}
if (BX_KEY_THIS s.kbd_internal_buffer.num_elements == 0 ) {
// if queue is empty, add more data from the paste buffer, if it exists.
BX_KEY_THIS service_paste_buf ();
}
return(retval);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.h,v 1.12 2002-03-11 15:04:58 bdenney Exp $
// $Id: keyboard.h,v 1.13 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -192,6 +192,7 @@ private:
Bit8u *pastebuf; // ptr to bytes to be pasted, or NULL if none in progress
Bit32u pastebuf_len; // length of pastebuf
Bit32u pastebuf_ptr; // ptr to next byte to be added to hw buffer
Bit32u pastedelay; // count before paste
BX_KEY_SMF void resetinternals(Boolean powerup);
BX_KEY_SMF void set_kbd_clock_enable(Bit8u value);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.91 2002-03-17 20:57:54 vruppert Exp $
// $Id: main.cc,v 1.92 2002-03-26 13:51:48 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -86,6 +86,7 @@ bx_options_t bx_options = {
NULL, // boot drive
NULL, // vga update interval
NULL, // default keyboard serial path delay (usec)
NULL, // default keyboard paste delay (usec)
NULL, // default keyboard type
NULL, // default floppy command delay (usec)
NULL, // ips
@ -847,6 +848,11 @@ void bx_init_options ()
"Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path.",
1, BX_MAX_INT,
20000);
bx_options.Okeyboard_paste_delay = new bx_param_num_c (BXP_KBD_PASTE_DELAY,
"keyboard_paste_delay",
"Approximate time in microseconds between attemps to paste characters to the keyboard controller.",
0, BX_MAX_INT,
100000);
bx_options.Ofloppy_command_delay = new bx_param_num_c (BXP_FLOPPY_CMD_DELAY,
"floppy_command_delay",
"Time in microseconds to wait before completing some floppy commands such as read/write/seek/etc, which normally have a delay associated. This used to be hardwired to 50,000 before.",
@ -891,7 +897,8 @@ void bx_init_options ()
bx_options.Okeyboard_type->set_ask_format ("Enter keyboard type: [%s] ");
bx_param_c *other_init_list[] = {
bx_options.Okeyboard_serial_delay,
bx_options.Okeyboard_serial_delay,
bx_options.Okeyboard_paste_delay,
bx_options.Ofloppy_command_delay,
bx_options.Oi440FXSupport,
bx_options.cmos.OcmosImage,
@ -1719,6 +1726,15 @@ parse_line_formatted(char *context, int num_params, char *params[])
BX_ERROR (("%s: keyboard_serial_delay not big enough!", context));
}
}
else if (!strcmp(params[0], "keyboard_paste_delay")) {
if (num_params != 2) {
BX_PANIC(("%s: keyboard_paste_delay directive: wrong # args.", context));
}
bx_options.Okeyboard_paste_delay->set (atol(params[1]));
if (bx_options.Okeyboard_paste_delay->get () < 1000) {
BX_ERROR (("%s: keyboard_paste_delay not big enough!", context));
}
}
else if (!strcmp(params[0], "megs")) {
if (num_params != 2) {
BX_PANIC(("%s: megs directive: wrong # args.", context));
@ -2252,6 +2268,7 @@ bx_write_configuration (char *rc, int overwrite)
fprintf (fp, "boot: %s\n", (bootdrive==BX_BOOT_FLOPPYA) ? "a" : (bootdrive==BX_BOOT_DISKC) ? "c" : "cdrom");
fprintf (fp, "vga_update_interval: %u\n", bx_options.Ovga_update_interval->get ());
fprintf (fp, "keyboard_serial_delay: %u\n", bx_options.Okeyboard_serial_delay->get ());
fprintf (fp, "keyboard_paste_delay: %u\n", bx_options.Okeyboard_paste_delay->get ());
fprintf (fp, "floppy_command_delay: %u\n", bx_options.Ofloppy_command_delay->get ());
fprintf (fp, "ips: %u\n", bx_options.Oips->get ());
fprintf (fp, "mouse: enabled=%d\n", bx_options.Omouse_enabled->get ());

View File

@ -1,230 +0,0 @@
----------------------------------------------------------------------
Patch name: patch.paste-for-dos
Author: Christophe Bothamy
Date: Mon Mar 25 02:34:50 CET 2002
Detailed description:
This patch tries to fix the paste problem when running dos/windows,
that previously overflew. A new parameter is read from the bochs
configuration file (keyboard_paste_delay) that is in usec, the
delay between two attemps to paste characters to the keyboard
controller. This parameter defaults to 100000 usec.
I also had to move TIMER_DELTA to bochs.h file, so it could be used
to convert the delay in usec to a delay in "keyboard ticks"
Patch was created with:
cvs diff -u
Apply patch to what version:
current cvs
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
Index: .bochsrc
===================================================================
RCS file: /cvsroot/bochs/bochs/.bochsrc,v
retrieving revision 1.35
diff -u -r1.35 .bochsrc
--- .bochsrc 20 Mar 2002 01:37:44 -0000 1.35
+++ .bochsrc 25 Mar 2002 01:06:33 -0000
@@ -255,6 +255,16 @@
keyboard_serial_delay: 250
#=======================================================================
+# KEYBOARD_PASTE_DELAY:
+# Approximate time in microseconds between attemps to paste
+# characters to the keyboard controller. This leave time to the
+# guest os to deal with the flow of characters.
+# Examples:
+# keyboard_paste_delay: 100000
+#=======================================================================
+keyboard_paste_delay: 100000
+
+#=======================================================================
# FLOPPY_COMMAND_DELAY:
# Time in microseconds to wait before completing some floppy commands
# such as read/write/seek/etc, which normally have a delay associated.
Index: bochs.h
===================================================================
RCS file: /cvsroot/bochs/bochs/bochs.h,v
retrieving revision 1.59
diff -u -r1.59 bochs.h
--- bochs.h 3 Mar 2002 06:03:29 -0000 1.59
+++ bochs.h 25 Mar 2002 01:06:33 -0000
@@ -516,6 +516,9 @@
#define BX_RESET_SOFTWARE 10
#define BX_RESET_HARDWARE 11
+// call periodic timers every N useconds
+#define TIMER_DELTA 100
+//#define TIMER_DELTA 10
char *bx_find_bochsrc (void);
int bx_parse_cmdline (int arg, int argc, char *argv[]);
@@ -623,6 +626,7 @@
bx_param_num_c *Obootdrive; //0=floppya, 0x80=diskc
bx_param_num_c *Ovga_update_interval;
bx_param_num_c *Okeyboard_serial_delay;
+ bx_param_num_c *Okeyboard_paste_delay;
bx_param_enum_c *Okeyboard_type;
bx_param_num_c *Ofloppy_command_delay;
bx_param_num_c *Oips;
Index: main.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/main.cc,v
retrieving revision 1.91
diff -u -r1.91 main.cc
--- main.cc 17 Mar 2002 20:57:54 -0000 1.91
+++ main.cc 25 Mar 2002 01:06:35 -0000
@@ -86,6 +86,7 @@
NULL, // boot drive
NULL, // vga update interval
NULL, // default keyboard serial path delay (usec)
+ NULL, // default keyboard paste delay (usec)
NULL, // default keyboard type
NULL, // default floppy command delay (usec)
NULL, // ips
@@ -847,6 +848,11 @@
"Approximate time in microseconds that it takes one character to be transfered from the keyboard to controller over the serial path.",
1, BX_MAX_INT,
20000);
+ bx_options.Okeyboard_paste_delay = new bx_param_num_c (BXP_KBD_PASTE_DELAY,
+ "keyboard_paste_delay",
+ "Approximate time in microseconds between attemps to paste characters to the keyboard controller.",
+ 1000, BX_MAX_INT,
+ 100000);
bx_options.Ofloppy_command_delay = new bx_param_num_c (BXP_FLOPPY_CMD_DELAY,
"floppy_command_delay",
"Time in microseconds to wait before completing some floppy commands such as read/write/seek/etc, which normally have a delay associated. This used to be hardwired to 50,000 before.",
@@ -891,7 +897,8 @@
bx_options.Okeyboard_type->set_ask_format ("Enter keyboard type: [%s] ");
bx_param_c *other_init_list[] = {
- bx_options.Okeyboard_serial_delay,
+ bx_options.Okeyboard_serial_delay,
+ bx_options.Okeyboard_paste_delay,
bx_options.Ofloppy_command_delay,
bx_options.Oi440FXSupport,
bx_options.cmos.OcmosImage,
@@ -1719,6 +1726,15 @@
BX_ERROR (("%s: keyboard_serial_delay not big enough!", context));
}
}
+ else if (!strcmp(params[0], "keyboard_paste_delay")) {
+ if (num_params != 2) {
+ BX_PANIC(("%s: keyboard_paste_delay directive: wrong # args.", context));
+ }
+ bx_options.Okeyboard_paste_delay->set (atol(params[1]));
+ if (bx_options.Okeyboard_paste_delay->get () < 1000) {
+ BX_ERROR (("%s: keyboard_paste_delay not big enough!", context));
+ }
+ }
else if (!strcmp(params[0], "megs")) {
if (num_params != 2) {
BX_PANIC(("%s: megs directive: wrong # args.", context));
@@ -2252,6 +2268,7 @@
fprintf (fp, "boot: %s\n", (bootdrive==BX_BOOT_FLOPPYA) ? "a" : (bootdrive==BX_BOOT_DISKC) ? "c" : "cdrom");
fprintf (fp, "vga_update_interval: %u\n", bx_options.Ovga_update_interval->get ());
fprintf (fp, "keyboard_serial_delay: %u\n", bx_options.Okeyboard_serial_delay->get ());
+ fprintf (fp, "keyboard_paste_delay: %u\n", bx_options.Okeyboard_paste_delay->get ());
fprintf (fp, "floppy_command_delay: %u\n", bx_options.Ofloppy_command_delay->get ());
fprintf (fp, "ips: %u\n", bx_options.Oips->get ());
fprintf (fp, "mouse: enabled=%d\n", bx_options.Omouse_enabled->get ());
Index: gui/siminterface.h
===================================================================
RCS file: /cvsroot/bochs/bochs/gui/siminterface.h,v
retrieving revision 1.33
diff -u -r1.33 siminterface.h
--- gui/siminterface.h 3 Mar 2002 06:10:04 -0000 1.33
+++ gui/siminterface.h 25 Mar 2002 01:06:35 -0000
@@ -32,6 +32,7 @@
BXP_ROM_ADDRESS,
BXP_VGA_ROM_PATH,
BXP_KBD_SERIAL_DELAY,
+ BXP_KBD_PASTE_DELAY,
BXP_KBD_TYPE,
BXP_FLOPPY_CMD_DELAY,
BXP_FLOPPYA_PATH,
Index: iodev/devices.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/devices.cc,v
retrieving revision 1.20
diff -u -r1.20 devices.cc
--- iodev/devices.cc 29 Jan 2002 17:20:11 -0000 1.20
+++ iodev/devices.cc 25 Mar 2002 01:06:36 -0000
@@ -36,9 +36,6 @@
*/
#define BASE_MEMORY_IN_K 640
-// call periodic timers every N useconds
-#define TIMER_DELTA 100
-//#define TIMER_DELTA 10
bx_devices_c bx_devices;
Index: iodev/keyboard.cc
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/keyboard.cc,v
retrieving revision 1.48
diff -u -r1.48 keyboard.cc
--- iodev/keyboard.cc 11 Mar 2002 16:25:52 -0000 1.48
+++ iodev/keyboard.cc 25 Mar 2002 01:06:36 -0000
@@ -179,6 +179,8 @@
BX_KEY_THIS pastebuf = NULL;
BX_KEY_THIS pastebuf_len = 0;
BX_KEY_THIS pastebuf_ptr = 0;
+ BX_KEY_THIS pastedelay = bx_options.Okeyboard_paste_delay->get()/TIMER_DELTA;
+ BX_INFO(("will paste characters every %d keyboard ticks",BX_KEY_THIS pastedelay));
// mouse port installed on system board
cmos->s.reg[0x14] |= 0x04;
@@ -1071,6 +1073,7 @@
bx_keyb_c::periodic( Bit32u usec_delta )
{
static int multiple=0;
+ static int count_before_paste=0;
Bit8u retval;
UNUSED( usec_delta );
@@ -1080,6 +1083,15 @@
multiple=0;
bx_gui.handle_events();
}
+
+ if (BX_KEY_THIS s.kbd_controller.kbd_clock_enabled ) {
+ // if queue is empty, add more data from the paste buffer, if it exists.
+ if(++count_before_paste>=BX_KEY_THIS pastedelay) {
+ BX_KEY_THIS service_paste_buf ();
+ count_before_paste=0;
+ }
+ }
+
retval = BX_KEY_THIS s.kbd_controller.irq1_requested | (BX_KEY_THIS s.kbd_controller.irq12_requested << 1);
BX_KEY_THIS s.kbd_controller.irq1_requested = 0;
BX_KEY_THIS s.kbd_controller.irq12_requested = 0;
@@ -1140,10 +1152,6 @@
else {
BX_DEBUG(("service_keyboard(): no keys waiting"));
}
- }
- if (BX_KEY_THIS s.kbd_internal_buffer.num_elements == 0 ) {
- // if queue is empty, add more data from the paste buffer, if it exists.
- BX_KEY_THIS service_paste_buf ();
}
return(retval);
}
Index: iodev/keyboard.h
===================================================================
RCS file: /cvsroot/bochs/bochs/iodev/keyboard.h,v
retrieving revision 1.12
diff -u -r1.12 keyboard.h
--- iodev/keyboard.h 11 Mar 2002 15:04:58 -0000 1.12
+++ iodev/keyboard.h 25 Mar 2002 01:06:36 -0000
@@ -192,6 +192,7 @@
Bit8u *pastebuf; // ptr to bytes to be pasted, or NULL if none in progress
Bit32u pastebuf_len; // length of pastebuf
Bit32u pastebuf_ptr; // ptr to next byte to be added to hw buffer
+ Bit32u pastedelay; // count before paste
BX_KEY_SMF void resetinternals(Boolean powerup);
BX_KEY_SMF void set_kbd_clock_enable(Bit8u value);