summaryrefslogtreecommitdiffstats
path: root/sim-scripts/pc386.in
blob: 721699d08d5f84dc709d20739053a4fb48b7c0c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
#  i386/qemu Support 
#

bspUsesGDBSimulator="no"
runBSP=NOT_OVERRIDDEN
if [ ! -r ${runBSP} ] ; then
  runBSP=qemu
fi
bspNeedsDos2Unix="yes"
bspRunsFailRandomly="yes"

# Set the defaults based upon arguments given and do some error checking
if [ X${QEMUDIR} == X ] ; then
  QEMUDIR=${HOME}/qemu
fi
if [ ! -d ${QEMUDIR} ] ; then
  fatal Base directory ${QEMUDIR} does not exist or is not a directory
fi

if [ X${hd0Dir} == X ] ; then
  hd0Dir=${QEMUDIR}/hd
fi
if [ ! -d ${hd0Dir} ] ; then
  fatal VFAT directory ${hd0Dir} does not exist or is not a directory
fi

if [ X${fd0Image} == X ] ; then
  fd0Image=${QEMUDIR}/pc386_fda
fi
if [ ! -e ${fd0Image} ] ; then
  fatal Boot floppy ${fd0Image} does not exist or is not a file
fi

if [ ${verbose} == "yes" ] ; then
  echo "QEMU Working Directory: " ${qemudir}
  echo "QEMU VFAT HD Directory: " ${hd0Dir}
  echo "QEMU Boot Floppy File : " ${fd0Image}
fi

runARGS()
{
  file ${1} | grep "Netboot image" >/dev/null 2>&1
  if [ $? -eq 0 ] ; then
    echo "INCORRECT FORMAT -- ${1}"
    echo "MUST BE ELF -- look at using the .exe"
    exit 1
  fi

  cp ${1} ${hd0Dir}/test.exe

  if [ ${coverage} = yes ] ; then
     rm -f trace ${1}.cov
     COVERAGE_ARG="-trace ${1}.cov"
  fi

  # -cpu 486
  # can also redirect to file with file:log/"`basename ${1} .exe`
  SERIAL_ARG="stdio"
# core2duo with newer qemu for smp support
# 486 or pentium for older qemu
  echo "-m 512 -boot a -cpu 486 \
       -fda ${fd0Image} -hda fat:${hd0Dir} ${COVERAGE_ARG} \
       -monitor null -nographic -serial ${SERIAL_ARG} --no-reboot"
}

checkBSPFaults()
{
  # faulty thread may be deleted or suspended
  for pattern in  \
     "FAULTY THREAD WILL BE " \
     "raw handler conne" \
     "Error code pushed by processor itself"
  do
    grep "${pattern}" ${logfile}
    if [ $? -eq 0 ] ; then
      return 1
    fi
  done

  return 0
}

bspCheckRunWasOK()
{
  tname=`get_tname $testname`

  logfile=${logdir}/${tname}

  # sometimes the log file indicates the test did not run
  length=`grep -v "QEMU acceleration layer" ${logfile} | wc -c`
  if [ ${length} -eq 0 ] ; then
    echo 1
  else
    echo 0
  fi
}

bspLimit()
{
  case ${1} in
    *base_sp*) limit=5 ;;
    *stackchk*)limit=5 ;;
    *fatal*)   limit=5 ;;
    *minimum*) limit=5 ;;
    *psxtime*) limit=180 ;;
    *cpuuse*)  limit=30 ;;
    *)         limit=60 ;;
  esac
  echo ${limit}
}

bspGeneratesDeviceTree="no"