X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmisc%2Fbochs-2.2.6-jitter.patch;h=48917e06b1a638f7b424938753302f22d0a6dfd3;hb=eae29259cd81d3d2e1426eb9a3f9c47eb06d0a88;hp=9bba0ebb7ee7cbb4cab4e28cb1a0e1106c730e7b;hpb=c756825357f433537caec55ac12cf0104be3a6f4;p=pintos-anon diff --git a/src/misc/bochs-2.2.6-jitter.patch b/src/misc/bochs-2.2.6-jitter.patch index 9bba0eb..48917e0 100644 --- a/src/misc/bochs-2.2.6-jitter.patch +++ b/src/misc/bochs-2.2.6-jitter.patch @@ -1,51 +1,61 @@ 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 @@ +--- bochs-2.2.6.orig/iodev/pit82c54.cc 2006-01-08 12:39:08.000000000 -0800 ++++ bochs-2.2.6/iodev/pit82c54.cc 2006-04-03 14:00:27.000000000 -0700 +@@ -28,6 +28,7 @@ #include "iodev.h" #include "pit82c54.h" --#include ++#include #define LOG_THIS this-> -@@ -360,13 +359,7 @@ pit_82C54::clock(Bit8u cnum) { +@@ -359,7 +360,13 @@ 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); +- set_count(thisctr, thisctr.inlatch); ++ unsigned n = thisctr.inlatch; ++ if (jitter && n > 5) { ++ n *= (double) rand() / RAND_MAX; ++ if (n < 5) ++ n = 5; ++ } ++ set_count(thisctr, n); 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; +--- bochs-2.2.6.orig/main.cc 2006-01-22 04:31:15.000000000 -0800 ++++ bochs-2.2.6/main.cc 2006-04-03 14:00:54.000000000 -0700 +@@ -105,6 +105,7 @@ #endif char *bochsrc_filename = NULL; --int jitter = 0; ++int jitter = 0; void bx_print_header () { -@@ -460,13 +459,6 @@ int bx_init_main (int argc, char *argv[] +@@ -459,6 +460,13 @@ 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 ("-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]; +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 */