summaryrefslogblamecommitdiffstats
path: root/sim-scripts/pc386.in
blob: bcda29358b3762743227d48830acae6f435cfa7e (plain) (tree)
1
2
3
4
5
6
7


                     

                        
                     
                            












                                               
  
                      
                         




































                                                                        
 

                            
                                 

                                   
    
 
            

                                                                 


                                          

                                                                  



                
                                             
                   
                               
                          







                                            


          














                                                               

          
              
                         
                         
                         
                         
                           
                          

                          
               

 
                           
#
#  i386/qemu Support 
#

bspUsesGDBSimulator="no"
runBSP=NOT_OVERRIDDEN
if [ ! -r ${runBSP} ] ; then
  runBSP=notset
  for name in qemu-system-i386 qemu
  do
    type ${name} >/dev/null 2>&1
    if [ $? -eq 0 ] ; then
      runBSP=${name}
      break
    fi
  done
  if [ ${runBSP} = "notset" ] ; then
    echo "CANNOT FIND qemu or qemu-system-i386"
    exit 1
  fi
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"