Fix bug in jitter reported by Godmar Back (BIOS wouldn't finish
[pintos-anon] / src / misc / bochs-2.2.6-jitter.patch
index ad7ccb9b25661da1438e428c38e70345b70dd70b..48917e06b1a638f7b424938753302f22d0a6dfd3 100644 (file)
@@ -15,7 +15,7 @@ diff -urp bochs-2.2.6/iodev/pit82c54.cc bochs-2.2.6.orig/iodev/pit82c54.cc
          if(thisctr.triggerGATE || thisctr.first_pass) {
 -          set_count(thisctr, thisctr.inlatch);
 +            unsigned n = thisctr.inlatch;
-+            if (jitter) {
++            if (jitter && n > 5) {
 +                n *= (double) rand() / RAND_MAX;
 +                if (n < 5)
 +                    n = 5;
@@ -49,3 +49,13 @@ diff -urp bochs-2.2.6/main.cc bochs-2.2.6.orig/main.cc
      else if (!strcmp ("-f", argv[arg])) {
        if (++arg >= argc) BX_PANIC(("-f must be followed by a filename"));
        else bochsrc_filename = argv[arg];
+diff -up /home/blp/cs140/bochs-2.2.6/bochs.h\~ /home/blp/cs140/bochs-2.2.6/bochs.h
+--- bochs-2.2.6/bochs.h.orig   2006-01-28 08:16:02.000000000 -0800
++++ bochs-2.2.6/bochs.h        2006-04-03 14:03:54.000000000 -0700
+@@ -698,4 +698,6 @@ int bx_init_hardware ();
+ #endif
++extern int jitter;
++
+ #endif  /* BX_BOCHS_H */