mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-08 22:25:27 +00:00
cpus: pass CPUState to run_on_cpu helpers
CPUState is a fairly common pointer to pass to these helpers. This means if you need other arguments for the async_run_on_cpu case you end up having to do a g_malloc to stuff additional data into the routine. For the current users this isn't a massive deal but for MTTCG this gets cumbersome when the only other parameter is often an address. This adds the typedef run_on_cpu_func for helper functions which has an explicit CPUState * passed as the first parameter. All the users of run_on_cpu and async_run_on_cpu have had their helpers updated to use CPUState where available. Backports commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 from qemu
This commit is contained in:
parent
0ed8880525
commit
33589eb75f
|
@ -58,9 +58,9 @@ bool cpu_is_stopped(CPUState *cpu)
|
|||
return cpu->stopped;
|
||||
}
|
||||
|
||||
void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data)
|
||||
void run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data)
|
||||
{
|
||||
func(data);
|
||||
func(cpu, data);
|
||||
}
|
||||
|
||||
int resume_all_vcpus(struct uc_struct *uc)
|
||||
|
|
|
@ -189,6 +189,8 @@ struct kvm_run;
|
|||
#define TB_JMP_CACHE_BITS 12
|
||||
#define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
|
||||
|
||||
typedef void (*run_on_cpu_func)(CPUState *cpu, void *data);
|
||||
|
||||
// Unicorn: Moved CPUAddressSpace here from exec.c
|
||||
/**
|
||||
* CPUAddressSpace: all the information a CPU needs about an AddressSpace
|
||||
|
@ -545,7 +547,7 @@ bool cpu_is_stopped(CPUState *cpu);
|
|||
*
|
||||
* Schedules the function @func for execution on the vCPU @cpu.
|
||||
*/
|
||||
void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
|
||||
void run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data);
|
||||
|
||||
/**
|
||||
* async_run_on_cpu:
|
||||
|
@ -555,7 +557,7 @@ void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
|
|||
*
|
||||
* Schedules the function @func for execution on the vCPU @cpu asynchronously.
|
||||
*/
|
||||
void async_run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
|
||||
void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, void *data);
|
||||
|
||||
/**
|
||||
* qemu_get_cpu:
|
||||
|
|
|
@ -932,7 +932,6 @@ out:
|
|||
}
|
||||
|
||||
typedef struct MCEInjectionParams {
|
||||
X86CPU *cpu;
|
||||
int bank;
|
||||
uint64_t status;
|
||||
uint64_t mcg_status;
|
||||
|
|
Loading…
Reference in a new issue