mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
general: Replace global smp variables with smp machine properties
Basically, the context could get the MachineState reference via call chains or unrecommended qdev_get_machine() in !CONFIG_USER_ONLY mode. A local variable of the same name would be introduced in the declaration phase out of less effort OR replace it on the spot if it's only used once in the context. No semantic changes. Signed-off-by: Like Xu <like.xu@linux.intel.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190518205428.90532-4-like.xu@linux.intel.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
a0628599fa
commit
5cc8767d05
10 changed files with 45 additions and 11 deletions
|
@ -24,6 +24,9 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exception.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "hw/boards.h"
|
||||
#endif
|
||||
|
||||
#define TO_SPR(group, number) (((group) << 11) + (number))
|
||||
|
||||
|
@ -194,6 +197,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
|
|||
target_ulong spr)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
OpenRISCCPU *cpu = env_archcpu(env);
|
||||
CPUState *cs = env_cpu(env);
|
||||
int idx;
|
||||
|
@ -241,7 +245,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
|
|||
return cpu->parent_obj.cpu_index;
|
||||
|
||||
case TO_SPR(0, 129): /* NUMCORES */
|
||||
return max_cpus;
|
||||
return ms->smp.max_cpus;
|
||||
|
||||
case TO_SPR(0, 1024) ... TO_SPR(0, 1024 + (16 * 32)): /* Shadow GPRs */
|
||||
idx = (spr - 1024);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue