20 # suns can't echo -n, and Mac OS X can't echo "x\c"
21 # assume argument has no doublequotes
22 awk 'BEGIN { printf("'"$*"'"); }' </dev
/null
26 # Find the address of the kernel readline function,
27 # which the kernel monitor uses to read commands interactively.
28 brkaddr
=`grep 'readline$' obj/kern/kernel.sym | sed -e's/ .*$//g'`
29 #echo "brkaddr $brkaddr"
31 # Run Bochs, setting a breakpoint at readline(),
32 # and feeding in appropriate commands to run, then quit.
33 t0
=`date +%s.%N 2>/dev/null`
35 # The sleeps are necessary in some Bochs to
36 # make it parse each line separately. Sleeping
37 # here sure beats waiting for the timeout.
38 echo vbreak
0x8:0x
$brkaddr
41 # EOF will do just fine to quit.
45 bochs
-q 'display_library: nogui' \
46 'parport1: enabled=1, file="bochs.out"'
49 t1
=`date +%s.%N 2>/dev/null`
50 time=`echo "scale=1; ($t1-$t0)/1" | sed 's/.N/.0/g' | bc 2>/dev/null`
62 if grep "6828 decimal is 15254 octal!" bochs.out
>/dev
/null
64 score
=`expr 20 + $score`
71 args
=`grep "ebp f01.* eip f0100.* args" bochs.out | awk '{ print $6 }'`
72 cnt
=`echo $args | grep '^00000000 00000000 00000001 00000002 00000003 00000004 00000005' | wc -w`
75 score
=`expr 15 + $score`
81 cnt
=`grep "ebp f01.* eip f0100.* args" bochs.out | awk 'BEGIN { FS = ORS = " " }
83 END { printf("\n") }' | grep '^00000000 00000000 00000001 00000002 00000003 00000004 00000005' | wc -w`
84 if [ $cnt -eq 8 ]; then
85 score
=`expr 15 + $score`
88 echo , Args WRONG
"($args)" $time
91 echo "Score: $score/50"
93 if [ $score -lt 50 ]; then