qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Difference between tcg_gen_ld_i64 and tcg_gen_qemu_ld_i64.
@ 2018-04-29 10:15 Rafael Kioji
  2018-04-29 11:18 ` Bastian Koppelmann
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Kioji @ 2018-04-29 10:15 UTC (permalink / raw)
  To: qemu-devel

Dear all,

What is the difference between these two functions? They are located in 
the file "tcg/tcg-op.c". Here is their header:

 1. static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2,
    tcg_target_long offset)
 2. void tcg_gen_qemu_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx,
    TCGMemOp memop)

I don't quite understand the need for function (1). Especially because 
it is usually passed "cpu_env" for arg2. Like in 
target/arm/translate-a64.c:595:

> /* Convenience accessors for reading and writing single and double
>  * FP registers. Writing clears the upper parts of the associated
>  * 128 bit vector register, as required by the architecture.
>  * Note that unlike the GP register accessors, the values returned
>  * by the read functions must be manually freed.
>  */
> static TCGv_i64 read_fp_dreg(DisasContext *s, int reg)
> {
>     TCGv_i64 v = tcg_temp_new_i64();
>
>     tcg_gen_ld_i64(v, cpu_env, fp_reg_offset(s, reg, MO_64));
>     return v;
> }


Thanks!

  
--
Att.,
Rafael

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Difference between tcg_gen_ld_i64 and tcg_gen_qemu_ld_i64.
  2018-04-29 10:15 [Qemu-devel] Difference between tcg_gen_ld_i64 and tcg_gen_qemu_ld_i64 Rafael Kioji
@ 2018-04-29 11:18 ` Bastian Koppelmann
  0 siblings, 0 replies; 2+ messages in thread
From: Bastian Koppelmann @ 2018-04-29 11:18 UTC (permalink / raw)
  To: Rafael Kioji, qemu-devel

On 04/29/2018 12:15 PM, Rafael Kioji wrote:
> Dear all,
> 
> What is the difference between these two functions? They are located in the file
> "tcg/tcg-op.c". Here is their header:
> 
> 1. static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2,
>    tcg_target_long offset)

This is used to access fields of qemu data structures from generated code, e.g.
CPUArmState.

> 2. void tcg_gen_qemu_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx,
>    TCGMemOp memop)

This actually generates a load to guest memory.

> 
> I don't quite understand the need for function (1). Especially because it is
> usually passed "cpu_env" for arg2. Like in target/arm/translate-a64.c:595:

cpu_env is a pointer to CPUArmState.

Cheers,
Bastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-29 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-29 10:15 [Qemu-devel] Difference between tcg_gen_ld_i64 and tcg_gen_qemu_ld_i64 Rafael Kioji
2018-04-29 11:18 ` Bastian Koppelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).