Skip to content

Commit

Permalink
Rename CPUState -> CPUArchState
Browse files Browse the repository at this point in the history
Scripted conversion:
  for file in *.[hc] hw/*.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do
    sed -i "s/CPUState/CPUArchState/g" $file
  done

All occurrences of CPUArchState are expected to be replaced by QOM CPUState,
once all targets are QOM'ified and common fields have been extracted.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information
afaerber committed Mar 14, 2012
1 parent 5bfcb36 commit 9349b4f
Show file tree
Hide file tree
Showing 59 changed files with 419 additions and 419 deletions.
8 changes: 4 additions & 4 deletions bsd-user/main.c
Expand Up @@ -70,11 +70,11 @@ int cpu_get_pic_interrupt(CPUX86State *env)
#endif

/* These are no-ops because we are not threadsafe. */
static inline void cpu_exec_start(CPUState *env)
static inline void cpu_exec_start(CPUArchState *env)
{
}

static inline void cpu_exec_end(CPUState *env)
static inline void cpu_exec_end(CPUArchState *env)
{
}

Expand Down Expand Up @@ -713,7 +713,7 @@ static void usage(void)
exit(1);
}

THREAD CPUState *thread_env;
THREAD CPUArchState *thread_env;

/* Assumes contents are already zeroed. */
void init_task_state(TaskState *ts)
Expand All @@ -737,7 +737,7 @@ int main(int argc, char **argv)
struct target_pt_regs regs1, *regs = &regs1;
struct image_info info1, *info = &info1;
TaskState ts1, *ts = &ts1;
CPUState *env;
CPUArchState *env;
int optind;
const char *r;
int gdbstub_port = 0;
Expand Down
12 changes: 6 additions & 6 deletions bsd-user/qemu.h
Expand Up @@ -139,8 +139,8 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern THREAD CPUState *thread_env;
void cpu_loop(CPUState *env);
extern THREAD CPUArchState *thread_env;
void cpu_loop(CPUArchState *env);
char *target_strerror(int err);
int get_osversion(void);
void fork_start(void);
Expand All @@ -167,13 +167,13 @@ void print_openbsd_syscall_ret(int num, abi_long ret);
extern int do_strace;

/* signal.c */
void process_pending_signals(CPUState *cpu_env);
void process_pending_signals(CPUArchState *cpu_env);
void signal_init(void);
//int queue_signal(CPUState *env, int sig, target_siginfo_t *info);
//int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info);
//void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info);
//void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo);
long do_sigreturn(CPUState *env);
long do_rt_sigreturn(CPUState *env);
long do_sigreturn(CPUArchState *env);
long do_rt_sigreturn(CPUArchState *env);
abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);

/* mmap.c */
Expand Down
2 changes: 1 addition & 1 deletion bsd-user/signal.c
Expand Up @@ -33,6 +33,6 @@ void signal_init(void)
{
}

void process_pending_signals(CPUState *cpu_env)
void process_pending_signals(CPUArchState *cpu_env)
{
}
56 changes: 28 additions & 28 deletions cpu-all.h
Expand Up @@ -322,20 +322,20 @@ void page_set_flags(target_ulong start, target_ulong end, int flags);
int page_check_range(target_ulong start, target_ulong len, int flags);
#endif

CPUState *cpu_copy(CPUState *env);
CPUState *qemu_get_cpu(int cpu);
CPUArchState *cpu_copy(CPUArchState *env);
CPUArchState *qemu_get_cpu(int cpu);

#define CPU_DUMP_CODE 0x00010000

void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
void cpu_dump_state(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf,
int flags);
void cpu_dump_statistics(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
void cpu_dump_statistics(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf,
int flags);

void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
extern CPUState *first_cpu;
DECLARE_TLS(CPUState *,cpu_single_env);
extern CPUArchState *first_cpu;
DECLARE_TLS(CPUArchState *,cpu_single_env);
#define cpu_single_env tls_var(cpu_single_env)

/* Flags for use in ENV->INTERRUPT_PENDING.
Expand Down Expand Up @@ -389,23 +389,23 @@ DECLARE_TLS(CPUState *,cpu_single_env);
| CPU_INTERRUPT_TGT_EXT_4)

#ifndef CONFIG_USER_ONLY
typedef void (*CPUInterruptHandler)(CPUState *, int);
typedef void (*CPUInterruptHandler)(CPUArchState *, int);

extern CPUInterruptHandler cpu_interrupt_handler;

static inline void cpu_interrupt(CPUState *s, int mask)
static inline void cpu_interrupt(CPUArchState *s, int mask)
{
cpu_interrupt_handler(s, mask);
}
#else /* USER_ONLY */
void cpu_interrupt(CPUState *env, int mask);
void cpu_interrupt(CPUArchState *env, int mask);
#endif /* USER_ONLY */

void cpu_reset_interrupt(CPUState *env, int mask);
void cpu_reset_interrupt(CPUArchState *env, int mask);

void cpu_exit(CPUState *s);
void cpu_exit(CPUArchState *s);

bool qemu_cpu_has_work(CPUState *env);
bool qemu_cpu_has_work(CPUArchState *env);

/* Breakpoint/watchpoint flags */
#define BP_MEM_READ 0x01
Expand All @@ -416,26 +416,26 @@ bool qemu_cpu_has_work(CPUState *env);
#define BP_GDB 0x10
#define BP_CPU 0x20

int cpu_breakpoint_insert(CPUState *env, target_ulong pc, int flags,
int cpu_breakpoint_insert(CPUArchState *env, target_ulong pc, int flags,
CPUBreakpoint **breakpoint);
int cpu_breakpoint_remove(CPUState *env, target_ulong pc, int flags);
void cpu_breakpoint_remove_by_ref(CPUState *env, CPUBreakpoint *breakpoint);
void cpu_breakpoint_remove_all(CPUState *env, int mask);
int cpu_watchpoint_insert(CPUState *env, target_ulong addr, target_ulong len,
int cpu_breakpoint_remove(CPUArchState *env, target_ulong pc, int flags);
void cpu_breakpoint_remove_by_ref(CPUArchState *env, CPUBreakpoint *breakpoint);
void cpu_breakpoint_remove_all(CPUArchState *env, int mask);
int cpu_watchpoint_insert(CPUArchState *env, target_ulong addr, target_ulong len,
int flags, CPUWatchpoint **watchpoint);
int cpu_watchpoint_remove(CPUState *env, target_ulong addr,
int cpu_watchpoint_remove(CPUArchState *env, target_ulong addr,
target_ulong len, int flags);
void cpu_watchpoint_remove_by_ref(CPUState *env, CPUWatchpoint *watchpoint);
void cpu_watchpoint_remove_all(CPUState *env, int mask);
void cpu_watchpoint_remove_by_ref(CPUArchState *env, CPUWatchpoint *watchpoint);
void cpu_watchpoint_remove_all(CPUArchState *env, int mask);

#define SSTEP_ENABLE 0x1 /* Enable simulated HW single stepping */
#define SSTEP_NOIRQ 0x2 /* Do not use IRQ while single stepping */
#define SSTEP_NOTIMER 0x4 /* Do not Timers while single stepping */

void cpu_single_step(CPUState *env, int enabled);
void cpu_state_reset(CPUState *s);
int cpu_is_stopped(CPUState *env);
void run_on_cpu(CPUState *env, void (*func)(void *data), void *data);
void cpu_single_step(CPUArchState *env, int enabled);
void cpu_state_reset(CPUArchState *s);
int cpu_is_stopped(CPUArchState *env);
void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data);

#define CPU_LOG_TB_OUT_ASM (1 << 0)
#define CPU_LOG_TB_IN_ASM (1 << 1)
Expand Down Expand Up @@ -466,7 +466,7 @@ int cpu_str_to_log_mask(const char *str);
/* Return the physical page corresponding to a virtual one. Use it
only for debugging because no protection checks are done. Return -1
if no page found. */
target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
target_phys_addr_t cpu_get_phys_page_debug(CPUArchState *env, target_ulong addr);

/* memory API */

Expand Down Expand Up @@ -508,12 +508,12 @@ extern int mem_prealloc;
/* Set if TLB entry is an IO callback. */
#define TLB_MMIO (1 << 5)

void cpu_tlb_update_dirty(CPUState *env);
void cpu_tlb_update_dirty(CPUArchState *env);

void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
#endif /* !CONFIG_USER_ONLY */

int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr,
uint8_t *buf, int len, int is_write);

#endif /* CPU_ALL_H */
2 changes: 1 addition & 1 deletion cpu-defs.h
Expand Up @@ -202,7 +202,7 @@ typedef struct CPUWatchpoint {
jmp_buf jmp_env; \
int exception_index; \
\
CPUState *next_cpu; /* next CPU sharing TB cache */ \
CPUArchState *next_cpu; /* next CPU sharing TB cache */ \
int cpu_index; /* CPU index (informative) */ \
uint32_t host_tid; /* host thread ID */ \
int numa_node; /* NUMA node this cpu is belonging to */ \
Expand Down
16 changes: 8 additions & 8 deletions cpu-exec.c
Expand Up @@ -26,12 +26,12 @@ int tb_invalidated_flag;

//#define CONFIG_DEBUG_EXEC

bool qemu_cpu_has_work(CPUState *env)
bool qemu_cpu_has_work(CPUArchState *env)
{
return cpu_has_work(env);
}

void cpu_loop_exit(CPUState *env)
void cpu_loop_exit(CPUArchState *env)
{
env->current_tb = NULL;
longjmp(env->jmp_env, 1);
Expand All @@ -41,7 +41,7 @@ void cpu_loop_exit(CPUState *env)
restored in a state compatible with the CPU emulator
*/
#if defined(CONFIG_SOFTMMU)
void cpu_resume_from_signal(CPUState *env, void *puc)
void cpu_resume_from_signal(CPUArchState *env, void *puc)
{
/* XXX: restore cpu registers saved in host registers */

Expand All @@ -52,7 +52,7 @@ void cpu_resume_from_signal(CPUState *env, void *puc)

/* Execute the code without caching the generated code. An interpreter
could be used if available. */
static void cpu_exec_nocache(CPUState *env, int max_cycles,
static void cpu_exec_nocache(CPUArchState *env, int max_cycles,
TranslationBlock *orig_tb)
{
unsigned long next_tb;
Expand All @@ -79,7 +79,7 @@ static void cpu_exec_nocache(CPUState *env, int max_cycles,
tb_free(tb);
}

static TranslationBlock *tb_find_slow(CPUState *env,
static TranslationBlock *tb_find_slow(CPUArchState *env,
target_ulong pc,
target_ulong cs_base,
uint64_t flags)
Expand Down Expand Up @@ -135,7 +135,7 @@ static TranslationBlock *tb_find_slow(CPUState *env,
return tb;
}

static inline TranslationBlock *tb_find_fast(CPUState *env)
static inline TranslationBlock *tb_find_fast(CPUArchState *env)
{
TranslationBlock *tb;
target_ulong cs_base, pc;
Expand Down Expand Up @@ -163,7 +163,7 @@ CPUDebugExcpHandler *cpu_set_debug_excp_handler(CPUDebugExcpHandler *handler)
return old_handler;
}

static void cpu_handle_debug_exception(CPUState *env)
static void cpu_handle_debug_exception(CPUArchState *env)
{
CPUWatchpoint *wp;

Expand All @@ -181,7 +181,7 @@ static void cpu_handle_debug_exception(CPUState *env)

volatile sig_atomic_t exit_request;

int cpu_exec(CPUState *env)
int cpu_exec(CPUArchState *env)
{
int ret, interrupt_request;
TranslationBlock *tb;
Expand Down

0 comments on commit 9349b4f

Please sign in to comment.