- This patch tries to fix the paste problem in dos/windows

This commit is contained in:
Christophe Bothamy 2002-03-25 01:13:56 +00:00
parent 20462eb3ff
commit 0cf0c6b381

View File

@ -0,0 +1,230 @@
----------------------------------------------------------------------
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);