mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
ppc: spapr: cleanup cr get/set with helpers.
The bits in cr reg are grouped into eight 4-bit fields represented by env->crf[8] and the related calculations should be abstracted to keep the calling routines simpler to read. This is a step towards cleaning up the related/calling code for better readability. Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230503093619.2530487-2-harshpb@linux.ibm.com> [danielhb: add 'const' modifier to fix linux-user build] Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
1b336bb63e
commit
2060436aab
8 changed files with 31 additions and 60 deletions
|
@ -243,9 +243,7 @@ static void save_user_regs(CPUPPCState *env, struct target_mcontext *frame)
|
|||
__put_user(env->lr, &frame->mc_gregs[TARGET_PT_LNK]);
|
||||
__put_user(cpu_read_xer(env), &frame->mc_gregs[TARGET_PT_XER]);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
|
||||
ccr |= env->crf[i] << (32 - ((i + 1) * 4));
|
||||
}
|
||||
ccr = ppc_get_cr(env);
|
||||
__put_user(ccr, &frame->mc_gregs[TARGET_PT_CCR]);
|
||||
|
||||
/* Save Altivec registers if necessary. */
|
||||
|
@ -335,10 +333,7 @@ static void restore_user_regs(CPUPPCState *env,
|
|||
cpu_write_xer(env, xer);
|
||||
|
||||
__get_user(ccr, &frame->mc_gregs[TARGET_PT_CCR]);
|
||||
for (i = 0; i < ARRAY_SIZE(env->crf); i++) {
|
||||
env->crf[i] = (ccr >> (32 - ((i + 1) * 4))) & 0xf;
|
||||
}
|
||||
|
||||
ppc_set_cr(env, ccr);
|
||||
if (!sig) {
|
||||
env->gpr[2] = save_r2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue