diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-27 10:02:35 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-06-27 10:02:35 +0000 |
commit | b5dc7732e1cc2fb549e48b7b5d664f2c79628e2e (patch) | |
tree | e18d7e7fc4e2fc9bad326022331c17c2800a8bbb /linux-user/signal.c | |
parent | a37ee56cb7f2094a65fff14ed5d4ff325652b802 (diff) | |
download | hqemu-b5dc7732e1cc2fb549e48b7b5d664f2c79628e2e.zip hqemu-b5dc7732e1cc2fb549e48b7b5d664f2c79628e2e.tar.gz |
More efficient target register / TC accesses.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4794 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r-- | linux-user/signal.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c index 623a5e3..599b8af 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -2290,10 +2290,10 @@ setup_sigcontext(CPUState *regs, struct target_sigcontext *sc) { int err = 0; - err |= __put_user(regs->PC[regs->current_tc], &sc->sc_pc); + err |= __put_user(regs->active_tc.PC, &sc->sc_pc); -#define save_gp_reg(i) do { \ - err |= __put_user(regs->gpr[regs->current_tc][i], &sc->sc_regs[i]); \ +#define save_gp_reg(i) do { \ + err |= __put_user(regs->active_tc.gpr[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); @@ -2306,8 +2306,8 @@ setup_sigcontext(CPUState *regs, struct target_sigcontext *sc) save_gp_reg(31); #undef save_gp_reg - err |= __put_user(regs->HI[regs->current_tc][0], &sc->sc_mdhi); - err |= __put_user(regs->LO[regs->current_tc][0], &sc->sc_mdlo); + err |= __put_user(regs->active_tc.HI[0], &sc->sc_mdhi); + err |= __put_user(regs->active_tc.LO[0], &sc->sc_mdlo); /* Not used yet, but might be useful if we ever have DSP suppport */ #if 0 @@ -2367,11 +2367,11 @@ restore_sigcontext(CPUState *regs, struct target_sigcontext *sc) err |= __get_user(regs->CP0_EPC, &sc->sc_pc); - err |= __get_user(regs->HI[regs->current_tc][0], &sc->sc_mdhi); - err |= __get_user(regs->LO[regs->current_tc][0], &sc->sc_mdlo); + err |= __get_user(regs->active_tc.HI[0], &sc->sc_mdhi); + err |= __get_user(regs->active_tc.LO[0], &sc->sc_mdlo); #define restore_gp_reg(i) do { \ - err |= __get_user(regs->gpr[regs->current_tc][i], &sc->sc_regs[i]); \ + err |= __get_user(regs->active_tc.gpr[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); @@ -2437,7 +2437,7 @@ get_sigframe(struct target_sigaction *ka, CPUState *regs, size_t frame_size) unsigned long sp; /* Default to using normal stack */ - sp = regs->gpr[regs->current_tc][29]; + sp = regs->active_tc.gpr[29]; /* * FPU emulator may have it's own trampoline active just @@ -2486,15 +2486,15 @@ static void setup_frame(int sig, struct target_sigaction * ka, * $25 and PC point to the signal handler, $29 points to the * struct sigframe. */ - 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); + regs->active_tc.gpr[ 4] = sig; + regs->active_tc.gpr[ 5] = 0; + regs->active_tc.gpr[ 6] = frame_addr + offsetof(struct sigframe, sf_sc); + regs->active_tc.gpr[29] = frame_addr; + regs->active_tc.gpr[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[regs->current_tc][25] = ka->_sa_handler; + regs->active_tc.PC = regs->active_tc.gpr[25] = ka->_sa_handler; unlock_user_struct(frame, frame_addr, 1); return; @@ -2515,7 +2515,7 @@ long do_sigreturn(CPUState *regs) #if defined(DEBUG_SIGNAL) fprintf(stderr, "do_sigreturn\n"); #endif - frame_addr = regs->gpr[regs->current_tc][29]; + frame_addr = regs->active_tc.gpr[29]; if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; @@ -2542,7 +2542,7 @@ long do_sigreturn(CPUState *regs) /* Unreached */ #endif - regs->PC[regs->current_tc] = regs->CP0_EPC; + regs->active_tc.PC = regs->CP0_EPC; /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ regs->CP0_EPC = 0; |