X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmisc%2Fbochs-2.1.1.patch;h=42fafc5cd4ab98a7dbb2a695fc71cb65f0ae32eb;hb=b5951493cb20b27398413552d8287c054994a8a5;hp=beaf71e662176b95765a1f4911963aea4af401d5;hpb=ea7c36fcc3b6d8a989bd15b4a76296717cd161a2;p=pintos-anon diff --git a/src/misc/bochs-2.1.1.patch b/src/misc/bochs-2.1.1.patch index beaf71e..42fafc5 100644 --- a/src/misc/bochs-2.1.1.patch +++ b/src/misc/bochs-2.1.1.patch @@ -1,11 +1,59 @@ The first two patches are needed for Bochs to properly compile and run -under Solaris on Sparc. The first should probably be handled by -Autoconf; I'm not sure why it isn't. The second is needed to make GCC -accept X.h's frequent use of "extern foo(...)", because use of an -implicit int return type is forbidden in C++. +under Solaris on Sparc. If you're not compiling on Solaris, don't +apply them. The first should probably be handled by Autoconf; I'm not +sure why it isn't. The second is needed to make GCC accept X.h's +frequent use of "extern foo(...)", because use of an implicit int +return type is forbidden in C++. The third patch makes the gdb stubs work on Solaris/Sparc, by doing -proper byteswapping. +proper byteswapping. It should be harmless elsewhere. + +The fourth patch enables the serial device under Solaris and disables +tty setup at the same time. Tty setup is a pain when you want to +connect a serial port to stdout and it doesn't work under Solaris +anyway. This patch is useful everywhere with `pintos', but may not be +wanted elsewhere. + +The remaining patches add the `jitter' feature described in the +project documentation, in which timer interrupts are delivered at +random intervals. + +To apply all the patches, cd into the Bochs directory, then type + patch -p1 < $PINTOSROOT/src/misc/bochs-2.1.1.patch +You will have to supply the proper path to the patch, of course. You +can provide the --dry-run option to patch if you want to test whether +the patch would apply cleanly before actually patching. + +To apply a subset of the patches, use a text editor to delete the +unwanted patches, then follow the above instructions. + +Here's a ./configure invocation for Bochs that works optimally with +the `pintos' utility: + ./configure --with-x --with-x11 --with-term --with-nogui +If you want the gdb stub, add --enable-gdb-stub +If you want the internal debugger, add --enable-debugger + +Here are the commands used to build and install all the versions of +Bochs we make available on the elaines: + +cd /tmp && tar xzf ~/bochs-2.1.1.tar.gz && cd bochs-2.1.1 +patch -p1 < $PINTOSROOT/src/misc/bochs-2.1.1.patch +CFGOPTS="--with-x --with-x11 --with-term --with-nogui --prefix=/usr/class/cs140/i386" +(mkdir plain && + cd plain && + ../configure $CFGOPTS && + make && + make install) +(mkdir with-gdb && + cd with-gdb && + ../configure --enable-gdb-stub $CFGOPTS && + make && + cp bochs /usr/class/cs140/i386/bin/bochs-gdb) +(mkdir with-dbg && + cd with-dbg && + ../configure --enable-debugger $CFGOPTS && + make && + cp bochs /usr/class/cs140/i386/bin/bochs-dbg) diff -urp orig/bochs-2.1.1/Makefile.in bochs-2.1.1/Makefile.in --- orig/bochs-2.1.1/Makefile.in 2004-02-11 14:28:02.000000000 -0800 @@ -113,3 +161,96 @@ diff -urp orig/bochs-2.1.1/gdbstub.cc bochs-2.1.1/gdbstub.cc mem2hex((char *)registers, obuf, NUMREGSBYTES); put_reply(obuf); break; + +diff -u tmp/bochs-2.1.1/iodev/serial.cc bochs-2.1.1/iodev/serial.cc +--- tmp/bochs-2.1.1/iodev/serial.cc 2004-02-11 14:28:54.000001000 -0800 ++++ bochs-2.1.1/iodev/serial.cc 2004-09-14 23:02:04.000001000 -0700 +@@ -53,7 +53,7 @@ + #endif + #endif + +-#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(__GNU__) || defined(__APPLE__) ++#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__) || defined(__GNU__) || defined(__APPLE__) || defined(__sun__) + #define SERIAL_ENABLE + #endif + +@@ -122,6 +122,7 @@ + if (tty_id < 0) + BX_PANIC(("open of %s (%s) failed\n", + "com1", bx_options.com[0].Odev->getptr ())); ++#if 0 + BX_DEBUG(("tty_id: %d",tty_id)); + tcgetattr(tty_id, &term_orig); + bcopy((caddr_t) &term_orig, (caddr_t) &term_new, sizeof(struct termios)); +@@ -145,6 +146,7 @@ + term_new.c_cc[VTIME] = 0; + //term_new.c_iflag |= IXOFF; + tcsetattr(tty_id, TCSAFLUSH, &term_new); ++#endif + } + #endif /* def SERIAL_ENABLE */ + // nothing for now + +diff -urp bochs-2.1.1.orig/bochs.h bochs-2.1.1/bochs.h +--- bochs-2.1.1.orig/bochs.h 2004-02-11 14:28:03.000000000 -0800 ++++ bochs-2.1.1/bochs.h 2004-09-20 17:02:01.000000000 -0700 +@@ -757,4 +757,6 @@ int bx_init_hardware (); + + #endif + ++extern int jitter; ++ + #endif /* BX_BOCHS_H */ +diff -urp bochs-2.1.1.orig/iodev/pit82c54.cc bochs-2.1.1/iodev/pit82c54.cc +--- bochs-2.1.1.orig/iodev/pit82c54.cc 2004-02-11 14:28:53.000000000 -0800 ++++ bochs-2.1.1/iodev/pit82c54.cc 2004-09-20 17:18:24.000000000 -0700 +@@ -28,6 +28,7 @@ + + #include "bochs.h" + #include "pit82c54.h" ++#include + #define LOG_THIS this-> + + +@@ -356,7 +357,13 @@ pit_82C54::clock(Bit8u cnum) { + case 2: + if(thisctr.count_written) { + if(thisctr.triggerGATE || thisctr.first_pass) { +- set_count(thisctr, thisctr.inlatch); ++ unsigned n = thisctr.inlatch; ++ if (jitter) { ++ 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.1.1.orig/iodev/pit_wrap.cc bochs-2.1.1/iodev/pit_wrap.cc +diff -urp bochs-2.1.1.orig/iodev/serial.cc bochs-2.1.1/iodev/serial.cc +diff -urp bochs-2.1.1.orig/main.cc bochs-2.1.1/main.cc +--- bochs-2.1.1.orig/main.cc 2004-02-11 14:28:41.000000000 -0800 ++++ bochs-2.1.1/main.cc 2004-09-20 17:15:39.000000000 -0700 +@@ -58,6 +58,7 @@ + + + int bochsrc_include_count = 0; ++int jitter = 0; + + extern "C" { + #include +@@ -2022,6 +2024,13 @@ 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];