Skip to contentSkip to conversation

[4928] Less hardcoding of TARGET_USER_ONLY.

Qemu-devel Thiemo Seufer 1 participant 1 message Jul 23, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4928

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4928
Author:   ths
Date:     2008-07-23 16:14:22 +0000 (Wed, 23 Jul 2008)

Log Message:
-----------
Less hardcoding of TARGET_USER_ONLY.

Modified Paths:
--------------
trunk/target-mips/cpu.h
trunk/target-mips/helper.c
trunk/target-mips/helper.h
trunk/target-mips/op_helper.c
trunk/target-mips/translate.c
trunk/target-mips/translate_init.c

Modified: trunk/target-mips/cpu.h
===================================================================

target-mips/cpu.h +1 -8
@@ -445,17 +445,12 @@
     uint32_t CP0_TCStatus_rw_bitmask; /* Read/write bits in CP0_TCStatus */
     int insn_flags; /* Supported instruction set */
 
-#ifdef CONFIG_USER_ONLY
-    target_ulong tls_value;
-#endif
+    target_ulong tls_value; /* For usermode emulation */
 
     CPU_COMMON
 
     const mips_def_t *cpu_model;
-#ifndef CONFIG_USER_ONLY
     void *irq[8];
-#endif
-
     struct QEMUTimer *timer; /* Internal timer */
 };
 
@@ -494,7 +489,6 @@
     return env->hflags & MIPS_HFLAG_KSU;
 }
 
-#if defined(CONFIG_USER_ONLY)
 static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
 {
     if (newsp)
@@ -502,7 +496,6 @@
     env->active_tc.gpr[7] = 0;
     env->active_tc.gpr[2] = 0;
 }
-#endif
 
 #include "cpu-all.h"
 

Modified: trunk/target-mips/helper.c
===================================================================

target-mips/helper.c +215 -221

480 lines not on this page · raw message

Modified: trunk/target-mips/helper.h
===================================================================

target-mips/helper.h +4 -2
@@ -41,8 +41,8 @@
 DEF_HELPER(target_ulong, do_msachi, (target_ulong t0, target_ulong t1))
 DEF_HELPER(target_ulong, do_msachiu, (target_ulong t0, target_ulong t1))
 
+#ifndef CONFIG_USER_ONLY
 /* CP0 helpers */
-#ifndef CONFIG_USER_ONLY
 DEF_HELPER(target_ulong, do_mfc0_mvpcontrol, (void))
 DEF_HELPER(target_ulong, do_mfc0_mvpconf0, (void))
 DEF_HELPER(target_ulong, do_mfc0_mvpconf1, (void))
@@ -135,7 +135,6 @@
 DEF_HELPER(void, do_mtc0_datalo, (target_ulong t0))
 DEF_HELPER(void, do_mtc0_taghi, (target_ulong t0))
 DEF_HELPER(void, do_mtc0_datahi, (target_ulong t0))
-#endif /* !CONFIG_USER_ONLY */
 
 /* MIPS MT functions */
 DEF_HELPER(target_ulong, do_mftgpr, (target_ulong t0, uint32_t sel))
@@ -152,6 +151,7 @@
 DEF_HELPER(target_ulong, do_emt, (target_ulong t0))
 DEF_HELPER(target_ulong, do_dvpe, (target_ulong t0))
 DEF_HELPER(target_ulong, do_evpe, (target_ulong t0))
+#endif /* !CONFIG_USER_ONLY */
 DEF_HELPER(void, do_fork, (target_ulong t0, target_ulong t1))
 DEF_HELPER(target_ulong, do_yield, (target_ulong t0))
 
@@ -257,10 +257,12 @@
 #undef FOP_PROTO
 
 /* Special functions */
+#ifndef CONFIG_USER_ONLY
 DEF_HELPER(target_ulong, do_di, (void))
 DEF_HELPER(target_ulong, do_ei, (void))
 DEF_HELPER(void, do_eret, (void))
 DEF_HELPER(void, do_deret, (void))
+#endif /* !CONFIG_USER_ONLY */
 DEF_HELPER(target_ulong, do_rdhwr_cpunum, (void))
 DEF_HELPER(target_ulong, do_rdhwr_synci_step, (void))
 DEF_HELPER(target_ulong, do_rdhwr_cc, (void))

Modified: trunk/target-mips/op_helper.c
===================================================================

target-mips/op_helper.c +2 -93

119 lines not on this page · raw message

Modified: trunk/target-mips/translate.c
===================================================================

target-mips/translate.c +52 -50

152 lines not on this page · raw message

Modified: trunk/target-mips/translate_init.c
===================================================================

target-mips/translate_init.c +12 -15
@@ -439,7 +439,6 @@
     }
 }
 
-#ifndef CONFIG_USER_ONLY
 static void no_mmu_init (CPUMIPSState *env, const mips_def_t *def)
 {
     env->tlb->nb_tlb = 1;
@@ -485,21 +484,20 @@
     env->CP0_Random = env->tlb->nb_tlb - 1;
     env->tlb->tlb_in_use = env->tlb->nb_tlb;
 }
-#endif /* CONFIG_USER_ONLY */
 
 static void fpu_init (CPUMIPSState *env, const mips_def_t *def)
 {
     env->fpu = qemu_mallocz(sizeof(CPUMIPSFPUContext));
 
     env->fpu->fcr0 = def->CP1_fcr0;
-#ifdef CONFIG_USER_ONLY
-    if (env->CP0_Config1 & (1 << CP0C1_FP))
-        env->hflags |= MIPS_HFLAG_FPU;
+    if (env->user_mode_only) {
+        if (env->CP0_Config1 & (1 << CP0C1_FP))
+            env->hflags |= MIPS_HFLAG_FPU;
 #ifdef TARGET_MIPS64
-    if (env->fpu->fcr0 & (1 << FCR0_F64))
-        env->hflags |= MIPS_HFLAG_F64;
+        if (env->fpu->fcr0 & (1 << FCR0_F64))
+            env->hflags |= MIPS_HFLAG_F64;
 #endif
-#endif
+    }
 }
 
 static void mvp_init (CPUMIPSState *env, const mips_def_t *def)
@@ -512,15 +510,15 @@
        implemented, 5 TCs implemented. */
     env->mvp->CP0_MVPConf0 = (1 << CP0MVPC0_M) | (1 << CP0MVPC0_TLBS) |
                              (0 << CP0MVPC0_GS) | (1 << CP0MVPC0_PCP) |
-#ifndef CONFIG_USER_ONLY
-                             /* Usermode has no TLB support */
-                             (env->tlb->nb_tlb << CP0MVPC0_PTLBE) |
-#endif
 // TODO: actually do 2 VPEs.
 //                             (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) |
 //                             (0x04 << CP0MVPC0_PTC);
                              (1 << CP0MVPC0_TCA) | (0x0 << CP0MVPC0_PVPE) |
                              (0x04 << CP0MVPC0_PTC);
+    /* Usermode has no TLB support */
+    if (!env->user_mode_only)
+        env->mvp->CP0_MVPConf0 |= (env->tlb->nb_tlb << CP0MVPC0_PTLBE);
+
     /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,
        no UDI implemented, no CP2 implemented, 1 CP1 implemented. */
     env->mvp->CP0_MVPConf1 = (1 << CP0MVPC1_CIM) | (1 << CP0MVPC1_CIF) |
@@ -568,9 +566,8 @@
     env->CP0_SRSConf4 = def->CP0_SRSConf4;
     env->insn_flags = def->insn_flags;
 
-#ifndef CONFIG_USER_ONLY
-    mmu_init(env, def);
-#endif
+    if (!env->user_mode_only)
+        mmu_init(env, def);
     fpu_init(env, def);
     mvp_init(env, def);
     return 0;