mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -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
|
@ -67,6 +67,23 @@ uint32_t ppc_get_vscr(CPUPPCState *env)
|
|||
return env->vscr | (sat << VSCR_SAT);
|
||||
}
|
||||
|
||||
void ppc_set_cr(CPUPPCState *env, uint64_t cr)
|
||||
{
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
env->crf[i] = cr & 0xf;
|
||||
cr >>= 4;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t ppc_get_cr(const CPUPPCState *env)
|
||||
{
|
||||
uint64_t cr = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
cr |= (env->crf[i] & 0xf) << (4 * (7 - i));
|
||||
}
|
||||
return cr;
|
||||
}
|
||||
|
||||
/* GDBstub can read and write MSR... */
|
||||
void ppc_store_msr(CPUPPCState *env, target_ulong value)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue