All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 09/18] tcg: Change relocation offsets to intptr_t
Date: Thu, 29 Aug 2013 12:53:52 +0200	[thread overview]
Message-ID: <20130829105352.GM5908@ohm.aurel32.net> (raw)
In-Reply-To: <1377190729-14008-10-git-send-email-rth@twiddle.net>

On Thu, Aug 22, 2013 at 09:58:40AM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/aarch64/tcg-target.c |  2 +-
>  tcg/arm/tcg-target.c     |  8 ++++----
>  tcg/hppa/tcg-target.c    |  6 +++---
>  tcg/i386/tcg-target.c    |  2 +-
>  tcg/ia64/tcg-target.c    | 14 +++++++-------
>  tcg/mips/tcg-target.c    | 16 ++++++++--------
>  tcg/ppc/tcg-target.c     |  2 +-
>  tcg/ppc64/tcg-target.c   |  2 +-
>  tcg/s390/tcg-target.c    |  6 +++---
>  tcg/sparc/tcg-target.c   |  6 +++---
>  tcg/tcg.c                |  9 +++++----
>  tcg/tcg.h                |  4 ++--
>  tcg/tci/tcg-target.c     |  2 +-
>  13 files changed, 40 insertions(+), 39 deletions(-)
> 
> diff --git a/tcg/aarch64/tcg-target.c b/tcg/aarch64/tcg-target.c
> index 41a17f8..7dde210 100644
> --- a/tcg/aarch64/tcg-target.c
> +++ b/tcg/aarch64/tcg-target.c
> @@ -88,7 +88,7 @@ static inline void reloc_pc19(void *code_ptr, tcg_target_long target)
>  }
>  
>  static inline void patch_reloc(uint8_t *code_ptr, int type,
> -                               tcg_target_long value, tcg_target_long addend)
> +                               intptr_t value, intptr_t addend)
>  {
>      value += addend;
>  
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index 6c4854d..e93c67f 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -108,21 +108,21 @@ static const int tcg_target_call_oarg_regs[2] = {
>  
>  #define TCG_REG_TMP  TCG_REG_R12
>  
> -static inline void reloc_abs32(void *code_ptr, tcg_target_long target)
> +static inline void reloc_abs32(void *code_ptr, intptr_t target)
>  {
>      *(uint32_t *) code_ptr = target;
>  }
>  
> -static inline void reloc_pc24(void *code_ptr, tcg_target_long target)
> +static inline void reloc_pc24(void *code_ptr, intptr_t target)
>  {
> -    uint32_t offset = ((target - ((tcg_target_long) code_ptr + 8)) >> 2);
> +    uint32_t offset = ((target - ((intptr_t)code_ptr + 8)) >> 2);
>  
>      *(uint32_t *) code_ptr = ((*(uint32_t *) code_ptr) & ~0xffffff)
>                               | (offset & 0xffffff);
>  }
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      switch (type) {
>      case R_ARM_ABS32:
> diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
> index 68f77ba..e055988 100644
> --- a/tcg/hppa/tcg-target.c
> +++ b/tcg/hppa/tcg-target.c
> @@ -145,14 +145,14 @@ static int reassemble_21(int as21)
>  #define R_PARISC_PCREL12F  R_PARISC_NONE
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      uint32_t *insn_ptr = (uint32_t *)code_ptr;
>      uint32_t insn = *insn_ptr;
> -    tcg_target_long pcrel;
> +    intptr_t pcrel;
>  
>      value += addend;
> -    pcrel = (value - ((tcg_target_long)code_ptr + 8)) >> 2;
> +    pcrel = (value - ((intptr_t)code_ptr + 8)) >> 2;
>  
>      switch (type) {
>      case R_PARISC_PCREL12F:
> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
> index 87eeab3..63db888 100644
> --- a/tcg/i386/tcg-target.c
> +++ b/tcg/i386/tcg-target.c
> @@ -112,7 +112,7 @@ static bool have_cmov;
>  static uint8_t *tb_ret_addr;
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      value += addend;
>      switch(type) {
> diff --git a/tcg/ia64/tcg-target.c b/tcg/ia64/tcg-target.c
> index 2373d9e..c499ee8 100644
> --- a/tcg/ia64/tcg-target.c
> +++ b/tcg/ia64/tcg-target.c
> @@ -668,16 +668,16 @@ static inline uint64_t tcg_opc_x3(int qp, uint64_t opc, uint64_t imm)
>   * Relocations
>   */
>  
> -static inline void reloc_pcrel21b (void *pc, tcg_target_long target)
> +static inline void reloc_pcrel21b(void *pc, intptr_t target)
>  {
>      uint64_t imm;
>      int64_t disp;
>      int slot;
>  
> -    slot = (tcg_target_long) pc & 3;
> -    pc = (void *)((tcg_target_long) pc & ~3);
> +    slot = (intptr_t)pc & 3;
> +    pc = (void *)((intptr_t)pc & ~3);
>  
> -    disp = target - (tcg_target_long) pc;
> +    disp = target - (intptr_t)pc;
>      imm = (uint64_t) disp >> 4;
>  
>      switch(slot) {
> @@ -728,12 +728,12 @@ static inline uint64_t get_reloc_pcrel21b (void *pc)
>      }
>  }
>  
> -static inline void reloc_pcrel60b (void *pc, tcg_target_long target)
> +static inline void reloc_pcrel60b(void *pc, intptr_t target)
>  {
>      int64_t disp;
>      uint64_t imm;
>  
> -    disp = target - (tcg_target_long) pc;
> +    disp = target - (intptr_t)pc;
>      imm = (uint64_t) disp >> 4;
>  
>      *(uint64_t *)(pc + 8) = (*(uint64_t *)(pc + 8) & 0xf700000fff800000ull)
> @@ -759,7 +759,7 @@ static inline uint64_t get_reloc_pcrel60b (void *pc)
>  
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      value += addend;
>      switch (type) {
> diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
> index 793532e..5aa31dc 100644
> --- a/tcg/mips/tcg-target.c
> +++ b/tcg/mips/tcg-target.c
> @@ -108,33 +108,33 @@ static const TCGReg tcg_target_call_oarg_regs[2] = {
>  
>  static uint8_t *tb_ret_addr;
>  
> -static inline uint32_t reloc_lo16_val (void *pc, tcg_target_long target)
> +static inline uint32_t reloc_lo16_val(void *pc, intptr_t target)
>  {
>      return target & 0xffff;
>  }
>  
> -static inline void reloc_lo16 (void *pc, tcg_target_long target)
> +static inline void reloc_lo16(void *pc, intptr_t target)
>  {
>      *(uint32_t *) pc = (*(uint32_t *) pc & ~0xffff)
>                         | reloc_lo16_val(pc, target);
>  }
>  
> -static inline uint32_t reloc_hi16_val (void *pc, tcg_target_long target)
> +static inline uint32_t reloc_hi16_val(void *pc, intptr_t target)
>  {
>      return (target >> 16) & 0xffff;
>  }
>  
> -static inline void reloc_hi16 (void *pc, tcg_target_long target)
> +static inline void reloc_hi16(void *pc, intptr_t target)
>  {
>      *(uint32_t *) pc = (*(uint32_t *) pc & ~0xffff)
>                         | reloc_hi16_val(pc, target);
>  }
>  
> -static inline uint32_t reloc_pc16_val (void *pc, tcg_target_long target)
> +static inline uint32_t reloc_pc16_val(void *pc, intptr_t target)
>  {
>      int32_t disp;
>  
> -    disp = target - (tcg_target_long) pc - 4;
> +    disp = target - (intptr_t)pc - 4;
>      if (disp != (disp << 14) >> 14) {
>          tcg_abort ();
>      }
> @@ -157,14 +157,14 @@ static inline uint32_t reloc_26_val (void *pc, tcg_target_long target)
>      return (target >> 2) & 0x3ffffff;
>  }
>  
> -static inline void reloc_pc26 (void *pc, tcg_target_long target)
> +static inline void reloc_pc26(void *pc, intptr_t target)
>  {
>      *(uint32_t *) pc = (*(uint32_t *) pc & ~0x3ffffff)
>                         | reloc_26_val(pc, target);
>  }
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      value += addend;
>      switch(type) {
> diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
> index 453ab6b..4d6ee1e 100644
> --- a/tcg/ppc/tcg-target.c
> +++ b/tcg/ppc/tcg-target.c
> @@ -204,7 +204,7 @@ static void reloc_pc14 (void *pc, tcg_target_long target)
>  }
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      value += addend;
>      switch (type) {
> diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
> index 0678de2..fb070f8 100644
> --- a/tcg/ppc64/tcg-target.c
> +++ b/tcg/ppc64/tcg-target.c
> @@ -208,7 +208,7 @@ static void reloc_pc14 (void *pc, tcg_target_long target)
>  }
>  
>  static void patch_reloc (uint8_t *code_ptr, int type,
> -                         tcg_target_long value, tcg_target_long addend)
> +                         intptr_t value, intptr_t addend)
>  {
>      value += addend;
>      switch (type) {
> diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
> index f229f1c..adf7099 100644
> --- a/tcg/s390/tcg-target.c
> +++ b/tcg/s390/tcg-target.c
> @@ -351,10 +351,10 @@ static uint8_t *tb_ret_addr;
>  static uint64_t facilities;
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
> -    tcg_target_long code_ptr_tl = (tcg_target_long)code_ptr;
> -    tcg_target_long pcrel2;
> +    intptr_t code_ptr_tl = (intptr_t)code_ptr;
> +    intptr_t pcrel2;
>  
>      /* ??? Not the usual definition of "addend".  */
>      pcrel2 = (value - (code_ptr_tl + addend)) >> 1;
> diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
> index 5bfd29c..9f2e2c9 100644
> --- a/tcg/sparc/tcg-target.c
> +++ b/tcg/sparc/tcg-target.c
> @@ -252,7 +252,7 @@ static inline int check_fit_i32(uint32_t val, unsigned int bits)
>  }
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      uint32_t insn;
>      value += addend;
> @@ -264,7 +264,7 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>          *(uint32_t *)code_ptr = value;
>          break;
>      case R_SPARC_WDISP16:
> -        value -= (long)code_ptr;
> +        value -= (intptr_t)code_ptr;
>          if (!check_fit_tl(value >> 2, 16)) {
>              tcg_abort();
>          }
> @@ -274,7 +274,7 @@ static void patch_reloc(uint8_t *code_ptr, int type,
>          *(uint32_t *)code_ptr = insn;
>          break;
>      case R_SPARC_WDISP19:
> -        value -= (long)code_ptr;
> +        value -= (intptr_t)code_ptr;
>          if (!check_fit_tl(value >> 2, 19)) {
>              tcg_abort();
>          }
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 04f1727..c6ab07f 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -66,7 +66,7 @@
>  static void tcg_target_init(TCGContext *s);
>  static void tcg_target_qemu_prologue(TCGContext *s);
>  static void patch_reloc(uint8_t *code_ptr, int type, 
> -                        tcg_target_long value, tcg_target_long addend);
> +                        intptr_t value, intptr_t addend);
>  
>  /* The CIE and FDE header definitions will be common to all hosts.  */
>  typedef struct {
> @@ -134,7 +134,7 @@ static inline void tcg_out32(TCGContext *s, uint32_t v)
>  /* label relocation processing */
>  
>  static void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type,
> -                          int label_index, long addend)
> +                          int label_index, intptr_t addend)
>  {
>      TCGLabel *l;
>      TCGRelocation *r;
> @@ -160,11 +160,12 @@ static void tcg_out_label(TCGContext *s, int label_index, void *ptr)
>  {
>      TCGLabel *l;
>      TCGRelocation *r;
> -    tcg_target_long value = (tcg_target_long)ptr;
> +    intptr_t value = (intptr_t)ptr;
>  
>      l = &s->labels[label_index];
> -    if (l->has_value)
> +    if (l->has_value) {
>          tcg_abort();
> +    }
>      r = l->u.first_reloc;
>      while (r != NULL) {
>          patch_reloc(r->ptr, r->type, value, r->addend);
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 5f5e535..2375dc4 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -134,13 +134,13 @@ typedef struct TCGRelocation {
>      struct TCGRelocation *next;
>      int type;
>      uint8_t *ptr;
> -    tcg_target_long addend;
> +    intptr_t addend;
>  } TCGRelocation; 
>  
>  typedef struct TCGLabel {
>      int has_value;
>      union {
> -        tcg_target_ulong value;
> +        uintptr_t value;
>          TCGRelocation *first_reloc;
>      } u;
>  } TCGLabel;
> diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
> index e118bc7..49be6a5 100644
> --- a/tcg/tci/tcg-target.c
> +++ b/tcg/tci/tcg-target.c
> @@ -370,7 +370,7 @@ static const char *const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
>  #endif
>  
>  static void patch_reloc(uint8_t *code_ptr, int type,
> -                        tcg_target_long value, tcg_target_long addend)
> +                        intptr_t value, intptr_t addend)
>  {
>      /* tcg_out_reloc always uses the same type, addend. */
>      assert(type == sizeof(tcg_target_long));
> -- 
> 1.8.1.4
> 
> 
> 

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2013-08-29 10:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 16:58 [Qemu-devel] [PATCH 00/18] tcg: decouple tcg_target_long from pointer size Richard Henderson
2013-08-22 16:58 ` [Qemu-devel] [PATCH 01/18] qtest: Fix FMT_timeval vs time_t Richard Henderson
2013-08-22 17:09   ` Andreas Färber
2013-08-22 17:53     ` Richard Henderson
2013-08-22 18:01       ` Andreas Färber
2013-08-22 18:05         ` Richard Henderson
2013-08-22 16:58 ` [Qemu-devel] [PATCH 02/18] tcg: Change flush_icache_range arguments to uintptr_t Richard Henderson
2013-08-28 21:06   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 03/18] tcg: Change tcg_qemu_tb_exec return " Richard Henderson
2013-08-28 21:06   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 04/18] tcg: Fix next_tb type in cpu_exec Richard Henderson
2013-08-28 21:07   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 05/18] tcg: Define TCG_TYPE_PTR properly Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 06/18] tcg: Define TCG_ptr properly Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 07/18] tcg: Change frame pointer offsets to intptr_t Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 08/18] tcg: Change memory " Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 09/18] tcg: Change relocation " Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno [this message]
2013-08-22 16:58 ` [Qemu-devel] [PATCH 10/18] tcg: Use uintptr_t in TCGHelperInfo Richard Henderson
2013-08-29 10:53   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 11/18] tcg: Change tcg_gen_exit_tb argument to uintptr_t Richard Henderson
2013-08-29 10:54   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 12/18] tcg: Change tcg_out_ld/st offset to intptr_t Richard Henderson
2013-08-29 16:44   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 13/18] tcg: Use appropriate types in tcg_reg_alloc_call Richard Henderson
2013-08-29 16:44   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 14/18] tcg: Fix jit debug for pointer size != register size Richard Henderson
2013-08-29 16:44   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 15/18] tcg: Allow TCG_TARGET_REG_BITS to be specified independantly Richard Henderson
2013-08-29 16:45   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 16/18] tcg-i386: Use intptr_t appropriately Richard Henderson
2013-08-29 16:45   ` Aurelien Jarno
2013-08-22 16:58 ` [Qemu-devel] [PATCH 17/18] tcg-i386: Adjust tcg_out_tlb_load for x32 Richard Henderson
2013-08-29 16:45   ` Aurelien Jarno
2013-08-29 17:53     ` Richard Henderson
2013-08-29 20:52     ` Richard Henderson
2013-08-22 16:58 ` [Qemu-devel] [PATCH 18/18] configure: Allow x32 as a host Richard Henderson
2013-08-29 16:45   ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130829105352.GM5908@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.