Dear Kim,

A magic instruction is a special no-operation instruction. When Simics executes 
such an instruction, it triggers a Core_Magic_Instruction hap and calls all the 
callbacks functions registered on this hap. Because a magic instruction is a 
no-operation instruction, adding a magic instruction to a benchmark does not 
change the behavior of the benchmark.
Magic instructions are useful. As an example, you can add a magic instruction 
to the location in your benchmark where you want to take the first checkpoint 
(i.e., after initialization and warmup). 

[Pseudo Code *BEGIN*]
// initialization
// warm up

MAGIC(1);

// the rest of the benchmark
[Pseudo code *END*]

Then you can add a Core_Magic_Instruction hap to stop Simics simulation 
whenever the magic instruction is executed. 

[Simics script *BEGIN*]
@def hap_callback(user_arg, cpu, arg):
        if arg == 1:

                SIM_break_simulation("Magic Instruction")

@SIM_hap_add_callback("Core_Magic_Instruction", hap_callback, None)
[Simics script *END*]

You should compile the benchmark with the magic instruction and register the 
hap callback with the Simics script. If you run the benchmark in Simics, the 
simulation will stop whenever the magic instruction get executed. You can 
easily the the first checkpoint.

Regards,
Pejman

________________________________________
From: Eun-Sung Kim [[email protected]]
Sent: Monday, January 24, 2011 9:39 PM
To: simflex
Subject: Magic Breakpoint and checkpoint

Hi all,

I inserted a magic breakpoint in a SPEC benchmark, and compiled the benchmark 
in a targeted architecture(sun-solaris). I made a Simics script file for Flexus 
simulation(Thanks to Mahmood Naderan for importing binary images to Simics). As 
an example of preparing the test application in "Flexus Getting Started Guide", 
'filter' test application works well, but my work does not. My script file is 
mostly same as an prepare-test-app-v9.simics. In simulated machine on Simics, 
the benchmark program is run and finished, then there is no further processing. 
It still stays in simulated machine(solaris).
I think it is due to a problem of magic breakpoint injection in SPEC benchmark. 
Could you show me an example of how and where you can inject a Magic breakpoint 
into SPEC benchmark(ex. gzip)?
Thanks,

--Kim

Reply via email to