mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-14 21:52:18 -06:00
target/sparc: Use memcpy() and remove memcpy32()
Rather than manually copying each register, use the libc memcpy(), which is well optimized nowadays. Suggested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20241205205418.67613-1-philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
a9af119f3d
commit
7ac87b14a9
1 changed files with 8 additions and 18 deletions
|
@ -24,29 +24,19 @@
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_set_cwp(CPUSPARCState *env, int new_cwp)
|
void cpu_set_cwp(CPUSPARCState *env, int new_cwp)
|
||||||
{
|
{
|
||||||
/* put the modified wrap registers at their proper location */
|
/* put the modified wrap registers at their proper location */
|
||||||
if (env->cwp == env->nwindows - 1) {
|
if (env->cwp == env->nwindows - 1) {
|
||||||
memcpy32(env->regbase, env->regbase + env->nwindows * 16);
|
memcpy(env->regbase, env->regbase + env->nwindows * 16,
|
||||||
|
sizeof(env->gregs));
|
||||||
}
|
}
|
||||||
env->cwp = new_cwp;
|
env->cwp = new_cwp;
|
||||||
|
|
||||||
/* put the wrap registers at their temporary location */
|
/* put the wrap registers at their temporary location */
|
||||||
if (new_cwp == env->nwindows - 1) {
|
if (new_cwp == env->nwindows - 1) {
|
||||||
memcpy32(env->regbase + env->nwindows * 16, env->regbase);
|
memcpy(env->regbase + env->nwindows * 16, env->regbase,
|
||||||
|
sizeof(env->gregs));
|
||||||
}
|
}
|
||||||
env->regwptr = env->regbase + (new_cwp * 16);
|
env->regwptr = env->regbase + (new_cwp * 16);
|
||||||
}
|
}
|
||||||
|
@ -361,8 +351,8 @@ void cpu_gl_switch_gregs(CPUSPARCState *env, uint32_t new_gl)
|
||||||
dst = get_gl_gregset(env, env->gl);
|
dst = get_gl_gregset(env, env->gl);
|
||||||
|
|
||||||
if (src != dst) {
|
if (src != dst) {
|
||||||
memcpy32(dst, env->gregs);
|
memcpy(dst, env->gregs, sizeof(env->gregs));
|
||||||
memcpy32(env->gregs, src);
|
memcpy(env->gregs, src, sizeof(env->gregs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,8 +383,8 @@ void cpu_change_pstate(CPUSPARCState *env, uint32_t new_pstate)
|
||||||
/* Switch global register bank */
|
/* Switch global register bank */
|
||||||
src = get_gregset(env, new_pstate_regs);
|
src = get_gregset(env, new_pstate_regs);
|
||||||
dst = get_gregset(env, pstate_regs);
|
dst = get_gregset(env, pstate_regs);
|
||||||
memcpy32(dst, env->gregs);
|
memcpy(dst, env->gregs, sizeof(env->gregs));
|
||||||
memcpy32(env->gregs, src);
|
memcpy(env->gregs, src, sizeof(env->gregs));
|
||||||
} else {
|
} else {
|
||||||
trace_win_helper_no_switch_pstate(new_pstate_regs);
|
trace_win_helper_no_switch_pstate(new_pstate_regs);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue