1

Executing a binary under simulation from a command line? suggests to use

bp.hap.run-until name = X86_HLT_Instr

Here is my full script:

run-command-file "./targets/qsp-x86/firststeps-no-network.simics"
$start = (load-binary ./small)
%rip = $start
%rsp = 0x40001000
%bp.hap.run-until name = X86_HLT_Instr

here is how I run it:

./simics t1.simics 

here is the error message:

Parse error: Empty name space
[/home/kcc/simics-projects/t1/t1.simics:5] error parsing command
Error - interrupting script.

Also, what should I read to understand this syntax better?

kcc
  • 51
  • 4

2 Answers2

2

Looks like the error message is referring to the extra "%" symbol before "bp.hap.run-until"

Additional notes: "%" refers to the CPU registers. Hence, %rip is the CPU's instruction pointer register; %rsp is the CPU's stack pointer register.

James
  • 144
  • 6
  • https://software.intel.com/content/www/us/en/develop/articles/introduction-to-x64-assembly.html – James Jul 14 '21 at 06:43
1

Note that this set of commands all rely on the currently selected processor being the right one. If you want to be more robust, you could use a specific processor object instead. That particular script sets up the simulation with just one processor, so it will work. But if you were to use other setups with multiple cores, you could be more precise. $

You should also preferably use "%simics%/.." to refer to other scripts. Your current code assumes that you script is at the top level of the Simics project.

run-command-file "%simics%/targets/qsp-x86/firststeps-no-network.simics"

$start = ($system.mb.cpu0.core[0][0].load-binary ./small)
$system.mb.cpu0.core[0][0].set-pc $start   ## Special command for the PC
$system.mb.cpu0.core[0][0].write-reg "rsp" 0x40001000
bp.hap.run-until ...

However, note that there is no hap X86_HLT_Instr in the default processor core.

To see all haps, use

simics> list-haps

Maybe a better way to mark the end of the code is to use a magic instruction?

jakobengblom2
  • 5,531
  • 2
  • 25
  • 33