Hi Guys,

I'm trying to understand better intermediate code generation with qemu and
I'm having some problems. I've seen that qemu have some different memory
areas, such as code, start_brk, end_code... One of these areas is 'entry'.
What exactly this area keeps? I've been able to see, through '-d op' qemu
option, that some code is placed in it. I also could notice that it doesn't
matter which code I'm running, it will always begin with the below
mentioned instructions:

OP:

 ---- 0x40008025b0

 mov_i64 tmp0,rsp

 mov_i64 rdi,tmp0



 ---- 0x40008025b3

 movi_i64 tmp12,$0x40008025b8

 movi_i64 tmp13,$0x4000805e40

 movi_i64 tmp14,$trace_pc_im

 call tmp14,$0x0,$0,tmp13,tmp12
...

After these instruction the program flow follows to a few rdtsc
instructions, that are supposedly measuring processor cycles.

Here comes my doubts...

1 - Where exactly in the source code are these instructions that are placed
inside entry generated? I've seen that some of them are really translated
into IR through the disas_insn(), but how exactly it is done still very
unclear to me. If this simulation prologue is always the same, does it
really need to be translated into IR?

2 - What exactly the source code placed into the entry memory area is
supposed to do? What are the rdtsc instructions used for?

3 - Is there a good place where I can read about how dynamically linked
libraries are handled on qemu? If not, where in the source is it handled?

Well, thank you! Any help will be of great use!
Cheers!

Reply via email to