mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 01:58:28 +00:00
target-arm: Refactor CPU affinity handling
Introduces reusable definitions for CPU affinity masks/shifts and gets rid of hardcoded magic numbers. Backports commit 0f4a9e45ec35811ee250ac232d84d3c6d4fcd7fc from qemu
This commit is contained in:
parent
02ace69c9d
commit
2a6b6c1082
2 changed files with 14 additions and 1 deletions
|
@ -223,6 +223,19 @@ void arm_gt_vtimer_cb(void *opaque);
|
|||
void arm_gt_htimer_cb(void *opaque);
|
||||
void arm_gt_stimer_cb(void *opaque);
|
||||
|
||||
#define ARM_AFF0_SHIFT 0
|
||||
#define ARM_AFF0_MASK (0xFFULL << ARM_AFF0_SHIFT)
|
||||
#define ARM_AFF1_SHIFT 8
|
||||
#define ARM_AFF1_MASK (0xFFULL << ARM_AFF1_SHIFT)
|
||||
#define ARM_AFF2_SHIFT 16
|
||||
#define ARM_AFF2_MASK (0xFFULL << ARM_AFF2_SHIFT)
|
||||
#define ARM_AFF3_SHIFT 32
|
||||
#define ARM_AFF3_MASK (0xFFULL << ARM_AFF3_SHIFT)
|
||||
|
||||
#define ARM32_AFFINITY_MASK (ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK)
|
||||
#define ARM64_AFFINITY_MASK \
|
||||
(ARM_AFF0_MASK|ARM_AFF1_MASK|ARM_AFF2_MASK|ARM_AFF3_MASK)
|
||||
|
||||
#ifdef TARGET_AARCH64
|
||||
int aarch64_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
|
|
@ -367,7 +367,7 @@ static void arm_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
|||
*/
|
||||
Aff1 = cs->cpu_index / ARM_CPUS_PER_CLUSTER;
|
||||
Aff0 = cs->cpu_index % ARM_CPUS_PER_CLUSTER;
|
||||
cpu->mp_affinity = (Aff1 << 8) | Aff0;
|
||||
cpu->mp_affinity = (Aff1 << ARM_AFF1_SHIFT) | Aff0;
|
||||
|
||||
#if 0
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
Loading…
Reference in a new issue