# Command-line options.
our ($start_time) = time ();
-our ($sim); # Simulator: bochs, qemu, or gsx.
+our ($sim) = $ENV{PINTOSSIM}; # Simulator: bochs, qemu, or gsx.
our ($debug) = "none"; # Debugger: none, monitor, or gdb.
our ($mem) = 4; # Physical RAM in MB.
our ($serial_out) = 1; # Send output to serial port?
$sim = "bochs" if !defined $sim;
$debug = "none" if !defined $debug;
$vga = "window" if !defined $vga;
+
+ print "warning: -T or --timeout should not be used with --$debug\n"
+ if defined ($timeout) && $debug ne 'none';
}
# usage($exitcode).
--swap-disk=FILE|SIZE Set swap disk file (default: swap.dsk)
Other options:
-h, --help Display this help message.
+Environment variables:
+ PINTOSSIM Select default simulator.
EOF
exit $exitcode;
}
# Runs Bochs.
sub run_bochs {
# Select Bochs binary based on the chosen debugger.
- my ($bin);
- if ($debug eq 'none') {
- $bin = 'bochs';
- } elsif ($debug eq 'monitor') {
- $bin = 'bochs-dbg';
- } elsif ($debug eq 'gdb') {
- $bin = 'bochs-gdb';
- }
+ my ($bin) = $debug eq 'monitor' ? 'bochs-dbg' : 'bochs';
# Write bochsrc.txt configuration file.
open (BOCHSRC, ">", "bochsrc.txt") or die "bochsrc.txt: create: $!\n";
print BOCHSRC <<EOF;
romimage: file=\$BXSHARE/BIOS-bochs-latest, address=0xf0000
-vgaromimage: \$BXSHARE/VGABIOS-lgpl-latest
-boot: c
-ips: 1000000
+vgaromimage: file=\$BXSHARE/VGABIOS-lgpl-latest
+boot: disk
+cpu: ips=1000000
megs: $mem
log: bochsout.txt
panic: action=fatal
EOF
- print BOCHSRC "clock: sync=", $realtime ? 'realtime' : 'none', "time0=0\n";
+ print BOCHSRC "gdbstub: enabled=1\n" if $debug eq 'gdb';
+ print BOCHSRC "clock: sync=", $realtime ? 'realtime' : 'none',
+ " time0=0\n";
print_bochs_disk_line ("ata0-master", 0);
print_bochs_disk_line ("ata0-slave", 1);
if (defined ($disks_by_iface[2]{FILENAME})
print_bochs_disk_line ("ata1-slave", 3);
}
if ($vga ne 'terminal') {
- print BOCHSRC "com1: enabled=1, dev=/dev/stdout\n" if $serial_out;
+ print BOCHSRC "com1: enabled=1, mode=file, dev=/dev/stdout\n"
+ if $serial_out;
print BOCHSRC "display_library: nogui\n" if $vga eq 'none';
} else {
print BOCHSRC "display_library: term\n";
push (@cmd, $option, $disks_by_iface[$iface]{FILENAME})
if defined $disks_by_iface[$iface]{FILENAME};
}
- push (@cmd, '-m', $mem, '-nics', '0');
+ push (@cmd, '-m', $mem);
push (@cmd, '-nographic') if $vga eq 'none';
push (@cmd, '-serial', 'stdio') if $serial_out && $vga ne 'none';
push (@cmd, '-S') if $debug eq 'monitor';