Skip to contentSkip to conversation

tcg/mips: Unaligned access support

PATCH In review Richard Henderson 3 participants 7 messages Feb 2, 2022 – Feb 4, 2022

lore
Share & tools
lore
#0 lore raw

v5 cover tcg/mips: Unaligned access support

Based-on: <[email protected]> ("[PATCH v4 0/7] Unaligned access for user only")

Changes from v4:
* Rebase on master.
* Drop other cleanup for now.

Changes from v3:
* Rebase on master, which has some patches applied.

r~

Richard Henderson (2):
tcg/mips: Support unaligned access for user-only tcg/mips: Support unaligned access for softmmu

 tcg/mips/tcg-target.h     |   2 -
 tcg/mips/tcg-target.c.inc | 387 +++++++++++++++++++++++++++++++++++---
 2 files changed, 360 insertions(+), 29 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v5 1/2 tcg/mips: Support unaligned access for user-only

This is kinda sorta the opposite of the other tcg hosts, where we get (normal) alignment checks for free with host SIGBUS and need to add code to support unaligned accesses.

Fortunately, the ISA contains pairs of instructions that are used to implement unaligned memory accesses. Use them.

---
 tcg/mips/tcg-target.h     |   2 -
 tcg/mips/tcg-target.c.inc | 334 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 328 insertions(+), 8 deletions(-)
tcg/mips/tcg-target.h +0 -2
index c366fdf74b..7669213175 100644
@@ -207,8 +207,6 @@ extern bool use_mips32r2_instructions;
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t, uintptr_t)
     QEMU_ERROR("code path is reachable");
 
-#ifdef CONFIG_SOFTMMU
 #define TCG_TARGET_NEED_LDST_LABELS
-#endif
 
 #endif
tcg/mips/tcg-target.c.inc +328 -6

410 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by Philippe Mathieu-Daudé on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] tcg/mips: Support unaligned access for user-only

Quoted 13 lines · Richard Henderson

This is kinda sorta the opposite of the other tcg hosts, where we get (normal) alignment checks for free with host SIGBUS and need to add code to support unaligned accesses.

Fortunately, the ISA contains pairs of instructions that are used to implement unaligned memory accesses. Use them.

---
  tcg/mips/tcg-target.h     |   2 -
  tcg/mips/tcg-target.c.inc | 334 +++++++++++++++++++++++++++++++++++++-
  2 files changed, 328 insertions(+), 8 deletions(-)

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1520

Quoted 3 lines
tcg/mips/tcg-target.c.inc +3 -0
+static void __attribute__((unused))
+tcg_out_qemu_ld_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
+                                    TCGReg base, MemOp opc, bool is_64)

Unaligned style to honor the function name? ;)

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1765

Quoted 3 lines
tcg/mips/tcg-target.c.inc +3 -0
+static void __attribute__((unused))
+tcg_out_qemu_st_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
+                                    TCGReg base, MemOp opc)

Ditto.

Quoted 5 lines
tcg/mips/tcg-target.c.inc +5 -0
+    case MO_64 | MO_BSWAP:
+        if (TCG_TARGET_REG_BITS == 64) {
+            tcg_out_bswap64(s, TCG_TMP3, lo);
+            lo = TCG_TMP3;
+        } else if (use_mips32r2_instructions) {

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1813

Quoted 10 lines
tcg/mips/tcg-target.c.inc +10 -0
+            tcg_out_opc_reg(s, OPC_WSBH, TCG_TMP0, 0, MIPS_BE ? hi : lo);
+            tcg_out_opc_reg(s, OPC_WSBH, TCG_TMP1, 0, MIPS_BE ? lo : hi);
+            tcg_out_opc_sa(s, OPC_ROTR, TCG_TMP0, TCG_TMP0, 16);
+            tcg_out_opc_sa(s, OPC_ROTR, TCG_TMP1, TCG_TMP1, 16);
+            hi = MIPS_BE ? TCG_TMP0 : TCG_TMP1;
+            lo = MIPS_BE ? TCG_TMP1 : TCG_TMP0;
+        } else {
+            tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? lo : hi, 0);
+            tcg_out_opc_imm(s, sw1, TCG_TMP3, base, 0);
+            tcg_out_opc_imm(s, sw2, TCG_TMP3, base, 3);

I'd keep the parity with ld_unalign and use 0 + 0, 0 + 3, ...

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1816

Quoted 3 lines
tcg/mips/tcg-target.c.inc +3 -0
+            tcg_out_bswap32(s, TCG_TMP3, MIPS_BE ? hi : lo, 0);
+            tcg_out_opc_imm(s, sw1, TCG_TMP3, base, 4);
+            tcg_out_opc_imm(s, sw2, TCG_TMP3, base, 7);

4 + 0, 4 + 3, ...

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1823

Quoted 7 lines
tcg/mips/tcg-target.c.inc +7 -0
+            break;
+        }
+        /* fall through */
+    case MO_64:
+        if (TCG_TARGET_REG_BITS == 64) {
+            tcg_out_opc_imm(s, sd1, lo, base, 0);
+            tcg_out_opc_imm(s, sd2, lo, base, 7);

Ditto, ...

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1828

Quoted 5 lines
tcg/mips/tcg-target.c.inc +5 -0
+        } else {
+            tcg_out_opc_imm(s, sw1, MIPS_BE ? hi : lo, base, 0);
+            tcg_out_opc_imm(s, sw2, MIPS_BE ? hi : lo, base, 3);
+            tcg_out_opc_imm(s, sw1, MIPS_BE ? lo : hi, base, 4);
+            tcg_out_opc_imm(s, sw2, MIPS_BE ? lo : hi, base, 7);

Ditto.

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1835

Quoted 7 lines
tcg/mips/tcg-target.c.inc +7 -0
+        }
+        break;
+
+    default:
+        tcg_abort();
+    }
+}

Beside the nitpicking comments, nothing to say, hardcore!

#3 lore raw

PATCH v5 2/2 tcg/mips: Support unaligned access for softmmu

In reply to Richard Henderson

We can use the routines just added for user-only to emit unaligned accesses in softmmu mode too.

---
 tcg/mips/tcg-target.c.inc | 91 ++++++++++++++++++++++-----------------
 1 file changed, 51 insertions(+), 40 deletions(-)
tcg/mips/tcg-target.c.inc +51 -40
index 7d706df39c..3bf29c2f77 100644
@@ -1134,8 +1134,10 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
                              tcg_insn_unit *label_ptr[2], bool is_load)
 {
     MemOp opc = get_memop(oi);
-    unsigned s_bits = opc & MO_SIZE;
     unsigned a_bits = get_alignment_bits(opc);
+    unsigned s_bits = opc & MO_SIZE;
+    unsigned a_mask = (1 << a_bits) - 1;
+    unsigned s_mask = (1 << s_bits) - 1;
     int mem_index = get_mmuidx(oi);
     int fast_off = TLB_MASK_TABLE_OFS(mem_index);
     int mask_off = fast_off + offsetof(CPUTLBDescFast, mask);
@@ -1143,7 +1145,7 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
     int add_off = offsetof(CPUTLBEntry, addend);
     int cmp_off = (is_load ? offsetof(CPUTLBEntry, addr_read)
                    : offsetof(CPUTLBEntry, addr_write));
-    target_ulong mask;
+    target_ulong tlb_mask;
 
     /* Load tlb_mask[mmu_idx] and tlb_table[mmu_idx].  */
     tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_AREG0, mask_off);
@@ -1157,27 +1159,13 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
     /* Add the tlb_table pointer, creating the CPUTLBEntry address in TMP3.  */
     tcg_out_opc_reg(s, ALIAS_PADD, TCG_TMP3, TCG_TMP3, TCG_TMP1);
 
-    /* We don't currently support unaligned accesses.
-       We could do so with mips32r6.  */
-    if (a_bits < s_bits) {
-        a_bits = s_bits;
-    }
-
-    /* Mask the page bits, keeping the alignment bits to compare against.  */
-    mask = (target_ulong)TARGET_PAGE_MASK | ((1 << a_bits) - 1);
-
     /* Load the (low-half) tlb comparator.  */
     if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
-        tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, cmp_off + LO_OFF);
-        tcg_out_movi(s, TCG_TYPE_I32, TCG_TMP1, mask);
+        tcg_out_ldst(s, OPC_LW, TCG_TMP0, TCG_TMP3, cmp_off + LO_OFF);
     } else {
         tcg_out_ldst(s, (TARGET_LONG_BITS == 64 ? OPC_LD
                          : TCG_TARGET_REG_BITS == 64 ? OPC_LWU : OPC_LW),
                      TCG_TMP0, TCG_TMP3, cmp_off);
-        tcg_out_movi(s, TCG_TYPE_TL, TCG_TMP1, mask);
-        /* No second compare is required here;
-           load the tlb addend for the fast path.  */
-        tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off);
     }
 
     /* Zero extend a 32-bit guest address for a 64-bit host. */
@@ -1185,7 +1173,25 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
         tcg_out_ext32u(s, base, addrl);
         addrl = base;
     }
-    tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrl);
+
+    /*
+     * Mask the page bits, keeping the alignment bits to compare against.
+     * For unaligned accesses, compare against the end of the access to
+     * verify that it does not cross a page boundary.
+     */
+    tlb_mask = (target_ulong)TARGET_PAGE_MASK | a_mask;
+    tcg_out_movi(s, TCG_TYPE_I32, TCG_TMP1, tlb_mask);
+    if (a_mask >= s_mask) {
+        tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrl);
+    } else {
+        tcg_out_opc_imm(s, ALIAS_PADDI, TCG_TMP2, addrl, s_mask - a_mask);
+        tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, TCG_TMP2);
+    }
+
+    if (TCG_TARGET_REG_BITS >= TARGET_LONG_BITS) {
+        /* Load the tlb addend for the fast path.  */
+        tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off);
+    }
 
     label_ptr[0] = s->code_ptr;
     tcg_out_opc_br(s, OPC_BNE, TCG_TMP1, TCG_TMP0);
@@ -1193,7 +1199,7 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
     /* Load and test the high half tlb comparator.  */
     if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
         /* delay slot */
-        tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, cmp_off + HI_OFF);
+        tcg_out_ldst(s, OPC_LW, TCG_TMP0, TCG_TMP3, cmp_off + HI_OFF);
 
         /* Load the tlb addend for the fast path.  */
         tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off);
@@ -1515,8 +1521,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi,
     }
 }
 
-static void __attribute__((unused))
-tcg_out_qemu_ld_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
+static void tcg_out_qemu_ld_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
                                     TCGReg base, MemOp opc, bool is_64)
 {
     const MIPSInsn lw1 = MIPS_BE ? OPC_LWL : OPC_LWR;
@@ -1645,8 +1650,8 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
 #if defined(CONFIG_SOFTMMU)
     tcg_insn_unit *label_ptr[2];
 #else
-    unsigned a_bits, s_bits;
 #endif
+    unsigned a_bits, s_bits;
     TCGReg base = TCG_REG_A0;
 
     data_regl = *args++;
@@ -1655,10 +1660,20 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
     addr_regh = (TCG_TARGET_REG_BITS < TARGET_LONG_BITS ? *args++ : 0);
     oi = *args++;
     opc = get_memop(oi);
+    a_bits = get_alignment_bits(opc);
+    s_bits = opc & MO_SIZE;
 
+    /*
+     * R6 removes the left/right instructions but requires the
+     * system to support misaligned memory accesses.
+     */
 #if defined(CONFIG_SOFTMMU)
     tcg_out_tlb_load(s, base, addr_regl, addr_regh, oi, label_ptr, 1);
-    tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64);
+    if (use_mips32r6_instructions || a_bits >= s_bits) {
+        tcg_out_qemu_ld_direct(s, data_regl, data_regh, base, opc, is_64);
+    } else {
+        tcg_out_qemu_ld_unalign(s, data_regl, data_regh, base, opc, is_64);
+    }
     add_qemu_ldst_label(s, 1, oi,
                         (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32),
                         data_regl, data_regh, addr_regl, addr_regh,
@@ -1675,12 +1690,6 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64)
     } else {
         tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_GUEST_BASE_REG, addr_regl);
     }
-    a_bits = get_alignment_bits(opc);
-    s_bits = opc & MO_SIZE;
-    /*
-     * R6 removes the left/right instructions but requires the
-     * system to support misaligned memory accesses.
-     */
     if (use_mips32r6_instructions) {
         if (a_bits) {
             tcg_out_test_alignment(s, true, addr_regl, addr_regh, a_bits);
@@ -1760,8 +1769,7 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg lo, TCGReg hi,
     }
 }
 
-static void __attribute__((unused))
-tcg_out_qemu_st_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
+static void tcg_out_qemu_st_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
                                     TCGReg base, MemOp opc)
 {
     const MIPSInsn sw1 = MIPS_BE ? OPC_SWL : OPC_SWR;
@@ -1841,9 +1849,8 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
     MemOp opc;
 #if defined(CONFIG_SOFTMMU)
     tcg_insn_unit *label_ptr[2];
-#else
-    unsigned a_bits, s_bits;
 #endif
+    unsigned a_bits, s_bits;
     TCGReg base = TCG_REG_A0;
 
     data_regl = *args++;
@@ -1852,10 +1859,20 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
     addr_regh = (TCG_TARGET_REG_BITS < TARGET_LONG_BITS ? *args++ : 0);
     oi = *args++;
     opc = get_memop(oi);
+    a_bits = get_alignment_bits(opc);
+    s_bits = opc & MO_SIZE;
 
+    /*
+     * R6 removes the left/right instructions but requires the
+     * system to support misaligned memory accesses.
+     */
 #if defined(CONFIG_SOFTMMU)
     tcg_out_tlb_load(s, base, addr_regl, addr_regh, oi, label_ptr, 0);
-    tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc);
+    if (use_mips32r6_instructions || a_bits >= s_bits) {
+        tcg_out_qemu_st_direct(s, data_regl, data_regh, base, opc);
+    } else {
+        tcg_out_qemu_st_unalign(s, data_regl, data_regh, base, opc);
+    }
     add_qemu_ldst_label(s, 0, oi,
                         (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32),
                         data_regl, data_regh, addr_regl, addr_regh,
@@ -1872,12 +1889,6 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64)
     } else {
         tcg_out_opc_reg(s, ALIAS_PADD, base, TCG_GUEST_BASE_REG, addr_regl);
     }
-    a_bits = get_alignment_bits(opc);
-    s_bits = opc & MO_SIZE;
-    /*
-     * R6 removes the left/right instructions but requires the
-     * system to support misaligned memory accesses.
-     */
     if (use_mips32r6_instructions) {
         if (a_bits) {
             tcg_out_test_alignment(s, true, addr_regl, addr_regh, a_bits);
Signature · 1 line
2.25.1
Reviewed-by Philippe Mathieu-Daudé on v5 2/2
#4 lore raw

Re: [PATCH v5 2/2] tcg/mips: Support unaligned access for softmmu

Quoted 38 lines · Richard Henderson

We can use the routines just added for user-only to emit unaligned accesses in softmmu mode too.

---
  tcg/mips/tcg-target.c.inc | 91 ++++++++++++++++++++++-----------------
  1 file changed, 51 insertions(+), 40 deletions(-)
      /* Load the (low-half) tlb comparator.  */
      if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
tcg/mips/tcg-target.c.inc +10 -7
-        tcg_out_ld(s, TCG_TYPE_I32, TCG_TMP0, TCG_TMP3, cmp_off + LO_OFF);
-        tcg_out_movi(s, TCG_TYPE_I32, TCG_TMP1, mask);
+        tcg_out_ldst(s, OPC_LW, TCG_TMP0, TCG_TMP3, cmp_off + LO_OFF);
      } else {
          tcg_out_ldst(s, (TARGET_LONG_BITS == 64 ? OPC_LD
                           : TCG_TARGET_REG_BITS == 64 ? OPC_LWU : OPC_LW),
                       TCG_TMP0, TCG_TMP3, cmp_off);
-        tcg_out_movi(s, TCG_TYPE_TL, TCG_TMP1, mask);
-        /* No second compare is required here;
-           load the tlb addend for the fast path.  */
-        tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off);
      }
 
      /* Zero extend a 32-bit guest address for a 64-bit host. */
@@ -1185,7 +1173,25 @@ static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl,
          tcg_out_ext32u(s, base, addrl);
          addrl = base;
      }
-    tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrl);
+
+    /*
+     * Mask the page bits, keeping the alignment bits to compare against.
+     * For unaligned accesses, compare against the end of the access to
+     * verify that it does not cross a page boundary.
+     */
+    tlb_mask = (target_ulong)TARGET_PAGE_MASK | a_mask;
+    tcg_out_movi(s, TCG_TYPE_I32, TCG_TMP1, tlb_mask);
+    if (a_mask >= s_mask) {

tcg/mips/tcg-target.c.inc static void tcg_out_tlb_load(TCGContext *s, TCGReg base, TCGReg addrl, · line 1194

Quoted 10 lines
tcg/mips/tcg-target.c.inc +10 -0
+        tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, addrl);
+    } else {
+        tcg_out_opc_imm(s, ALIAS_PADDI, TCG_TMP2, addrl, s_mask - a_mask);
+        tcg_out_opc_reg(s, OPC_AND, TCG_TMP1, TCG_TMP1, TCG_TMP2);
+    }
+
+    if (TCG_TARGET_REG_BITS >= TARGET_LONG_BITS) {
+        /* Load the tlb addend for the fast path.  */
+        tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP2, TCG_TMP3, add_off);
+    }

Out of my confort zone but looks sane:

tcg/mips/tcg-target.c.inc static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg lo, TCGReg hi, · line 1524

Quoted 3 lines
tcg/mips/tcg-target.c.inc +1 -2
-static void __attribute__((unused))
-tcg_out_qemu_ld_unalign(TCGContext *s, TCGReg lo, TCGReg hi,
+static void tcg_out_qemu_ld_unalign(TCGContext *s, TCGReg lo, TCGReg hi,

Oh now I see why it was unaligned in the previous patch :)

Quoted 2 lines
tcg/mips/tcg-target.c.inc +0 -0
                                      TCGReg base, MemOp opc, bool is_64)
  {
#5 lore raw
In reply to Richard Henderson

Cc'ing other reviewers:

$ ./scripts/get_maintainer.pl -f tcg/mips/tcg-target.h
"Philippe Mathieu-Daudé" <[email protected]> (odd fixer:MIPS TCG target)
Aurelien Jarno <[email protected]> (reviewer:MIPS TCG target)
Huacai Chen <[email protected]> (reviewer:MIPS TCG target)
Jiaxun Yang <[email protected]> (reviewer:MIPS TCG target)
Aleksandar Rikalo <[email protected]> (reviewer:MIPS TCG target)
Richard Henderson <[email protected]> (maintainer:Common TCG code)
[email protected] (open list:All patches CC here)
Quoted 21 lines · Richard Henderson

Based-on: <[email protected]> ("[PATCH v4 0/7] Unaligned access for user only")

Changes from v4:
* Rebase on master.
* Drop other cleanup for now.

Changes from v3:
* Rebase on master, which has some patches applied.

r~

Richard Henderson (2):
tcg/mips: Support unaligned access for user-only tcg/mips: Support unaligned access for softmmu

  tcg/mips/tcg-target.h     |   2 -
  tcg/mips/tcg-target.c.inc | 387 +++++++++++++++++++++++++++++++++++---
  2 files changed, 360 insertions(+), 29 deletions(-)
Reviewed-by Tested-by on the v5 series
#6 lore raw
In reply to Richard Henderson
Quoted 9 lines · Richard Henderson

Based-on: <[email protected]> ("[PATCH v4 0/7] Unaligned access for user only")

Changes from v4:
* Rebase on master.
* Drop other cleanup for now.

Changes from v3:
* Rebase on master, which has some patches applied.

For the whole series:

Run some sample program with GCC unaligned-access enabled.

Thanks.

Quoted 12 lines

r~

Richard Henderson (2):
tcg/mips: Support unaligned access for user-only tcg/mips: Support unaligned access for softmmu

  tcg/mips/tcg-target.h     |   2 -
  tcg/mips/tcg-target.c.inc | 387 +++++++++++++++++++++++++++++++++++---
  2 files changed, 360 insertions(+), 29 deletions(-)