First stab at Bochs 2.2.6 upgrade (not yet tested).
[pintos-anon] / src / misc / bochs-2.2.6-jitter.patch
diff --git a/src/misc/bochs-2.2.6-jitter.patch b/src/misc/bochs-2.2.6-jitter.patch
new file mode 100644 (file)
index 0000000..9bba0eb
--- /dev/null
@@ -0,0 +1,51 @@
+diff -urp bochs-2.2.6/iodev/pit82c54.cc bochs-2.2.6.orig/iodev/pit82c54.cc
+--- bochs-2.2.6/iodev/pit82c54.cc      2006-04-03 14:00:27.000000000 -0700
++++ bochs-2.2.6.orig/iodev/pit82c54.cc 2006-01-08 12:39:08.000000000 -0800
+@@ -28,7 +28,6 @@
+ #include "iodev.h"
+ #include "pit82c54.h"
+-#include <stdlib.h>
+ #define LOG_THIS this->
+@@ -360,13 +359,7 @@ pit_82C54::clock(Bit8u cnum) {
+       case 2:
+       if(thisctr.count_written) {
+         if(thisctr.triggerGATE || thisctr.first_pass) {
+-            unsigned n = thisctr.inlatch;
+-            if (jitter) {
+-                n *= (double) rand() / RAND_MAX;
+-                if (n < 5)
+-                    n = 5;
+-            }
+-          set_count(thisctr, n);
++          set_count(thisctr, thisctr.inlatch);
+           thisctr.next_change_time=(thisctr.count_binary-1) & 0xFFFF;
+           thisctr.null_count=0;
+           if(thisctr.inlatch==1) {
+diff -urp bochs-2.2.6/main.cc bochs-2.2.6.orig/main.cc
+--- bochs-2.2.6/main.cc        2006-04-03 14:00:54.000000000 -0700
++++ bochs-2.2.6.orig/main.cc   2006-01-22 04:31:15.000000000 -0800
+@@ -105,7 +105,6 @@ BOCHSAPI BX_CPU_C bx_cpu;
+ #endif
+ char *bochsrc_filename = NULL;
+-int jitter = 0;
+ void bx_print_header ()
+ {
+@@ -460,13 +459,6 @@ int bx_init_main (int argc, char *argv[]
+     else if (!strcmp ("-q", argv[arg])) {
+       SIM->get_param_enum(BXP_BOCHS_START)->set (BX_QUICK_START);
+     }
+-    else if (!strcmp ("-j", argv[arg])) {
+-      if (++arg >= argc) BX_PANIC(("-j must be followed by a number"));
+-      else {
+-        jitter = 1;
+-        srand (atoi (argv[arg]));
+-      }
+-    }
+     else if (!strcmp ("-f", argv[arg])) {
+       if (++arg >= argc) BX_PANIC(("-f must be followed by a filename"));
+       else bochsrc_filename = argv[arg];