mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 22:11:53 -06:00
cpu: Replace ENV_GET_CPU with env_cpu
Now that we have both ArchCPU and CPUArchState, we can define this generically instead of via macro in each target's cpu.h. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
2161a612b4
commit
29a0af618d
59 changed files with 175 additions and 197 deletions
|
@ -423,7 +423,7 @@ void cpu_loop(CPUARMState *env)
|
|||
|
||||
void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
struct image_info *info = ts->info;
|
||||
int i;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#define EXCP_DUMP(env, fmt, ...) \
|
||||
do { \
|
||||
CPUState *cs = ENV_GET_CPU(env); \
|
||||
CPUState *cs = env_cpu(env); \
|
||||
fprintf(stderr, fmt , ## __VA_ARGS__); \
|
||||
cpu_dump_state(cs, stderr, 0); \
|
||||
if (qemu_log_separate()) { \
|
||||
|
|
|
@ -83,7 +83,7 @@ void cpu_loop(CPUCRISState *env)
|
|||
|
||||
void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
struct image_info *info = ts->info;
|
||||
|
||||
|
|
|
@ -3377,7 +3377,7 @@ static int write_note(struct memelfnote *men, int fd)
|
|||
|
||||
static void fill_thread_info(struct elf_note_info *info, const CPUArchState *env)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)env);
|
||||
TaskState *ts = (TaskState *)cpu->opaque;
|
||||
struct elf_thread_status *ets;
|
||||
|
||||
|
@ -3407,7 +3407,7 @@ static int fill_note_info(struct elf_note_info *info,
|
|||
long signr, const CPUArchState *env)
|
||||
{
|
||||
#define NUMNOTES 3
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)env);
|
||||
TaskState *ts = (TaskState *)cpu->opaque;
|
||||
int i;
|
||||
|
||||
|
@ -3531,7 +3531,7 @@ static int write_note_info(struct elf_note_info *info, int fd)
|
|||
*/
|
||||
static int elf_core_dump(int signr, const CPUArchState *env)
|
||||
{
|
||||
const CPUState *cpu = ENV_GET_CPU((CPUArchState *)env);
|
||||
const CPUState *cpu = env_cpu((CPUArchState *)env);
|
||||
const TaskState *ts = (const TaskState *)cpu->opaque;
|
||||
struct vm_area_struct *vma = NULL;
|
||||
char corefile[PATH_MAX];
|
||||
|
|
|
@ -130,7 +130,7 @@ void cpu_loop(CPUM68KState *env)
|
|||
|
||||
void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
struct image_info *info = ts->info;
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void init_task_state(TaskState *ts)
|
|||
|
||||
CPUArchState *cpu_copy(CPUArchState *env)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
CPUState *new_cpu = cpu_create(cpu_type);
|
||||
CPUArchState *new_env = new_cpu->env_ptr;
|
||||
CPUBreakpoint *bp;
|
||||
|
|
|
@ -654,7 +654,7 @@ error:
|
|||
|
||||
void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
struct image_info *info = ts->info;
|
||||
int i;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
void cpu_loop(CPUNios2State *env)
|
||||
{
|
||||
CPUState *cs = ENV_GET_CPU(env);
|
||||
CPUState *cs = env_cpu(env);
|
||||
Nios2CPU *cpu = NIOS2_CPU(cs);
|
||||
target_siginfo_t info;
|
||||
int trapnr, ret;
|
||||
|
|
|
@ -116,7 +116,7 @@ void cpu_loop(CPURISCVState *env)
|
|||
|
||||
void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
struct image_info *info = ts->info;
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ static void QEMU_NORETURN dump_core_and_abort(int target_sig)
|
|||
int queue_signal(CPUArchState *env, int sig, int si_type,
|
||||
target_siginfo_t *info)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
|
||||
trace_user_queue_signal(env, sig);
|
||||
|
@ -651,7 +651,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
|
|||
void *puc)
|
||||
{
|
||||
CPUArchState *env = thread_cpu->env_ptr;
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
|
||||
int sig;
|
||||
|
@ -842,7 +842,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
static void handle_pending_signal(CPUArchState *cpu_env, int sig,
|
||||
struct emulated_sigtable *k)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(cpu_env);
|
||||
CPUState *cpu = env_cpu(cpu_env);
|
||||
abi_ulong handler;
|
||||
sigset_t set;
|
||||
target_sigset_t target_old_set;
|
||||
|
@ -927,7 +927,7 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig,
|
|||
|
||||
void process_pending_signals(CPUArchState *cpu_env)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(cpu_env);
|
||||
CPUState *cpu = env_cpu(cpu_env);
|
||||
int sig;
|
||||
TaskState *ts = cpu->opaque;
|
||||
sigset_t set;
|
||||
|
|
|
@ -5484,7 +5484,7 @@ static void *clone_func(void *arg)
|
|||
rcu_register_thread();
|
||||
tcg_register_thread();
|
||||
env = info->env;
|
||||
cpu = ENV_GET_CPU(env);
|
||||
cpu = env_cpu(env);
|
||||
thread_cpu = cpu;
|
||||
ts = (TaskState *)cpu->opaque;
|
||||
info->tid = sys_gettid();
|
||||
|
@ -5514,7 +5514,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
|
|||
abi_ulong parent_tidptr, target_ulong newtls,
|
||||
abi_ulong child_tidptr)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(env);
|
||||
CPUState *cpu = env_cpu(env);
|
||||
int ret;
|
||||
TaskState *ts;
|
||||
CPUState *new_cpu;
|
||||
|
@ -5547,7 +5547,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
|
|||
new_env = cpu_copy(env);
|
||||
/* Init regs that differ from the parent. */
|
||||
cpu_clone_regs(new_env, newsp);
|
||||
new_cpu = ENV_GET_CPU(new_env);
|
||||
new_cpu = env_cpu(new_env);
|
||||
new_cpu->opaque = ts;
|
||||
ts->bprm = parent_ts->bprm;
|
||||
ts->info = parent_ts->info;
|
||||
|
@ -6654,7 +6654,7 @@ int host_to_target_waitstatus(int status)
|
|||
|
||||
static int open_self_cmdline(void *cpu_env, int fd)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)cpu_env);
|
||||
struct linux_binprm *bprm = ((TaskState *)cpu->opaque)->bprm;
|
||||
int i;
|
||||
|
||||
|
@ -6671,7 +6671,7 @@ static int open_self_cmdline(void *cpu_env, int fd)
|
|||
|
||||
static int open_self_maps(void *cpu_env, int fd)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)cpu_env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
FILE *fp;
|
||||
char *line = NULL;
|
||||
|
@ -6720,7 +6720,7 @@ static int open_self_maps(void *cpu_env, int fd)
|
|||
|
||||
static int open_self_stat(void *cpu_env, int fd)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)cpu_env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
abi_ulong start_stack = ts->info->start_stack;
|
||||
int i;
|
||||
|
@ -6757,7 +6757,7 @@ static int open_self_stat(void *cpu_env, int fd)
|
|||
|
||||
static int open_self_auxv(void *cpu_env, int fd)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU((CPUArchState *)cpu_env);
|
||||
CPUState *cpu = env_cpu((CPUArchState *)cpu_env);
|
||||
TaskState *ts = cpu->opaque;
|
||||
abi_ulong auxv = ts->info->saved_auxv;
|
||||
abi_ulong len = ts->info->auxv_len;
|
||||
|
@ -7042,7 +7042,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
|||
abi_long arg5, abi_long arg6, abi_long arg7,
|
||||
abi_long arg8)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(cpu_env);
|
||||
CPUState *cpu = env_cpu(cpu_env);
|
||||
abi_long ret;
|
||||
#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) \
|
||||
|| defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) \
|
||||
|
@ -11706,7 +11706,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
|||
abi_long arg5, abi_long arg6, abi_long arg7,
|
||||
abi_long arg8)
|
||||
{
|
||||
CPUState *cpu = ENV_GET_CPU(cpu_env);
|
||||
CPUState *cpu = env_cpu(cpu_env);
|
||||
abi_long ret;
|
||||
|
||||
#ifdef DEBUG_ERESTARTSYS
|
||||
|
|
|
@ -54,7 +54,7 @@ const char *cpu_to_uname_machine(void *cpu_env)
|
|||
return "armv5te" utsname_suffix;
|
||||
#elif defined(TARGET_I386) && !defined(TARGET_X86_64)
|
||||
/* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
|
||||
CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
|
||||
CPUState *cpu = env_cpu((CPUX86State *)cpu_env);
|
||||
int family = object_property_get_int(OBJECT(cpu), "family", NULL);
|
||||
if (family == 4) {
|
||||
return "i486";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue