X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Futils%2Fpintos;h=e460866719588afb40838e9fead814bc14abfeea;hp=909df8391c57251f290142d134f59787590c253a;hb=8b39127d9437709ab55ad1ed7ac4fb65245fc57b;hpb=2026ecceb129b851bd4f1573f7627a50d51e89b5 diff --git a/src/utils/pintos b/src/utils/pintos index 909df83..e460866 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -618,7 +618,9 @@ sub run_qemu { if $vga eq 'terminal'; print "warning: qemu doesn't support jitter\n" if defined $jitter; - my (@cmd) = ('qemu'); + my (@cmd) = ('qemu-system-i386'); + push (@cmd, '-device', 'isa-debug-exit'); + push (@cmd, '-hda', $disks[0]) if defined $disks[0]; push (@cmd, '-hdb', $disks[1]) if defined $disks[1]; push (@cmd, '-hdc', $disks[2]) if defined $disks[2]; @@ -825,8 +827,8 @@ sub xsystem { # Read and print out pipe data. my ($len) = length ($buf); - waitpid ($pid, 0), last - if sysread ($in, $buf, 4096, $len) <= 0; + my ($n_read) = sysread ($in, $buf, 4096, $len); + waitpid ($pid, 0), last if !defined ($n_read) || $n_read <= 0; print substr ($buf, $len); # Remove full lines from $buf and scan them for keywords. @@ -851,13 +853,17 @@ sub xsystem { alarm (0); &$cleanup (); - if (WIFSIGNALED ($?) && WTERMSIG ($?) == SIGVTALRM ()) { + if (WIFSIGNALED ($?) && WTERMSIG ($?) == SIGVTALRM_number ()) { seek (STDOUT, 0, 2); print "\nTIMEOUT after $timeout seconds of host CPU time\n"; exit 0; } - return $?; + # Kind of a gross hack, because qemu's isa-debug-exit device + # only allows odd-numbered exit values, so we can't exit + # cleanly with 0. We use exit status 0x63 as an alternate + # "clean" exit status. + return ($? != 0x6300) && $?; } } @@ -906,7 +912,7 @@ sub get_load_average { # Calls setitimer to set a timeout, then execs what was passed to us. sub exec_setitimer { if (defined $timeout) { - if ($ ge 5.8.0) { + if ($^V ge 5.8.0) { eval " use Time::HiRes qw(setitimer ITIMER_VIRTUAL); setitimer (ITIMER_VIRTUAL, $timeout, 0); @@ -922,7 +928,7 @@ sub exec_setitimer { exit (1); } -sub SIGVTALRM { +sub SIGVTALRM_number { use Config; my $i = 0; foreach my $name (split(' ', $Config{sig_name})) {