Skip to contentSkip to conversation

Fixes for ia64-linux host

PATCH In review Richard Henderson 3 participants 12 messages Nov 22, 2010 – Dec 1, 2010

lore
Share & tools
lore
#0 lore raw

cover Fixes for ia64-linux host

Three compilation errors, one tcg_abort, two code-generation errors, and one warning fix. Though for the most part I'm using --disable-werror until the code base is generally fixed up for gcc 4.6.

I don't know if Aurelien is still active or not, but I've cc'd him anyway. Hopefully the ia64 bits are simple enough that anyone can look at them and approve them...

r~

Richard Henderson (7):
microblaze: target-ify target_ucontext
tcg: Fix default definition of divu_i32 and remu_i32.
tcg-ia64: Provide default GUEST_BASE.
tcg-ia64: Implement qemu_ld32.
tcg-ia64: Fix tlb read error for 32-bit targets.
tcg-ia64: Fix address compilation in qemu_st.
tcg-ia64: Fix warning in qemu_ld.

 linux-user/signal.c   |   18 +++++++++---------
 tcg/ia64/tcg-target.c |   13 +++++++++----
 tcg/tcg-op.h          |    4 ++--
 3 files changed, 20 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/7 microblaze: target-ify target_ucontext

From: Richard Henderson <[email protected]>

Rename the members of target_ucontext so that they don't conflict with possible host macros for ucontext members. This has already been done for the other targets.

---
 linux-user/signal.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
linux-user/signal.c +9 -9
index 77683f7..7c62fac 100644
@@ -3071,11 +3071,11 @@ struct target_stack_t {
 };
 
 struct target_ucontext {
-    abi_ulong uc_flags;
-    abi_ulong uc_link;
-    struct target_stack_t uc_stack;
-    struct target_sigcontext sc;
-    uint32_t extramask[TARGET_NSIG_WORDS - 1];
+    abi_ulong tuc_flags;
+    abi_ulong tuc_link;
+    struct target_stack_t tuc_stack;
+    struct target_sigcontext tuc_mcontext;
+    uint32_t tuc_extramask[TARGET_NSIG_WORDS - 1];
 };
 
 /* Signal frames. */
@@ -3189,7 +3189,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
         goto badframe;
 
     /* Save the mask.  */
-    err |= __put_user(set->sig[0], &frame->uc.sc.oldmask);
+    err |= __put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask);
     if (err)
         goto badframe;
 
@@ -3198,7 +3198,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
             goto badframe;
     }
 
-    setup_sigcontext(&frame->uc.sc, env);
+    setup_sigcontext(&frame->uc.tuc_mcontext, env);
 
     /* Set up to return from userspace. If provided, use a stub
        already in userspace. */
@@ -3261,7 +3261,7 @@ long do_sigreturn(CPUState *env)
         goto badframe;
 
     /* Restore blocked signals */
-    if (__get_user(target_set.sig[0], &frame->uc.sc.oldmask))
+    if (__get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask))
         goto badframe;
     for(i = 1; i < TARGET_NSIG_WORDS; i++) {
         if (__get_user(target_set.sig[i], &frame->extramask[i - 1]))
@@ -3270,7 +3270,7 @@ long do_sigreturn(CPUState *env)
     target_to_host_sigset_internal(&set, &target_set);
     sigprocmask(SIG_SETMASK, &set, NULL);
 
-    restore_sigcontext(&frame->uc.sc, env);
+    restore_sigcontext(&frame->uc.tuc_mcontext, env);
     /* We got here through a sigreturn syscall, our path back is via an
        rtb insn so setup r14 for that.  */
     env->regs[14] = env->sregs[SR_PC];
Signature · 1 line
1.7.2.3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/7] microblaze: target-ify target_ucontext

Quoted 5 lines · Richard Henderson

From: Richard Henderson <[email protected]>

Rename the members of target_ucontext so that they don't conflict with possible host macros for ucontext members. This has already been done for the other targets.

Thanks, I applied this one.

Cheers

Quoted 67 lines
---
 linux-user/signal.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
linux-user/signal.c +9 -9
index 77683f7..7c62fac 100644
@@ -3071,11 +3071,11 @@ struct target_stack_t {
 };
 
 struct target_ucontext {
-    abi_ulong uc_flags;
-    abi_ulong uc_link;
-    struct target_stack_t uc_stack;
-    struct target_sigcontext sc;
-    uint32_t extramask[TARGET_NSIG_WORDS - 1];
+    abi_ulong tuc_flags;
+    abi_ulong tuc_link;
+    struct target_stack_t tuc_stack;
+    struct target_sigcontext tuc_mcontext;
+    uint32_t tuc_extramask[TARGET_NSIG_WORDS - 1];
 };
 
 /* Signal frames. */
@@ -3189,7 +3189,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
         goto badframe;
 
     /* Save the mask.  */
-    err |= __put_user(set->sig[0], &frame->uc.sc.oldmask);
+    err |= __put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask);
     if (err)
         goto badframe;
 
@@ -3198,7 +3198,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
             goto badframe;
     }
 
-    setup_sigcontext(&frame->uc.sc, env);
+    setup_sigcontext(&frame->uc.tuc_mcontext, env);
 
     /* Set up to return from userspace. If provided, use a stub
        already in userspace. */
@@ -3261,7 +3261,7 @@ long do_sigreturn(CPUState *env)
         goto badframe;
 
     /* Restore blocked signals */
-    if (__get_user(target_set.sig[0], &frame->uc.sc.oldmask))
+    if (__get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask))
         goto badframe;
     for(i = 1; i < TARGET_NSIG_WORDS; i++) {
         if (__get_user(target_set.sig[i], &frame->extramask[i - 1]))
@@ -3270,7 +3270,7 @@ long do_sigreturn(CPUState *env)
     target_to_host_sigset_internal(&set, &target_set);
     sigprocmask(SIG_SETMASK, &set, NULL);
 
-    restore_sigcontext(&frame->uc.sc, env);
+    restore_sigcontext(&frame->uc.tuc_mcontext, env);
     /* We got here through a sigreturn syscall, our path back is via an
        rtb insn so setup r14 for that.  */
     env->regs[14] = env->sregs[SR_PC];
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 2/7 tcg: Fix default definition of divu_i32 and remu_i32.

In reply to Richard Henderson

From: Richard Henderson <[email protected]>

The arguments to tcg_gen_helper32 for these functions were not updated correctly in rev 2bece2c88331f024a46527634e3dd91c71d22141.

---
 tcg/tcg-op.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tcg/tcg-op.h +2 -2
index c68927e..3ee0a58 100644
@@ -727,7 +727,7 @@ static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
     sizemask |= tcg_gen_sizemask(1, 0, 0);
     sizemask |= tcg_gen_sizemask(2, 0, 0);
 
-    tcg_gen_helper32(tcg_helper_divu_i32, ret, arg1, arg2, 0);
+    tcg_gen_helper32(tcg_helper_divu_i32, sizemask, ret, arg1, arg2);
 }
 
 static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
@@ -738,7 +738,7 @@ static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
     sizemask |= tcg_gen_sizemask(1, 0, 0);
     sizemask |= tcg_gen_sizemask(2, 0, 0);
 
-    tcg_gen_helper32(tcg_helper_remu_i32, ret, arg1, arg2, 0);
+    tcg_gen_helper32(tcg_helper_remu_i32, sizemask, ret, arg1, arg2);
 }
 #endif
 
Signature · 1 line
1.7.2.3
#4 lore raw

PATCH 3/7 tcg-ia64: Provide default GUEST_BASE.

In reply to Richard Henderson

Fix compilation error when GUEST_BASE is not defined.

---
 tcg/ia64/tcg-target.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
tcg/ia64/tcg-target.c +3 -0
index a0f3877..80c6950 100644
@@ -45,6 +45,9 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
 #else
 #define TCG_GUEST_BASE_REG TCG_REG_R0
 #endif
+#ifndef GUEST_BASE
+#define GUEST_BASE 0
+#endif
 
 /* Branch registers */
 enum {
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 4/7 tcg-ia64: Implement qemu_ld32.

In reply to Richard Henderson

The port was not properly merged following
86feb1c860dc38e9c89e787c5210e8191800385e

---
 tcg/ia64/tcg-target.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tcg/ia64/tcg-target.c +1 -0
index 80c6950..62f0804 100644
@@ -2124,6 +2124,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
     case INDEX_op_qemu_ld16s:
         tcg_out_qemu_ld(s, args, 1 | 4);
         break;
+    case INDEX_op_qemu_ld32:
     case INDEX_op_qemu_ld32u:
         tcg_out_qemu_ld(s, args, 2);
         break;
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH 5/7 tcg-ia64: Fix tlb read error for 32-bit targets.

In reply to Richard Henderson

Use ld4 not ld8 for reading the tlb of 32-bit targets.

---
 tcg/ia64/tcg-target.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
tcg/ia64/tcg-target.c +3 -1
index 62f0804..da81f1b 100644
@@ -1459,7 +1459,9 @@ static inline void tcg_out_qemu_tlb(TCGContext *s, TCGArg addr_reg,
                    tcg_opc_a1 (TCG_REG_P0, OPC_ADD_A1, TCG_REG_R2,
                                TCG_REG_R2, TCG_AREG0));
     tcg_out_bundle(s, mII,
-                   tcg_opc_m3 (TCG_REG_P0, OPC_LD8_M3, TCG_REG_R57,
+                   tcg_opc_m3 (TCG_REG_P0,
+                               (TARGET_LONG_BITS == 32
+                                ? OPC_LD4_M3 : OPC_LD8_M3), TCG_REG_R57,
                                TCG_REG_R2, offset_addend - offset_rw),
                    tcg_opc_a1 (TCG_REG_P0, OPC_AND_A1, TCG_REG_R3,
                                TCG_REG_R3, TCG_REG_R56),
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 6/7 tcg-ia64: Fix address compilation in qemu_st.

In reply to Richard Henderson

A typo in the usermode address calculation path; R3 used where R2 needed.

---
 tcg/ia64/tcg-target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tcg/ia64/tcg-target.c +1 -1
index da81f1b..57d0bcc 100644
@@ -1818,7 +1818,7 @@ static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)
         tcg_out_bundle(s, miI,
                        tcg_opc_m48(TCG_REG_P0, OPC_NOP_M48, 0),
                        tcg_opc_i29(TCG_REG_P0, OPC_ZXT4_I29,
-                                   TCG_REG_R3, addr_reg),
+                                   TCG_REG_R2, addr_reg),
                        tcg_opc_i18(TCG_REG_P0, OPC_NOP_I18, 0));
     }
 
Signature · 1 line
1.7.2.3
#8 lore raw

PATCH 7/7 tcg-ia64: Fix warning in qemu_ld.

In reply to Richard Henderson

The usermode version of qemu_ld doesn't used mem_index, leading to set-but-not-used warnings.

---
 tcg/ia64/tcg-target.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
tcg/ia64/tcg-target.c +1 -2
index 57d0bcc..3ddf434 100644
@@ -1658,11 +1658,10 @@ static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc)
     static uint64_t const opc_sxt_i29[4] = {
         OPC_SXT1_I29, OPC_SXT2_I29, OPC_SXT4_I29, 0
     };
-    int addr_reg, data_reg, mem_index, s_bits, bswap;
+    int addr_reg, data_reg, s_bits, bswap;
 
     data_reg = *args++;
     addr_reg = *args++;
-    mem_index = *args;
     s_bits = opc & 3;
 
 #ifdef TARGET_WORDS_BIGENDIAN
Signature · 1 line
1.7.2.3
#9 lore raw

Re: [Qemu-devel] [PATCH 7/7] tcg-ia64: Fix warning in qemu_ld.

Quoted 1 line · Richard Henderson

The usermode version of qemu_ld doesn't used mem_index,

"doesn't used"? Doesn't use perhaps?

Quoted 25 lines

leading to set-but-not-used warnings.

---
 tcg/ia64/tcg-target.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
tcg/ia64/tcg-target.c +1 -2
index 57d0bcc..3ddf434 100644
@@ -1658,11 +1658,10 @@ static inline void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc)
     static uint64_t const opc_sxt_i29[4] = {
         OPC_SXT1_I29, OPC_SXT2_I29, OPC_SXT4_I29, 0
     };
-    int addr_reg, data_reg, mem_index, s_bits, bswap;
+    int addr_reg, data_reg, s_bits, bswap;
 
     data_reg = *args++;
     addr_reg = *args++;
-    mem_index = *args;
     s_bits = opc & 3;
 
 #ifdef TARGET_WORDS_BIGENDIAN
Signature · 1 line
mailto:[email protected]
#10 lore raw

Re: [Qemu-devel] [PATCH 7/7] tcg-ia64: Fix warning in qemu_ld.

Quoted 5 lines · malc
Quoted 1 line · Richard Henderson

The usermode version of qemu_ld doesn't used mem_index,

"doesn't used"? Doesn't use perhaps?

Err, yes, of course.

r~

#11 lore raw
In reply to Richard Henderson
Quoted 7 lines · Richard Henderson

Three compilation errors, one tcg_abort, two code-generation errors, and one warning fix. Though for the most part I'm using --disable-werror until the code base is generally fixed up for gcc 4.6.

I don't know if Aurelien is still active or not, but I've cc'd him anyway. Hopefully the ia64 bits are simple enough that anyone can look at them and approve them...

Hi,

I've applied the remaining non-microblaze parts now.

Thanks

Quoted 23 lines

r~

Richard Henderson (7):
microblaze: target-ify target_ucontext
tcg: Fix default definition of divu_i32 and remu_i32.
tcg-ia64: Provide default GUEST_BASE.
tcg-ia64: Implement qemu_ld32.
tcg-ia64: Fix tlb read error for 32-bit targets.
tcg-ia64: Fix address compilation in qemu_st.
tcg-ia64: Fix warning in qemu_ld.

 linux-user/signal.c   |   18 +++++++++---------
 tcg/ia64/tcg-target.c |   13 +++++++++----
 tcg/tcg-op.h          |    4 ++--
 3 files changed, 20 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.2.3