Skip to contentSkip to conversation

[5109] Fix Sparc64 boot on i386 host:

Qemu-devel Blue Swirl 1 participant 1 message Aug 29, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 5109

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5109
Author:   blueswir1
Date:     2008-08-29 20:50:21 +0000 (Fri, 29 Aug 2008)

Log Message:
-----------
Fix Sparc64 boot on i386 host:
- move do_interrupt() back to op_helper.c
- move non-helper prototypes from helper.h to exec.h
- move some prototypes from cpu.h to exec.h
- do not export either set_cwp() or cpu_set_cwp() from op_helper.c, but instead provide inline functions

Modified Paths:
--------------
trunk/target-sparc/cpu.h
trunk/target-sparc/exec.h
trunk/target-sparc/helper.c
trunk/target-sparc/helper.h
trunk/target-sparc/op_helper.c

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

target-sparc/cpu.h +32 -6
@@ -337,13 +337,18 @@
     } while (0)
 #endif
 
+/* helper.c */
 CPUSPARCState *cpu_sparc_init(const char *cpu_model);
-void gen_intermediate_code_init(CPUSPARCState *env);
-int cpu_sparc_exec(CPUSPARCState *s);
+void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu);
 void sparc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt,
                                                  ...));
-void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu);
 
+/* translate.c */
+void gen_intermediate_code_init(CPUSPARCState *env);
+
+/* cpu-exec.c */
+int cpu_sparc_exec(CPUSPARCState *s);
+
 #define GET_PSR(env) (env->version | (env->psr & PSR_ICC) |             \
                       (env->psref? PSR_EF : 0) |                        \
                       (env->psrpil << 8) |                              \
@@ -352,8 +357,30 @@
                       (env->psret? PSR_ET : 0) | env->cwp)
 
 #ifndef NO_CPU_IO_DEFS
-void cpu_set_cwp(CPUSPARCState *env1, int new_cwp);
+static inline void memcpy32(target_ulong *dst, const target_ulong *src)
+{
+    dst[0] = src[0];
+    dst[1] = src[1];
+    dst[2] = src[2];
+    dst[3] = src[3];
+    dst[4] = src[4];
+    dst[5] = src[5];
+    dst[6] = src[6];
+    dst[7] = src[7];
+}
 
+static inline void cpu_set_cwp(CPUSPARCState *env1, int new_cwp)
+{
+    /* put the modified wrap registers at their proper location */
+    if (env1->cwp == env1->nwindows - 1)
+        memcpy32(env1->regbase, env1->regbase + env1->nwindows * 16);
+    env1->cwp = new_cwp;
+    /* put the wrap registers at their temporary location */
+    if (new_cwp == env1->nwindows - 1)
+        memcpy32(env1->regbase + env1->nwindows * 16, env1->regbase);
+    env1->regwptr = env1->regbase + (new_cwp * 16);
+}
+
 static inline int cpu_cwp_inc(CPUSPARCState *env1, int cwp)
 {
     if (unlikely(cwp >= env1->nwindows))
@@ -397,10 +424,9 @@
 #endif
 #endif
 
-int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
+/* cpu-exec.c */
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
                           int is_asi);
-void cpu_check_irqs(CPUSPARCState *env);
 
 #define CPUState CPUSPARCState
 #define cpu_init cpu_sparc_init

Modified: trunk/target-sparc/exec.h
===================================================================

target-sparc/exec.h +15 -0
@@ -23,10 +23,25 @@
 {
 }
 
+/* helper.c */
+void cpu_lock(void);
+void cpu_unlock(void);
 int cpu_sparc_handle_mmu_fault(CPUState *env1, target_ulong address, int rw,
                                int mmu_idx, int is_softmmu);
+target_ulong mmu_probe(CPUState *env, target_ulong address, int mmulev);
+void dump_mmu(CPUState *env);
+void memcpy32(target_ulong *dst, const target_ulong *src);
+
+/* op_helper.c */
 void do_interrupt(CPUState *env);
 
+/* cpu-exec.c */
+void cpu_loop_exit(void);
+int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
+
+/* sun4m.c */
+void cpu_check_irqs(CPUSPARCState *env);
+
 static inline int cpu_halted(CPUState *env1) {
     if (!env1->halted)
         return 0;

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

target-sparc/helper.c +0 -242

254 lines not on this page · raw message

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

target-sparc/helper.h +0 -9
@@ -179,12 +179,3 @@
 #undef F_HELPER_SDQ_0_0
 #undef VIS_HELPER
 #undef VIS_CMPHELPER
-
-void cpu_lock(void);
-void cpu_unlock(void);
-void cpu_loop_exit(void);
-void set_cwp(int new_cwp);
-void change_pstate(uint64_t new_pstate);
-void memcpy32(target_ulong *dst, const target_ulong *src);
-target_ulong mmu_probe(CPUState *env, target_ulong address, int mmulev);
-void dump_mmu(CPUState *env);

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

target-sparc/op_helper.c +232 -15

273 lines not on this page · raw message