From 503ce80a7707036875f3e9f7a58326f297a8b90d Mon Sep 17 00:00:00 2001 From: Vidar Westfelt Date: Thu, 22 Mar 2018 11:44:03 +0100 Subject: make pintos-script perl 5.26 compatible --- src/utils/pintos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/utils') diff --git a/src/utils/pintos b/src/utils/pintos index 546b152..e96bc22 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -867,7 +867,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); -- cgit v1.2.1 From faedf3ab0659cff849034d85d7c58551afb2d5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Wed, 18 Apr 2018 16:59:40 +0200 Subject: Fixed compilation issues on the latest GCC and QEMU. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Strömbäck --- src/utils/pintos | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/pintos b/src/utils/pintos index e96bc22..2d1d7f0 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -484,10 +484,13 @@ sub run_qemu { my (@cmd) = ('qemu-system-i386'); # klaar@ida 2015-02-13 for my $iface (0...3) { + # filst@ida 2018-04-18: + # Use -drive file=,index=,format=raw to avoid warnings on newer Qemu my ($option) = ('-hda', '-hdb', '-hdc', '-hdd')[$iface]; - push (@cmd, $option, $disks_by_iface[$iface]{FILE_NAME}) + push (@cmd, '-drive', "file=" . $disks_by_iface[$iface]{FILE_NAME} . ",index=$iface,format=raw") if defined $disks_by_iface[$iface]{FILE_NAME}; } + # klaar@ida 2015-03-18: # '-p' is not supported on modern qemu # '-s' is default for '-gdb tcp:1234' on modern qemu @@ -504,7 +507,22 @@ sub run_qemu { # push (@cmd, '-s', '-S') if $debug eq 'gdb'; # replaced by above push (@cmd, '-monitor', 'null') if $vga eq 'none' && $debug eq 'none'; push (@cmd, '-nographic') if $vga eq 'none'; - run_command (@cmd); + + # Insert a device that lets us shutdown Pintos. See https://wiki.osdev.org/Shutdown for details + push (@cmd, '-device', 'isa-debug-exit,iobase=0xf4,iosize=0x04'); + + # When using isa-debug-exit, we can not exit QEMU cleanly. We exit with 0x30, which will make QEMU exit + # with the code 0x30*2 + 1 = 97, and therefore we treat 97 as success as well. + my ($exit) = xsystem (@cmd); + if (WIFEXITED($exit)) { + $exit = WEXITSTATUS($exit); + if ($exit == 97) { + # We use this code to exit cleanly from within Pintos (see https://wiki.osdev.org/Shutdown) + # since we can not exit with code 0 using the debug shutdown device in QEMU. + $exit = 0; + } + } + die "command failed\n" if $exit; } # player_unsup($flag) -- cgit v1.2.1 From 6ca20446c77fd6dec9ca10713a63233c97e7e977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= Date: Wed, 18 Apr 2018 17:41:11 +0200 Subject: Output the Pintos command line once more. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filip Strömbäck --- src/utils/pintos | 1 + 1 file changed, 1 insertion(+) (limited to 'src/utils') diff --git a/src/utils/pintos b/src/utils/pintos index 2d1d7f0..e0cc5ac 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -513,6 +513,7 @@ sub run_qemu { # When using isa-debug-exit, we can not exit QEMU cleanly. We exit with 0x30, which will make QEMU exit # with the code 0x30*2 + 1 = 97, and therefore we treat 97 as success as well. + print join (' ', @cmd), "\n"; my ($exit) = xsystem (@cmd); if (WIFEXITED($exit)) { $exit = WEXITSTATUS($exit); -- cgit v1.2.1