x86-run 805 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/bash

qemukvm="${QEMU:-qemu-kvm}"
qemusystem="${QEMU:-qemu-system-x86_64}"
if
	${qemukvm} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
then
	qemu="${qemukvm}"
else
	if
		${qemsystem} -device '?' 2>&1 | fgrep -e \"testdev\" -e \"pc-testdev\" > /dev/null;
	then
		qemu="${qemusystem}"
	else
		echo QEMU binary ${QEMU} has no support for test device. Exiting.
Kevin Wolf's avatar
Kevin Wolf committed
16
		exit 2
17
18
19
20
21
22
23
24
25
26
	fi
fi

if
	${qemu} -device '?' 2>&1 | fgrep "pc-testdev" > /dev/null;
then
	command="${qemu} -enable-kvm -device pc-testdev -serial stdio -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel"
else
	command="${qemu} -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out -serial stdio -kernel"
fi
Kevin Wolf's avatar
Kevin Wolf committed
27
28
29
30
31
32

echo ${command} "$@"
${command} "$@"
ret=$?
echo Return value from qemu: $ret
exit $ret