Some bochs/qemu tools.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 8 Sep 2004 00:02:26 +0000 (00:02 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 8 Sep 2004 00:02:26 +0000 (00:02 +0000)
src/bochs/bochsrc.txt [new file with mode: 0644]
src/bochs/copy_in [new file with mode: 0755]
src/bochs/run_qemu [new file with mode: 0755]

diff --git a/src/bochs/bochsrc.txt b/src/bochs/bochsrc.txt
new file mode 100644 (file)
index 0000000..9bb8338
--- /dev/null
@@ -0,0 +1,8 @@
+romimage: file=$HOME/cs140/bochs-2.1.1/bios/BIOS-bochs-latest, address=0xf0000
+vgaromimage: $HOME/cs140/bochs-2.1.1/bios/VGABIOS-lgpl-latest
+ata0-master: type=disk, path=os.dsk, mode=flat, cylinders=306, heads=4, spt=17, translation=none
+ata0-slave: type=disk, path=filesys.bin, mode=flat, cylinders=1, heads=16, spt=63, translation=none
+boot: c
+ips: 1000000
+megs: 32
+com1: dev=/dev/tty
diff --git a/src/bochs/copy_in b/src/bochs/copy_in
new file mode 100755 (executable)
index 0000000..743ae51
--- /dev/null
@@ -0,0 +1,11 @@
+#! /usr/bin/perl
+
+if (@ARGV != 2) {
+    print "usage: copy_in src dst\n";
+    exit 1;
+}
+($src, $dst) = @ARGV;
+$size = -s $src;
+
+system "../pad 512 < $src > scratch.bin";
+exec "./run_qemu -cp $dst:$size";
diff --git a/src/bochs/run_qemu b/src/bochs/run_qemu
new file mode 100755 (executable)
index 0000000..6011e3e
--- /dev/null
@@ -0,0 +1,17 @@
+#! /usr/bin/perl
+
+die "command line includes empty string" if grep (/^$/, @ARGV);
+$cmdline = join ("\0", @ARGV) . "\0\0";
+die "command line exceeds 128 bytes" if length ($cmdline) > 128;
+$cmdline .= "\0" x (128 - length ($cmdline));
+
+open (DISK, "+<os.dsk");
+seek (DISK, 0x17e, 0);
+syswrite (DISK, $cmdline);
+close (DISK);
+exec "/home/blp/cs140/qemu/i386-softmmu/qemu "
+    . "-hda os.dsk "
+    . "-hdb filesys.bin "
+    . "-hdc scratch.bin "
+    . " -nographic"
+    ;