render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0028-target-m68k-switch-to-AREG0-free-mode.patch

5544c1
From 2ace9fd11db103aecebf451aff3bc23838248667 Mon Sep 17 00:00:00 2001
5544c1
From: Blue Swirl <blauwirbel@gmail.com>
5544c1
Date: Sun, 2 Sep 2012 07:27:38 +0000
5544c1
Subject: [PATCH] target-m68k: switch to AREG0 free mode
5544c1
5544c1
Add an explicit CPUState parameter instead of relying on AREG0
5544c1
and switch to AREG0 free mode.
5544c1
5544c1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 configure                 |  2 +-
5544c1
 target-m68k/Makefile.objs |  2 --
5544c1
 target-m68k/helpers.h     |  2 +-
5544c1
 target-m68k/op_helper.c   | 68 +++++++++++++++++-------------------------
5544c1
 target-m68k/translate.c   | 76 ++++++++++++++++++++++++-----------------------
5544c1
 5 files changed, 68 insertions(+), 82 deletions(-)
5544c1
5544c1
diff --git a/configure b/configure
5544c1
index 1e3ea7f..af03942 100755
5544c1
--- a/configure
5544c1
+++ b/configure
5544c1
@@ -3839,7 +3839,7 @@ symlink "$source_path/Makefile.target" "$target_dir/Makefile"
5544c1
 
5544c1
 
5544c1
 case "$target_arch2" in
5544c1
-  alpha | i386 | lm32 | or32 | s390x | sparc* | x86_64 | xtensa* | ppc*)
5544c1
+  alpha | i386 | lm32 | m68k | or32 | s390x | sparc* | x86_64 | xtensa* | ppc*)
5544c1
     echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
5544c1
   ;;
5544c1
 esac
5544c1
diff --git a/target-m68k/Makefile.objs b/target-m68k/Makefile.objs
5544c1
index cda6015..7eccfab 100644
5544c1
--- a/target-m68k/Makefile.objs
5544c1
+++ b/target-m68k/Makefile.objs
5544c1
@@ -1,5 +1,3 @@
5544c1
 obj-y += m68k-semi.o
5544c1
 obj-y += translate.o op_helper.o helper.o cpu.o
5544c1
 obj-$(CONFIG_SOFTMMU) += machine.o
5544c1
-
5544c1
-$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
5544c1
diff --git a/target-m68k/helpers.h b/target-m68k/helpers.h
5544c1
index cb8a0c7..8112b44 100644
5544c1
--- a/target-m68k/helpers.h
5544c1
+++ b/target-m68k/helpers.h
5544c1
@@ -49,6 +49,6 @@ DEF_HELPER_3(set_mac_exts, void, env, i32, i32)
5544c1
 DEF_HELPER_3(set_mac_extu, void, env, i32, i32)
5544c1
 
5544c1
 DEF_HELPER_2(flush_flags, void, env, i32)
5544c1
-DEF_HELPER_1(raise_exception, void, i32)
5544c1
+DEF_HELPER_2(raise_exception, void, env, i32)
5544c1
 
5544c1
 #include "def-helper.h"
5544c1
diff --git a/target-m68k/op_helper.c b/target-m68k/op_helper.c
5544c1
index 1971a57..3116287 100644
5544c1
--- a/target-m68k/op_helper.c
5544c1
+++ b/target-m68k/op_helper.c
5544c1
@@ -17,17 +17,16 @@
5544c1
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
5544c1
  */
5544c1
 #include "cpu.h"
5544c1
-#include "dyngen-exec.h"
5544c1
 #include "helpers.h"
5544c1
 
5544c1
 #if defined(CONFIG_USER_ONLY)
5544c1
 
5544c1
-void do_interrupt(CPUM68KState *env1)
5544c1
+void do_interrupt(CPUM68KState *env)
5544c1
 {
5544c1
-    env1->exception_index = -1;
5544c1
+    env->exception_index = -1;
5544c1
 }
5544c1
 
5544c1
-void do_interrupt_m68k_hardirq(CPUM68KState *env1)
5544c1
+void do_interrupt_m68k_hardirq(CPUM68KState *env)
5544c1
 {
5544c1
 }
5544c1
 
5544c1
@@ -54,16 +53,12 @@ extern int semihosting_enabled;
5544c1
 /* Try to fill the TLB and return an exception if error. If retaddr is
5544c1
    NULL, it means that the function was called in C code (i.e. not
5544c1
    from generated code or from helper.c) */
5544c1
-/* XXX: fix it to restore all registers */
5544c1
-void tlb_fill(CPUM68KState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
+void tlb_fill(CPUM68KState *env, target_ulong addr, int is_write, int mmu_idx,
5544c1
               uintptr_t retaddr)
5544c1
 {
5544c1
     TranslationBlock *tb;
5544c1
-    CPUM68KState *saved_env;
5544c1
     int ret;
5544c1
 
5544c1
-    saved_env = env;
5544c1
-    env = env1;
5544c1
     ret = cpu_m68k_handle_mmu_fault(env, addr, is_write, mmu_idx);
5544c1
     if (unlikely(ret)) {
5544c1
         if (retaddr) {
5544c1
@@ -77,24 +72,23 @@ void tlb_fill(CPUM68KState *env1, target_ulong addr, int is_write, int mmu_idx,
5544c1
         }
5544c1
         cpu_loop_exit(env);
5544c1
     }
5544c1
-    env = saved_env;
5544c1
 }
5544c1
 
5544c1
-static void do_rte(void)
5544c1
+static void do_rte(CPUM68KState *env)
5544c1
 {
5544c1
     uint32_t sp;
5544c1
     uint32_t fmt;
5544c1
 
5544c1
     sp = env->aregs[7];
5544c1
-    fmt = ldl_kernel(sp);
5544c1
-    env->pc = ldl_kernel(sp + 4);
5544c1
+    fmt = cpu_ldl_kernel(env, sp);
5544c1
+    env->pc = cpu_ldl_kernel(env, sp + 4);
5544c1
     sp |= (fmt >> 28) & 3;
5544c1
     env->sr = fmt & 0xffff;
5544c1
     m68k_switch_sp(env);
5544c1
     env->aregs[7] = sp + 8;
5544c1
 }
5544c1
 
5544c1
-static void do_interrupt_all(int is_hw)
5544c1
+static void do_interrupt_all(CPUM68KState *env, int is_hw)
5544c1
 {
5544c1
     uint32_t sp;
5544c1
     uint32_t fmt;
5544c1
@@ -108,14 +102,14 @@ static void do_interrupt_all(int is_hw)
5544c1
         switch (env->exception_index) {
5544c1
         case EXCP_RTE:
5544c1
             /* Return from an exception.  */
5544c1
-            do_rte();
5544c1
+            do_rte(env);
5544c1
             return;
5544c1
         case EXCP_HALT_INSN:
5544c1
             if (semihosting_enabled
5544c1
                     && (env->sr & SR_S) != 0
5544c1
                     && (env->pc & 3) == 0
5544c1
-                    && lduw_code(env->pc - 4) == 0x4e71
5544c1
-                    && ldl_code(env->pc) == 0x4e7bf000) {
5544c1
+                    && cpu_lduw_code(env, env->pc - 4) == 0x4e71
5544c1
+                    && cpu_ldl_code(env, env->pc) == 0x4e7bf000) {
5544c1
                 env->pc += 4;
5544c1
                 do_m68k_semihosting(env, env->dregs[0]);
5544c1
                 return;
5544c1
@@ -151,44 +145,34 @@ static void do_interrupt_all(int is_hw)
5544c1
     /* ??? This could cause MMU faults.  */
5544c1
     sp &= ~3;
5544c1
     sp -= 4;
5544c1
-    stl_kernel(sp, retaddr);
5544c1
+    cpu_stl_kernel(env, sp, retaddr);
5544c1
     sp -= 4;
5544c1
-    stl_kernel(sp, fmt);
5544c1
+    cpu_stl_kernel(env, sp, fmt);
5544c1
     env->aregs[7] = sp;
5544c1
     /* Jump to vector.  */
5544c1
-    env->pc = ldl_kernel(env->vbr + vector);
5544c1
+    env->pc = cpu_ldl_kernel(env, env->vbr + vector);
5544c1
 }
5544c1
 
5544c1
-void do_interrupt(CPUM68KState *env1)
5544c1
+void do_interrupt(CPUM68KState *env)
5544c1
 {
5544c1
-    CPUM68KState *saved_env;
5544c1
-
5544c1
-    saved_env = env;
5544c1
-    env = env1;
5544c1
-    do_interrupt_all(0);
5544c1
-    env = saved_env;
5544c1
+    do_interrupt_all(env, 0);
5544c1
 }
5544c1
 
5544c1
-void do_interrupt_m68k_hardirq(CPUM68KState *env1)
5544c1
+void do_interrupt_m68k_hardirq(CPUM68KState *env)
5544c1
 {
5544c1
-    CPUM68KState *saved_env;
5544c1
-
5544c1
-    saved_env = env;
5544c1
-    env = env1;
5544c1
-    do_interrupt_all(1);
5544c1
-    env = saved_env;
5544c1
+    do_interrupt_all(env, 1);
5544c1
 }
5544c1
 #endif
5544c1
 
5544c1
-static void raise_exception(int tt)
5544c1
+static void raise_exception(CPUM68KState *env, int tt)
5544c1
 {
5544c1
     env->exception_index = tt;
5544c1
     cpu_loop_exit(env);
5544c1
 }
5544c1
 
5544c1
-void HELPER(raise_exception)(uint32_t tt)
5544c1
+void HELPER(raise_exception)(CPUM68KState *env, uint32_t tt)
5544c1
 {
5544c1
-    raise_exception(tt);
5544c1
+    raise_exception(env, tt);
5544c1
 }
5544c1
 
5544c1
 void HELPER(divu)(CPUM68KState *env, uint32_t word)
5544c1
@@ -202,8 +186,9 @@ void HELPER(divu)(CPUM68KState *env, uint32_t word)
5544c1
     num = env->div1;
5544c1
     den = env->div2;
5544c1
     /* ??? This needs to make sure the throwing location is accurate.  */
5544c1
-    if (den == 0)
5544c1
-        raise_exception(EXCP_DIV0);
5544c1
+    if (den == 0) {
5544c1
+        raise_exception(env, EXCP_DIV0);
5544c1
+    }
5544c1
     quot = num / den;
5544c1
     rem = num % den;
5544c1
     flags = 0;
5544c1
@@ -231,8 +216,9 @@ void HELPER(divs)(CPUM68KState *env, uint32_t word)
5544c1
 
5544c1
     num = env->div1;
5544c1
     den = env->div2;
5544c1
-    if (den == 0)
5544c1
-        raise_exception(EXCP_DIV0);
5544c1
+    if (den == 0) {
5544c1
+        raise_exception(env, EXCP_DIV0);
5544c1
+    }
5544c1
     quot = num / den;
5544c1
     rem = num % den;
5544c1
     flags = 0;
5544c1
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
5544c1
index 9fc1e31..10bb303 100644
5544c1
--- a/target-m68k/translate.c
5544c1
+++ b/target-m68k/translate.c
5544c1
@@ -260,9 +260,9 @@ static TCGv gen_ldst(DisasContext *s, int opsize, TCGv addr, TCGv val,
5544c1
 static inline uint32_t read_im32(DisasContext *s)
5544c1
 {
5544c1
     uint32_t im;
5544c1
-    im = ((uint32_t)lduw_code(s->pc)) << 16;
5544c1
+    im = ((uint32_t)cpu_lduw_code(cpu_single_env, s->pc)) << 16;
5544c1
     s->pc += 2;
5544c1
-    im |= lduw_code(s->pc);
5544c1
+    im |= cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     return im;
5544c1
 }
5544c1
@@ -297,7 +297,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)
5544c1
     uint32_t bd, od;
5544c1
 
5544c1
     offset = s->pc;
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     if ((ext & 0x800) == 0 && !m68k_feature(s->env, M68K_FEATURE_WORD_INDEX))
5544c1
@@ -311,7 +311,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)
5544c1
         if ((ext & 0x30) > 0x10) {
5544c1
             /* base displacement */
5544c1
             if ((ext & 0x30) == 0x20) {
5544c1
-                bd = (int16_t)lduw_code(s->pc);
5544c1
+                bd = (int16_t)cpu_lduw_code(cpu_single_env, s->pc);
5544c1
                 s->pc += 2;
5544c1
             } else {
5544c1
                 bd = read_im32(s);
5544c1
@@ -360,7 +360,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base)
5544c1
             if ((ext & 3) > 1) {
5544c1
                 /* outer displacement */
5544c1
                 if ((ext & 3) == 2) {
5544c1
-                    od = (int16_t)lduw_code(s->pc);
5544c1
+                    od = (int16_t)cpu_lduw_code(cpu_single_env, s->pc);
5544c1
                     s->pc += 2;
5544c1
                 } else {
5544c1
                     od = read_im32(s);
5544c1
@@ -514,7 +514,7 @@ static TCGv gen_lea(DisasContext *s, uint16_t insn, int opsize)
5544c1
     case 5: /* Indirect displacement.  */
5544c1
         reg = AREG(insn, 0);
5544c1
         tmp = tcg_temp_new();
5544c1
-        ext = lduw_code(s->pc);
5544c1
+        ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
         s->pc += 2;
5544c1
         tcg_gen_addi_i32(tmp, reg, (int16_t)ext);
5544c1
         return tmp;
5544c1
@@ -524,7 +524,7 @@ static TCGv gen_lea(DisasContext *s, uint16_t insn, int opsize)
5544c1
     case 7: /* Other */
5544c1
         switch (insn & 7) {
5544c1
         case 0: /* Absolute short.  */
5544c1
-            offset = ldsw_code(s->pc);
5544c1
+            offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
             s->pc += 2;
5544c1
             return tcg_const_i32(offset);
5544c1
         case 1: /* Absolute long.  */
5544c1
@@ -532,7 +532,7 @@ static TCGv gen_lea(DisasContext *s, uint16_t insn, int opsize)
5544c1
             return tcg_const_i32(offset);
5544c1
         case 2: /* pc displacement  */
5544c1
             offset = s->pc;
5544c1
-            offset += ldsw_code(s->pc);
5544c1
+            offset += cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
             s->pc += 2;
5544c1
             return tcg_const_i32(offset);
5544c1
         case 3: /* pc index+displacement.  */
5544c1
@@ -638,17 +638,19 @@ static TCGv gen_ea(DisasContext *s, uint16_t insn, int opsize, TCGv val,
5544c1
             /* Sign extend values for consistency.  */
5544c1
             switch (opsize) {
5544c1
             case OS_BYTE:
5544c1
-                if (what == EA_LOADS)
5544c1
-                    offset = ldsb_code(s->pc + 1);
5544c1
-                else
5544c1
-                    offset = ldub_code(s->pc + 1);
5544c1
+                if (what == EA_LOADS) {
5544c1
+                    offset = cpu_ldsb_code(cpu_single_env, s->pc + 1);
5544c1
+                } else {
5544c1
+                    offset = cpu_ldub_code(cpu_single_env, s->pc + 1);
5544c1
+                }
5544c1
                 s->pc += 2;
5544c1
                 break;
5544c1
             case OS_WORD:
5544c1
-                if (what == EA_LOADS)
5544c1
-                    offset = ldsw_code(s->pc);
5544c1
-                else
5544c1
-                    offset = lduw_code(s->pc);
5544c1
+                if (what == EA_LOADS) {
5544c1
+                    offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
+                } else {
5544c1
+                    offset = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
+                }
5544c1
                 s->pc += 2;
5544c1
                 break;
5544c1
             case OS_LONG:
5544c1
@@ -815,7 +817,7 @@ static void gen_exception(DisasContext *s, uint32_t where, int nr)
5544c1
 {
5544c1
     gen_flush_cc_op(s);
5544c1
     gen_jmp_im(s, where);
5544c1
-    gen_helper_raise_exception(tcg_const_i32(nr));
5544c1
+    gen_helper_raise_exception(cpu_env, tcg_const_i32(nr));
5544c1
 }
5544c1
 
5544c1
 static inline void gen_addr_fault(DisasContext *s)
5544c1
@@ -934,7 +936,7 @@ DISAS_INSN(divl)
5544c1
     TCGv reg;
5544c1
     uint16_t ext;
5544c1
 
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (ext & 0x87f8) {
5544c1
         gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);
5544c1
@@ -1086,7 +1088,7 @@ DISAS_INSN(movem)
5544c1
     TCGv tmp;
5544c1
     int is_load;
5544c1
 
5544c1
-    mask = lduw_code(s->pc);
5544c1
+    mask = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     tmp = gen_lea(s, insn, OS_LONG);
5544c1
     if (IS_NULL_QREG(tmp)) {
5544c1
@@ -1130,7 +1132,7 @@ DISAS_INSN(bitop_im)
5544c1
         opsize = OS_LONG;
5544c1
     op = (insn >> 6) & 3;
5544c1
 
5544c1
-    bitnum = lduw_code(s->pc);
5544c1
+    bitnum = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (bitnum & 0xff00) {
5544c1
         disas_undef(s, insn);
5544c1
@@ -1383,7 +1385,7 @@ static void gen_set_sr(DisasContext *s, uint16_t insn, int ccr_only)
5544c1
     else if ((insn & 0x3f) == 0x3c)
5544c1
       {
5544c1
         uint16_t val;
5544c1
-        val = lduw_code(s->pc);
5544c1
+        val = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
         s->pc += 2;
5544c1
         gen_set_sr_im(s, val, ccr_only);
5544c1
       }
5544c1
@@ -1507,7 +1509,7 @@ DISAS_INSN(mull)
5544c1
 
5544c1
     /* The upper 32 bits of the product are discarded, so
5544c1
        muls.l and mulu.l are functionally equivalent.  */
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (ext & 0x87ff) {
5544c1
         gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);
5544c1
@@ -1528,7 +1530,7 @@ DISAS_INSN(link)
5544c1
     TCGv reg;
5544c1
     TCGv tmp;
5544c1
 
5544c1
-    offset = ldsw_code(s->pc);
5544c1
+    offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     reg = AREG(insn, 0);
5544c1
     tmp = tcg_temp_new();
5544c1
@@ -1649,7 +1651,7 @@ DISAS_INSN(branch)
5544c1
     op = (insn >> 8) & 0xf;
5544c1
     offset = (int8_t)insn;
5544c1
     if (offset == 0) {
5544c1
-        offset = ldsw_code(s->pc);
5544c1
+        offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
         s->pc += 2;
5544c1
     } else if (offset == -1) {
5544c1
         offset = read_im32(s);
5544c1
@@ -1934,13 +1936,13 @@ DISAS_INSN(strldsr)
5544c1
     uint32_t addr;
5544c1
 
5544c1
     addr = s->pc - 2;
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (ext != 0x46FC) {
5544c1
         gen_exception(s, addr, EXCP_UNSUPPORTED);
5544c1
         return;
5544c1
     }
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (IS_USER(s) || (ext & SR_S) == 0) {
5544c1
         gen_exception(s, addr, EXCP_PRIVILEGE);
5544c1
@@ -2008,7 +2010,7 @@ DISAS_INSN(stop)
5544c1
         return;
5544c1
     }
5544c1
 
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     gen_set_sr_im(s, ext, 0);
5544c1
@@ -2035,7 +2037,7 @@ DISAS_INSN(movec)
5544c1
         return;
5544c1
     }
5544c1
 
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     if (ext & 0x8000) {
5544c1
@@ -2100,7 +2102,7 @@ DISAS_INSN(fpu)
5544c1
     int set_dest;
5544c1
     int opsize;
5544c1
 
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     opmode = ext & 0x7f;
5544c1
     switch ((ext >> 13) & 7) {
5544c1
@@ -2136,7 +2138,7 @@ DISAS_INSN(fpu)
5544c1
                 tcg_gen_addi_i32(tmp32, tmp32, -8);
5544c1
                 break;
5544c1
             case 5:
5544c1
-                offset = ldsw_code(s->pc);
5544c1
+                offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
                 s->pc += 2;
5544c1
                 tcg_gen_addi_i32(tmp32, tmp32, offset);
5544c1
                 break;
5544c1
@@ -2250,12 +2252,12 @@ DISAS_INSN(fpu)
5544c1
                 tcg_gen_addi_i32(tmp32, tmp32, -8);
5544c1
                 break;
5544c1
             case 5:
5544c1
-                offset = ldsw_code(s->pc);
5544c1
+                offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
                 s->pc += 2;
5544c1
                 tcg_gen_addi_i32(tmp32, tmp32, offset);
5544c1
                 break;
5544c1
             case 7:
5544c1
-                offset = ldsw_code(s->pc);
5544c1
+                offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
                 offset += s->pc - 2;
5544c1
                 s->pc += 2;
5544c1
                 tcg_gen_addi_i32(tmp32, tmp32, offset);
5544c1
@@ -2381,10 +2383,10 @@ DISAS_INSN(fbcc)
5544c1
     int l1;
5544c1
 
5544c1
     addr = s->pc;
5544c1
-    offset = ldsw_code(s->pc);
5544c1
+    offset = cpu_ldsw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
     if (insn & (1 << 6)) {
5544c1
-        offset = (offset << 16) | lduw_code(s->pc);
5544c1
+        offset = (offset << 16) | cpu_lduw_code(cpu_single_env, s->pc);
5544c1
         s->pc += 2;
5544c1
     }
5544c1
 
5544c1
@@ -2506,7 +2508,7 @@ DISAS_INSN(mac)
5544c1
         s->done_mac = 1;
5544c1
     }
5544c1
 
5544c1
-    ext = lduw_code(s->pc);
5544c1
+    ext = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     acc = ((insn >> 7) & 1) | ((ext >> 3) & 2);
5544c1
@@ -2941,7 +2943,7 @@ static void disas_m68k_insn(CPUM68KState * env, DisasContext *s)
5544c1
 {
5544c1
     uint16_t insn;
5544c1
 
5544c1
-    insn = lduw_code(s->pc);
5544c1
+    insn = cpu_lduw_code(cpu_single_env, s->pc);
5544c1
     s->pc += 2;
5544c1
 
5544c1
     opcode_table[insn](s, insn);
5544c1
@@ -3028,7 +3030,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
5544c1
             gen_flush_cc_op(dc);
5544c1
             tcg_gen_movi_i32(QREG_PC, dc->pc);
5544c1
         }
5544c1
-        gen_helper_raise_exception(tcg_const_i32(EXCP_DEBUG));
5544c1
+        gen_helper_raise_exception(cpu_env, tcg_const_i32(EXCP_DEBUG));
5544c1
     } else {
5544c1
         switch(dc->is_jmp) {
5544c1
         case DISAS_NEXT:
5544c1
-- 
5544c1
1.7.12.1
5544c1