diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-10-04 21:23:09 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-10-04 21:23:09 +0000 |
commit | 8d5f07fa3bd3433e779d13eb1cda4fbb07acb67f (patch) | |
tree | 05ba111ca75cbc1f5080dd4745659cb11cb7d5a5 /target-sparc | |
parent | 023fcb9507b0d98d8dc98ffaa407e66d84bb6ea4 (diff) | |
download | hqemu-8d5f07fa3bd3433e779d13eb1cda4fbb07acb67f.zip hqemu-8d5f07fa3bd3433e779d13eb1cda4fbb07acb67f.tar.gz |
sparc merge (Blue Swirl)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1098 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sparc')
-rw-r--r-- | target-sparc/cpu.h | 1 | ||||
-rw-r--r-- | target-sparc/exec.h | 5 | ||||
-rw-r--r-- | target-sparc/helper.c | 22 | ||||
-rw-r--r-- | target-sparc/op.c | 96 | ||||
-rw-r--r-- | target-sparc/op_helper.c | 23 | ||||
-rw-r--r-- | target-sparc/op_mem.h | 4 |
6 files changed, 37 insertions, 114 deletions
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 4c23b92..03698df 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -76,6 +76,7 @@ #define PTE_ENTRYTYPE_MASK 3 #define PTE_ACCESS_MASK 0x1c #define PTE_ACCESS_SHIFT 2 +#define PTE_PPN_SHIFT 7 #define PTE_ADDR_MASK 0xffffff00 #define PG_ACCESSED_BIT 5 diff --git a/target-sparc/exec.h b/target-sparc/exec.h index f9fcf53..cea9616 100644 --- a/target-sparc/exec.h +++ b/target-sparc/exec.h @@ -23,13 +23,16 @@ void helper_flush(target_ulong addr); void helper_ld_asi(int asi, int size, int sign); void helper_st_asi(int asi, int size, int sign); void helper_rett(void); -void helper_stfsr(void); +void helper_ldfsr(void); void set_cwp(int new_cwp); void do_fabss(void); void do_fsqrts(void); void do_fsqrtd(void); void do_fcmps(void); void do_fcmpd(void); +void do_ldd_kernel(uint32_t addr); +void do_ldd_user(uint32_t addr); +void do_ldd_raw(uint32_t addr); void do_interrupt(int intno, int is_int, int error_code, unsigned int next_eip, int is_hw); void raise_exception_err(int exception_index, int error_code); diff --git a/target-sparc/helper.c b/target-sparc/helper.c index ae70595..63d08e7 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -21,19 +21,10 @@ #define DEBUG_PCALL -#if 0 -#define raise_exception_err(a, b)\ -do {\ - fprintf(logfile, "raise_exception line=%d\n", __LINE__);\ - (raise_exception_err)(a, b);\ -} while (0) -#endif - /* Sparc MMU emulation */ int cpu_sparc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, int is_user, int is_softmmu); - /* thread support */ spinlock_t global_cpu_lock = SPIN_LOCK_UNLOCKED; @@ -48,15 +39,6 @@ void cpu_unlock(void) spin_unlock(&global_cpu_lock); } -#if 0 -void cpu_loop_exit(void) -{ - /* NOTE: the register at this point must be saved by hand because - longjmp restore them */ - longjmp(env->jmp_env, 1); -} -#endif - #if !defined(CONFIG_USER_ONLY) #define MMUSUFFIX _mmu @@ -258,7 +240,7 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, env->mmuregs[3] |= (access_index << 5) | (error_code << 2) | 2; env->mmuregs[4] = address; /* Fault address register */ - if (env->mmuregs[0] & MMU_NF) // No fault + if (env->mmuregs[0] & MMU_NF || env->psret == 0) // No fault return 0; env->exception_index = exception; @@ -306,7 +288,7 @@ void do_interrupt(int intno, int is_int, int error_code, fprintf(logfile, "%6d: v=%02x e=%04x i=%d pc=%08x npc=%08x SP=%08x\n", count, intno, error_code, is_int, env->pc, - env->npc, env->gregs[7]); + env->npc, env->regwptr[6]); #if 0 cpu_sparc_dump_state(env, logfile, 0); { diff --git a/target-sparc/op.c b/target-sparc/op.c index a2d3746..042fd61 100644 --- a/target-sparc/op.c +++ b/target-sparc/op.c @@ -474,92 +474,6 @@ void OPPROTO op_sra(void) T0 = ((int32_t) T0) >> T1; } -#if 0 -void OPPROTO op_st(void) -{ - stl((void *) T0, T1); -} - -void OPPROTO op_stb(void) -{ - stb((void *) T0, T1); -} - -void OPPROTO op_sth(void) -{ - stw((void *) T0, T1); -} - -void OPPROTO op_std(void) -{ - stl((void *) T0, T1); - stl((void *) (T0 + 4), T2); -} - -void OPPROTO op_ld(void) -{ - T1 = ldl((void *) T0); -} - -void OPPROTO op_ldub(void) -{ - T1 = ldub((void *) T0); -} - -void OPPROTO op_lduh(void) -{ - T1 = lduw((void *) T0); -} - -void OPPROTO op_ldsb(void) -{ - T1 = ldsb((void *) T0); -} - -void OPPROTO op_ldsh(void) -{ - T1 = ldsw((void *) T0); -} - -void OPPROTO op_ldstub(void) -{ - T1 = ldub((void *) T0); - stb((void *) T0, 0xff); /* XXX: Should be Atomically */ -} - -void OPPROTO op_swap(void) -{ - unsigned int tmp = ldl((void *) T0); - stl((void *) T0, T1); /* XXX: Should be Atomically */ - T1 = tmp; -} - -void OPPROTO op_ldd(void) -{ - T1 = ldl((void *) T0); - T0 = ldl((void *) (T0 + 4)); -} - -void OPPROTO op_stf(void) -{ - stfl((void *) T0, FT0); -} - -void OPPROTO op_stdf(void) -{ - stfq((void *) T0, DT0); -} - -void OPPROTO op_ldf(void) -{ - FT0 = ldfl((void *) T0); -} - -void OPPROTO op_lddf(void) -{ - DT0 = ldfq((void *) T0); -} -#else /* Load and store */ #define MEMSUFFIX _raw #include "op_mem.h" @@ -570,19 +484,16 @@ void OPPROTO op_lddf(void) #define MEMSUFFIX _kernel #include "op_mem.h" #endif -#endif void OPPROTO op_ldfsr(void) { env->fsr = *((uint32_t *) &FT0); - FORCE_RET(); + helper_ldfsr(); } void OPPROTO op_stfsr(void) { *((uint32_t *) &FT0) = env->fsr; - helper_stfsr(); - FORCE_RET(); } void OPPROTO op_wry(void) @@ -609,16 +520,17 @@ void OPPROTO op_wrwim(void) void OPPROTO op_rdpsr(void) { T0 = GET_PSR(env); - FORCE_RET(); } void OPPROTO op_wrpsr(void) { + int cwp; env->psr = T0 & ~PSR_ICC; env->psrs = (T0 & PSR_S)? 1 : 0; env->psrps = (T0 & PSR_PS)? 1 : 0; env->psret = (T0 & PSR_ET)? 1 : 0; - env->cwp = (T0 & PSR_CWP); + cwp = (T0 & PSR_CWP) & (NWINDOWS - 1); + set_cwp(cwp); FORCE_RET(); } diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c index 253bcff..909639a 100644 --- a/target-sparc/op_helper.c +++ b/target-sparc/op_helper.c @@ -104,6 +104,27 @@ void OPPROTO helper_st_asi(int asi, int size, int sign) } } +#if 0 +void do_ldd_raw(uint32_t addr) +{ + T1 = ldl_raw((void *) addr); + T0 = ldl_raw((void *) (addr + 4)); +} + +#if !defined(CONFIG_USER_ONLY) +void do_ldd_user(uint32_t addr) +{ + T1 = ldl_user((void *) addr); + T0 = ldl_user((void *) (addr + 4)); +} +void do_ldd_kernel(uint32_t addr) +{ + T1 = ldl_kernel((void *) addr); + T0 = ldl_kernel((void *) (addr + 4)); +} +#endif +#endif + void OPPROTO helper_rett() { int cwp; @@ -116,7 +137,7 @@ void OPPROTO helper_rett() env->psrs = env->psrps; } -void helper_stfsr(void) +void helper_ldfsr(void) { switch (env->fsr & FSR_RD_MASK) { case FSR_RD_NEAREST: diff --git a/target-sparc/op_mem.h b/target-sparc/op_mem.h index 9c839a0..2ae74f2 100644 --- a/target-sparc/op_mem.h +++ b/target-sparc/op_mem.h @@ -43,8 +43,12 @@ void OPPROTO glue(op_swap, MEMSUFFIX)(void) void OPPROTO glue(op_ldd, MEMSUFFIX)(void) { +#if 1 T1 = glue(ldl, MEMSUFFIX)((void *) T0); T0 = glue(ldl, MEMSUFFIX)((void *) (T0 + 4)); +#else + glue(do_ldd, MEMSUFFIX)(T0); +#endif } /*** Floating-point store ***/ |