Skip to contentSkip to conversation

misc MIPS improvments

PATCH Applied Richard Henderson 2 participants 5 messages Mar 30, 2012 – Aug 27, 2012

lore
Share & tools
lore
#0 lore raw

v2 cover misc MIPS improvments

Extracted and rebased from a larger patch set from December.

Available as

git://repo.or.cz/qemu/rth.git rth/mips/next

r~

Richard Henderson (2):
target-mips: Streamline indexed cp1 memory addressing.
mips-linux-user: Always support rdhwr.

 target-mips/translate.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH v2 1/2 target-mips: Streamline indexed cp1 memory addressing.

We've already eliminated both base and index being zero.

---
 target-mips/translate.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
target-mips/translate.c +1 -2
index a663b74..300d95e 100644
@@ -7742,8 +7742,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc,
     } else if (index == 0) {
         gen_load_gpr(t0, base);
     } else {
-        gen_load_gpr(t0, index);
-        gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
+        gen_op_addr_add(ctx, t0, cpu_gpr[base], cpu_gpr[index]);
     }
     /* Don't do NOP if destination is zero: we must perform the actual
        memory access. */
Signature · 1 line
1.7.7.6
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] target-mips: Streamline indexed cp1 memory addressing.

Quoted 10 lines · Richard Henderson

We've already eliminated both base and index being zero.

---
 target-mips/translate.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
target-mips/translate.c +0 -0
index a663b74..300d95e 100644

target-mips/translate.c static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc, · line 7748

Quoted 9 lines
target-mips/translate.c +1 -2
@@ -7742,8 +7742,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc,
     } else if (index == 0) {
         gen_load_gpr(t0, base);
     } else {
-        gen_load_gpr(t0, index);
-        gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
+        gen_op_addr_add(ctx, t0, cpu_gpr[base], cpu_gpr[index]);
     }
     /* Don't do NOP if destination is zero: we must perform the actual
        memory access. */

Thanks, applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw

PATCH v2 2/2 mips-linux-user: Always support rdhwr.

In reply to Richard Henderson

The kernel will emulate this instruction if it's not supported natively. This insn is used for TLS, among other things, and so is required by modern glibc.

---
 target-mips/translate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
target-mips/translate.c +4 -0
index 300d95e..ed28ca8 100644
@@ -8111,7 +8111,11 @@ gen_rdhwr (CPUMIPSState *env, DisasContext *ctx, int rt, int rd)
 {
     TCGv t0;
 
+#if !defined(CONFIG_USER_ONLY)
+    /* The Linux kernel will emulate rdhwr if it's not supported natively.
+       Therefore only check the ISA in system mode.  */
     check_insn(env, ctx, ISA_MIPS32R2);
+#endif
     t0 = tcg_temp_new();
 
     switch (rd) {
Signature · 1 line
1.7.7.6
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] mips-linux-user: Always support rdhwr.

Quoted 16 lines · Richard Henderson

The kernel will emulate this instruction if it's not supported natively. This insn is used for TLS, among other things, and so is required by modern glibc.

---
 target-mips/translate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
target-mips/translate.c +0 -0
index 300d95e..ed28ca8 100644
@@ -8111,7 +8111,11 @@ gen_rdhwr (CPUMIPSState *env, DisasContext *ctx, int rt, int rd)
 {

target-mips/translate.c gen_rdhwr (CPUMIPSState *env, DisasContext *ctx, int rt, int rd) · line 8121

Quoted 10 lines
target-mips/translate.c +4 -0
     TCGv t0;
 
+#if !defined(CONFIG_USER_ONLY)
+    /* The Linux kernel will emulate rdhwr if it's not supported natively.
+       Therefore only check the ISA in system mode.  */
     check_insn(env, ctx, ISA_MIPS32R2);
+#endif
     t0 = tcg_temp_new();
 
     switch (rd) {

Thanks, applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net