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


                     

                        
                    
                     
                            












                                               
  
                      
                         
                               




































                                                                        
 

                            
                                 

                                   
    
 
            

                                                                 




                                                


                                            
                                         



                                                   



                                                               
                                   


                                                             
                                                                      



                
                                             
                   
                               
                          







                                            


          














                                                               

          
              
                         
                         
                         
                         
                           
                          

                          
               

 
                           
#
#  i386/qemu Support 
#

bspUsesGDBSimulator="no"
bspSupportsSMP="yes"
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"
bspSupportsDisplayAdapter="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"
  if [ ${enable_display_adapter} = "no" ] ; then
     GRAPHIC_ARG="-nographic"
  else
     GRAPHIC_ARG="-vga cirrus"
  fi

  # core2duo with newer qemu for SMP support
  # 486 or pentium for non-SMP
  if [ ${number_of_cores:-1} = 1 ] ; then
    CPUARGS="-cpu 486"
  else
    CPUARGS="-cpu core2duo -smp ${number_of_cores}"
  fi
  #
  # This works with older Qemu's but results in noise in 2.3.50
  #     -fda ${fd0Image} -hda fat:${hd0Dir}
  # So it was changed to the -drive argument scheme
  echo "-m 512 -boot a ${CPUARGS} \
       -drive file=${fd0Image},index=0,if=floppy,format=raw \
       -drive file=fat:${hd0Dir},format=raw \
       ${COVERAGE_ARG} \
       -monitor null ${GRAPHIC_ARG} -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"