diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-02-12 21:01:26 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-02-12 21:01:26 +0000 |
commit | d0dc7dc3274a88db1c9941614454ed842d62cf91 (patch) | |
tree | 46e369f2d52daecef62ef93665fdc6dbb21c3b82 /linux-user | |
parent | 577d8dd43779f6ae75cb1b49606443ddab870bda (diff) |
Make MIPS MT implementation more cache friendly.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3981 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/main.c | 22 | ||||
-rw-r--r-- | linux-user/mips/target_signal.h | 2 | ||||
-rw-r--r-- | linux-user/mips64/target_signal.h | 2 | ||||
-rw-r--r-- | linux-user/mipsn32/target_signal.h | 2 | ||||
-rw-r--r-- | linux-user/signal.c | 28 | ||||
-rw-r--r-- | linux-user/syscall.c | 6 |
6 files changed, 31 insertions, 31 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index 164fdb9edb..124b98ca02 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1522,7 +1522,7 @@ void cpu_loop(CPUMIPSState *env) trapnr = cpu_mips_exec(env); switch(trapnr) { case EXCP_SYSCALL: - syscall_num = env->gpr[2][env->current_tc] - 4000; + syscall_num = env->gpr[env->current_tc][2] - 4000; env->PC[env->current_tc] += 4; if (syscall_num >= sizeof(mips_syscall_args)) { ret = -ENOSYS; @@ -1532,7 +1532,7 @@ void cpu_loop(CPUMIPSState *env) abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0; nb_args = mips_syscall_args[syscall_num]; - sp_reg = env->gpr[29][env->current_tc]; + sp_reg = env->gpr[env->current_tc][29]; switch (nb_args) { /* these arguments are taken from the stack */ /* FIXME - what to do if get_user() fails? */ @@ -1543,20 +1543,20 @@ void cpu_loop(CPUMIPSState *env) default: break; } - ret = do_syscall(env, env->gpr[2][env->current_tc], - env->gpr[4][env->current_tc], - env->gpr[5][env->current_tc], - env->gpr[6][env->current_tc], - env->gpr[7][env->current_tc], + ret = do_syscall(env, env->gpr[env->current_tc][2], + env->gpr[env->current_tc][4], + env->gpr[env->current_tc][5], + env->gpr[env->current_tc][6], + env->gpr[env->current_tc][7], arg5, arg6/*, arg7, arg8*/); } if ((unsigned int)ret >= (unsigned int)(-1133)) { - env->gpr[7][env->current_tc] = 1; /* error flag */ + env->gpr[env->current_tc][7] = 1; /* error flag */ ret = -ret; } else { - env->gpr[7][env->current_tc] = 0; /* error flag */ + env->gpr[env->current_tc][7] = 0; /* error flag */ } - env->gpr[2][env->current_tc] = ret; + env->gpr[env->current_tc][2] = ret; break; case EXCP_TLBL: case EXCP_TLBS: @@ -2296,7 +2296,7 @@ int main(int argc, char **argv) int i; for(i = 0; i < 32; i++) { - env->gpr[i][env->current_tc] = regs->regs[i]; + env->gpr[env->current_tc][i] = regs->regs[i]; } env->PC[env->current_tc] = regs->cp0_epc; } diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h index 3b06e9824c..f3ef38d246 100644 --- a/linux-user/mips/target_signal.h +++ b/linux-user/mips/target_signal.h @@ -23,7 +23,7 @@ typedef struct target_sigaltstack { static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) { - return state->gpr[29][state->current_tc]; + return state->gpr[state->current_tc][29]; } #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/mips64/target_signal.h b/linux-user/mips64/target_signal.h index 3b06e9824c..f3ef38d246 100644 --- a/linux-user/mips64/target_signal.h +++ b/linux-user/mips64/target_signal.h @@ -23,7 +23,7 @@ typedef struct target_sigaltstack { static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) { - return state->gpr[29][state->current_tc]; + return state->gpr[state->current_tc][29]; } #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/mipsn32/target_signal.h b/linux-user/mipsn32/target_signal.h index 4adf726e65..5da84112be 100644 --- a/linux-user/mipsn32/target_signal.h +++ b/linux-user/mipsn32/target_signal.h @@ -23,7 +23,7 @@ typedef struct target_sigaltstack { static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state) { - return state->gpr[29][state->current_tc]; + return state->gpr[state->current_tc][29]; } #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/signal.c b/linux-user/signal.c index 312e41941e..1f4608edac 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2131,7 +2131,7 @@ setup_sigcontext(CPUState *regs, struct target_sigcontext *sc) err |= __put_user(regs->PC[regs->current_tc], &sc->sc_pc); #define save_gp_reg(i) do { \ - err |= __put_user(regs->gpr[i][regs->current_tc], &sc->sc_regs[i]); \ + err |= __put_user(regs->gpr[regs->current_tc][i], &sc->sc_regs[i]); \ } while(0) __put_user(0, &sc->sc_regs[0]); save_gp_reg(1); save_gp_reg(2); save_gp_reg(3); save_gp_reg(4); save_gp_reg(5); save_gp_reg(6); @@ -2144,8 +2144,8 @@ setup_sigcontext(CPUState *regs, struct target_sigcontext *sc) save_gp_reg(31); #undef save_gp_reg - err |= __put_user(regs->HI[0][regs->current_tc], &sc->sc_mdhi); - err |= __put_user(regs->LO[0][regs->current_tc], &sc->sc_mdlo); + err |= __put_user(regs->HI[regs->current_tc][0], &sc->sc_mdhi); + err |= __put_user(regs->LO[regs->current_tc][0], &sc->sc_mdlo); /* Not used yet, but might be useful if we ever have DSP suppport */ #if 0 @@ -2205,11 +2205,11 @@ restore_sigcontext(CPUState *regs, struct target_sigcontext *sc) err |= __get_user(regs->CP0_EPC, &sc->sc_pc); - err |= __get_user(regs->HI[0][regs->current_tc], &sc->sc_mdhi); - err |= __get_user(regs->LO[0][regs->current_tc], &sc->sc_mdlo); + err |= __get_user(regs->HI[regs->current_tc][0], &sc->sc_mdhi); + err |= __get_user(regs->LO[regs->current_tc][0], &sc->sc_mdlo); #define restore_gp_reg(i) do { \ - err |= __get_user(regs->gpr[i][regs->current_tc], &sc->sc_regs[i]); \ + err |= __get_user(regs->gpr[regs->current_tc][i], &sc->sc_regs[i]); \ } while(0) restore_gp_reg( 1); restore_gp_reg( 2); restore_gp_reg( 3); restore_gp_reg( 4); restore_gp_reg( 5); restore_gp_reg( 6); @@ -2275,7 +2275,7 @@ get_sigframe(struct emulated_sigaction *ka, CPUState *regs, size_t frame_size) unsigned long sp; /* Default to using normal stack */ - sp = regs->gpr[29][regs->current_tc]; + sp = regs->gpr[regs->current_tc][29]; /* * FPU emulator may have it's own trampoline active just @@ -2324,15 +2324,15 @@ static void setup_frame(int sig, struct emulated_sigaction * ka, * $25 and PC point to the signal handler, $29 points to the * struct sigframe. */ - regs->gpr[ 4][regs->current_tc] = sig; - regs->gpr[ 5][regs->current_tc] = 0; - regs->gpr[ 6][regs->current_tc] = frame_addr + offsetof(struct sigframe, sf_sc); - regs->gpr[29][regs->current_tc] = frame_addr; - regs->gpr[31][regs->current_tc] = frame_addr + offsetof(struct sigframe, sf_code); + regs->gpr[regs->current_tc][ 4] = sig; + regs->gpr[regs->current_tc][ 5] = 0; + regs->gpr[regs->current_tc][ 6] = frame_addr + offsetof(struct sigframe, sf_sc); + regs->gpr[regs->current_tc][29] = frame_addr; + regs->gpr[regs->current_tc][31] = frame_addr + offsetof(struct sigframe, sf_code); /* The original kernel code sets CP0_EPC to the handler * since it returns to userland using eret * we cannot do this here, and we must set PC directly */ - regs->PC[regs->current_tc] = regs->gpr[25][regs->current_tc] = ka->sa._sa_handler; + regs->PC[regs->current_tc] = regs->gpr[regs->current_tc][25] = ka->sa._sa_handler; unlock_user_struct(frame, frame_addr, 1); return; @@ -2353,7 +2353,7 @@ long do_sigreturn(CPUState *regs) #if defined(DEBUG_SIGNAL) fprintf(stderr, "do_sigreturn\n"); #endif - frame_addr = regs->gpr[29][regs->current_tc]; + frame_addr = regs->gpr[regs->current_tc][29]; if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e8b49ca4a5..da39011641 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2752,8 +2752,8 @@ int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp) /* ??? is this sufficient? */ #elif defined(TARGET_MIPS) if (!newsp) - newsp = env->gpr[29][env->current_tc]; - new_env->gpr[29][env->current_tc] = newsp; + newsp = env->gpr[env->current_tc][29]; + new_env->gpr[env->current_tc][29] = newsp; #elif defined(TARGET_PPC) if (!newsp) newsp = env->gpr[1]; @@ -3512,7 +3512,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, if (!is_error(ret)) { #if defined(TARGET_MIPS) CPUMIPSState *env = (CPUMIPSState*)cpu_env; - env->gpr[3][env->current_tc] = host_pipe[1]; + env->gpr[env->current_tc][3] = host_pipe[1]; ret = host_pipe[0]; #else if (put_user_s32(host_pipe[0], arg1) |