summaryrefslogtreecommitdiffstats
path: root/pintos-progos/misc/0001-bochs-2.3.7-jitter.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/misc/0001-bochs-2.3.7-jitter.patch')
-rw-r--r--pintos-progos/misc/0001-bochs-2.3.7-jitter.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/pintos-progos/misc/0001-bochs-2.3.7-jitter.patch b/pintos-progos/misc/0001-bochs-2.3.7-jitter.patch
new file mode 100644
index 0000000..44190e3
--- /dev/null
+++ b/pintos-progos/misc/0001-bochs-2.3.7-jitter.patch
@@ -0,0 +1,78 @@
1From 5e6cfa27ba6de331ecc142e7f65b4d1c2112b4e2 Mon Sep 17 00:00:00 2001
2From: Alex Busenius <s9albuse@stud.uni-saarland.de>
3Date: Mon, 27 Apr 2009 15:33:37 +0200
4Subject: bochs-2.3.7 jitter
5
6---
7 bochs.h | 2 ++
8 iodev/pit82c54.cc | 9 ++++++++-
9 main.cc | 8 ++++++++
10 3 files changed, 18 insertions(+), 1 deletions(-)
11
12diff --git a/bochs.h b/bochs.h
13index 2a643cd..75bcd96 100644
14--- a/bochs.h
15+++ b/bochs.h
16@@ -630,4 +630,6 @@ void bx_center_print(FILE *file, const char *line, unsigned maxwidth);
17
18 #endif
19
20+extern int jitter;
21+
22 #endif /* BX_BOCHS_H */
23diff --git a/iodev/pit82c54.cc b/iodev/pit82c54.cc
24index 0d65768..31ac041 100644
25--- a/iodev/pit82c54.cc
26+++ b/iodev/pit82c54.cc
27@@ -28,6 +28,7 @@
28
29 #include "iodev.h"
30 #include "pit82c54.h"
31+#include <stdlib.h>
32 #define LOG_THIS this->
33
34
35@@ -399,7 +400,13 @@ pit_82C54::clock(Bit8u cnum)
36 case 2:
37 if (thisctr.count_written) {
38 if (thisctr.triggerGATE || thisctr.first_pass) {
39- set_count(thisctr, thisctr.inlatch);
40+ unsigned n = thisctr.inlatch;
41+ if (jitter && n > 5) {
42+ n *= (double) rand() / RAND_MAX;
43+ if (n < 5)
44+ n = 5;
45+ }
46+ set_count(thisctr, n);
47 thisctr.next_change_time=(thisctr.count_binary-1) & 0xFFFF;
48 thisctr.null_count=0;
49 if (thisctr.inlatch==1) {
50diff --git a/main.cc b/main.cc
51index ebdf258..09cf661 100644
52--- a/main.cc
53+++ b/main.cc
54@@ -112,6 +112,7 @@ BOCHSAPI BX_MEM_C bx_mem;
55 #endif
56
57 char *bochsrc_filename = NULL;
58+int jitter = 0;
59
60 void bx_print_header ()
61 {
62@@ -541,6 +542,13 @@ int bx_init_main(int argc, char *argv[])
63 else if (!strcmp("-q", argv[arg])) {
64 SIM->get_param_enum(BXPN_BOCHS_START)->set(BX_QUICK_START);
65 }
66+ else if (!strcmp ("-j", argv[arg])) {
67+ if (++arg >= argc) BX_PANIC(("-j must be followed by a number"));
68+ else {
69+ jitter = 1;
70+ srand(atoi(argv[arg]));
71+ }
72+ }
73 else if (!strcmp("-f", argv[arg])) {
74 if (++arg >= argc) BX_PANIC(("-f must be followed by a filename"));
75 else bochsrc_filename = argv[arg];
76--
771.6.2.3
78