mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 19:14:58 -06:00
accel/tcg: Replace CPUState.env_ptr with cpu_env()
Reviewed-by: Anton Johansson <anjo@rev.ng> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
ad75a51e84
commit
b77af26e97
58 changed files with 152 additions and 155 deletions
|
@ -222,7 +222,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc,
|
||||||
struct tb_desc desc;
|
struct tb_desc desc;
|
||||||
uint32_t h;
|
uint32_t h;
|
||||||
|
|
||||||
desc.env = cpu->env_ptr;
|
desc.env = cpu_env(cpu);
|
||||||
desc.cs_base = cs_base;
|
desc.cs_base = cs_base;
|
||||||
desc.flags = flags;
|
desc.flags = flags;
|
||||||
desc.cflags = cflags;
|
desc.cflags = cflags;
|
||||||
|
@ -444,7 +444,7 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
|
||||||
static inline TranslationBlock * QEMU_DISABLE_CFI
|
static inline TranslationBlock * QEMU_DISABLE_CFI
|
||||||
cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
|
cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
uintptr_t ret;
|
uintptr_t ret;
|
||||||
TranslationBlock *last_tb;
|
TranslationBlock *last_tb;
|
||||||
const void *tb_ptr = itb->tc.ptr;
|
const void *tb_ptr = itb->tc.ptr;
|
||||||
|
@ -565,7 +565,7 @@ static void cpu_exec_longjmp_cleanup(CPUState *cpu)
|
||||||
|
|
||||||
void cpu_exec_step_atomic(CPUState *cpu)
|
void cpu_exec_step_atomic(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
TranslationBlock *tb;
|
TranslationBlock *tb;
|
||||||
vaddr pc;
|
vaddr pc;
|
||||||
uint64_t cs_base;
|
uint64_t cs_base;
|
||||||
|
@ -976,7 +976,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc)
|
||||||
uint64_t cs_base;
|
uint64_t cs_base;
|
||||||
uint32_t flags, cflags;
|
uint32_t flags, cflags;
|
||||||
|
|
||||||
cpu_get_tb_cpu_state(cpu->env_ptr, &pc, &cs_base, &flags);
|
cpu_get_tb_cpu_state(cpu_env(cpu), &pc, &cs_base, &flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When requested, use an exact setting for cflags for the next
|
* When requested, use an exact setting for cflags for the next
|
||||||
|
|
|
@ -274,7 +274,7 @@ static inline void tlb_n_used_entries_dec(CPUArchState *env, uintptr_t mmu_idx)
|
||||||
|
|
||||||
void tlb_init(CPUState *cpu)
|
void tlb_init(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
int64_t now = get_clock_realtime();
|
int64_t now = get_clock_realtime();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ void tlb_init(CPUState *cpu)
|
||||||
|
|
||||||
void tlb_destroy(CPUState *cpu)
|
void tlb_destroy(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qemu_spin_destroy(&env_tlb(env)->c.lock);
|
qemu_spin_destroy(&env_tlb(env)->c.lock);
|
||||||
|
@ -328,7 +328,7 @@ void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide)
|
||||||
size_t full = 0, part = 0, elide = 0;
|
size_t full = 0, part = 0, elide = 0;
|
||||||
|
|
||||||
CPU_FOREACH(cpu) {
|
CPU_FOREACH(cpu) {
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
|
|
||||||
full += qatomic_read(&env_tlb(env)->c.full_flush_count);
|
full += qatomic_read(&env_tlb(env)->c.full_flush_count);
|
||||||
part += qatomic_read(&env_tlb(env)->c.part_flush_count);
|
part += qatomic_read(&env_tlb(env)->c.part_flush_count);
|
||||||
|
@ -341,7 +341,7 @@ void tlb_flush_counts(size_t *pfull, size_t *ppart, size_t *pelide)
|
||||||
|
|
||||||
static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data)
|
static void tlb_flush_by_mmuidx_async_work(CPUState *cpu, run_on_cpu_data data)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
uint16_t asked = data.host_int;
|
uint16_t asked = data.host_int;
|
||||||
uint16_t all_dirty, work, to_clean;
|
uint16_t all_dirty, work, to_clean;
|
||||||
int64_t now = get_clock_realtime();
|
int64_t now = get_clock_realtime();
|
||||||
|
@ -523,7 +523,7 @@ static void tlb_flush_page_by_mmuidx_async_0(CPUState *cpu,
|
||||||
vaddr addr,
|
vaddr addr,
|
||||||
uint16_t idxmap)
|
uint16_t idxmap)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
assert_cpu_is_self(cpu);
|
assert_cpu_is_self(cpu);
|
||||||
|
@ -769,7 +769,7 @@ typedef struct {
|
||||||
static void tlb_flush_range_by_mmuidx_async_0(CPUState *cpu,
|
static void tlb_flush_range_by_mmuidx_async_0(CPUState *cpu,
|
||||||
TLBFlushRangeData d)
|
TLBFlushRangeData d)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
assert_cpu_is_self(cpu);
|
assert_cpu_is_self(cpu);
|
||||||
|
@ -1032,7 +1032,7 @@ void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length)
|
||||||
|
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
env = cpu->env_ptr;
|
env = cpu_env(cpu);
|
||||||
qemu_spin_lock(&env_tlb(env)->c.lock);
|
qemu_spin_lock(&env_tlb(env)->c.lock);
|
||||||
for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
|
for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1064,7 +1064,7 @@ static inline void tlb_set_dirty1_locked(CPUTLBEntry *tlb_entry,
|
||||||
so that it is no longer dirty */
|
so that it is no longer dirty */
|
||||||
void tlb_set_dirty(CPUState *cpu, vaddr addr)
|
void tlb_set_dirty(CPUState *cpu, vaddr addr)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
assert_cpu_is_self(cpu);
|
assert_cpu_is_self(cpu);
|
||||||
|
@ -1137,7 +1137,7 @@ static inline void tlb_set_compare(CPUTLBEntryFull *full, CPUTLBEntry *ent,
|
||||||
void tlb_set_page_full(CPUState *cpu, int mmu_idx,
|
void tlb_set_page_full(CPUState *cpu, int mmu_idx,
|
||||||
vaddr addr, CPUTLBEntryFull *full)
|
vaddr addr, CPUTLBEntryFull *full)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
CPUTLB *tlb = env_tlb(env);
|
CPUTLB *tlb = env_tlb(env);
|
||||||
CPUTLBDesc *desc = &tlb->d[mmu_idx];
|
CPUTLBDesc *desc = &tlb->d[mmu_idx];
|
||||||
MemoryRegionSection *section;
|
MemoryRegionSection *section;
|
||||||
|
@ -1662,7 +1662,7 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, vaddr addr,
|
||||||
bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx,
|
bool tlb_plugin_lookup(CPUState *cpu, vaddr addr, int mmu_idx,
|
||||||
bool is_store, struct qemu_plugin_hwaddr *data)
|
bool is_store, struct qemu_plugin_hwaddr *data)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
CPUTLBEntry *tlbe = tlb_entry(env, mmu_idx, addr);
|
CPUTLBEntry *tlbe = tlb_entry(env, mmu_idx, addr);
|
||||||
uintptr_t index = tlb_index(env, mmu_idx, addr);
|
uintptr_t index = tlb_index(env, mmu_idx, addr);
|
||||||
MMUAccessType access_type = is_store ? MMU_DATA_STORE : MMU_DATA_LOAD;
|
MMUAccessType access_type = is_store ? MMU_DATA_STORE : MMU_DATA_LOAD;
|
||||||
|
|
|
@ -849,7 +849,7 @@ void plugin_gen_insn_start(CPUState *cpu, const DisasContextBase *db)
|
||||||
} else {
|
} else {
|
||||||
if (ptb->vaddr2 == -1) {
|
if (ptb->vaddr2 == -1) {
|
||||||
ptb->vaddr2 = TARGET_PAGE_ALIGN(db->pc_first);
|
ptb->vaddr2 = TARGET_PAGE_ALIGN(db->pc_first);
|
||||||
get_page_addr_code_hostp(cpu->env_ptr, ptb->vaddr2, &ptb->haddr2);
|
get_page_addr_code_hostp(cpu_env(cpu), ptb->vaddr2, &ptb->haddr2);
|
||||||
}
|
}
|
||||||
pinsn->haddr = ptb->haddr2 + pinsn->vaddr - ptb->vaddr2;
|
pinsn->haddr = ptb->haddr2 + pinsn->vaddr - ptb->vaddr2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
|
||||||
vaddr pc, uint64_t cs_base,
|
vaddr pc, uint64_t cs_base,
|
||||||
uint32_t flags, int cflags)
|
uint32_t flags, int cflags)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
TranslationBlock *tb, *existing_tb;
|
TranslationBlock *tb, *existing_tb;
|
||||||
tb_page_addr_t phys_pc, phys_p2;
|
tb_page_addr_t phys_pc, phys_p2;
|
||||||
tcg_insn_unit *gen_code_buf;
|
tcg_insn_unit *gen_code_buf;
|
||||||
|
@ -580,7 +580,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr)
|
||||||
} else {
|
} else {
|
||||||
/* The exception probably happened in a helper. The CPU state should
|
/* The exception probably happened in a helper. The CPU state should
|
||||||
have been saved before calling it. Fetch the PC from there. */
|
have been saved before calling it. Fetch the PC from there. */
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
vaddr pc;
|
vaddr pc;
|
||||||
uint64_t cs_base;
|
uint64_t cs_base;
|
||||||
tb_page_addr_t addr;
|
tb_page_addr_t addr;
|
||||||
|
|
|
@ -462,7 +462,7 @@ int main(int argc, char **argv)
|
||||||
ac->init_machine(NULL);
|
ac->init_machine(NULL);
|
||||||
}
|
}
|
||||||
cpu = cpu_create(cpu_type);
|
cpu = cpu_create(cpu_type);
|
||||||
env = cpu->env_ptr;
|
env = cpu_env(cpu);
|
||||||
cpu_reset(cpu);
|
cpu_reset(cpu);
|
||||||
thread_cpu = cpu;
|
thread_cpu = cpu;
|
||||||
|
|
||||||
|
|
|
@ -351,8 +351,8 @@ static int core_dump_signal(int sig)
|
||||||
static G_NORETURN
|
static G_NORETURN
|
||||||
void dump_core_and_abort(int target_sig)
|
void dump_core_and_abort(int target_sig)
|
||||||
{
|
{
|
||||||
CPUArchState *env = thread_cpu->env_ptr;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUState *cpu = env_cpu(env);
|
CPUArchState *env = cpu_env(cpu);
|
||||||
TaskState *ts = cpu->opaque;
|
TaskState *ts = cpu->opaque;
|
||||||
int core_dumped = 0;
|
int core_dumped = 0;
|
||||||
int host_sig;
|
int host_sig;
|
||||||
|
@ -457,7 +457,7 @@ static int fatal_signal(int sig)
|
||||||
void force_sig_fault(int sig, int code, abi_ulong addr)
|
void force_sig_fault(int sig, int code, abi_ulong addr)
|
||||||
{
|
{
|
||||||
CPUState *cpu = thread_cpu;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
target_siginfo_t info = {};
|
target_siginfo_t info = {};
|
||||||
|
|
||||||
info.si_signo = sig;
|
info.si_signo = sig;
|
||||||
|
@ -469,8 +469,7 @@ void force_sig_fault(int sig, int code, abi_ulong addr)
|
||||||
|
|
||||||
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
|
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
|
||||||
{
|
{
|
||||||
CPUArchState *env = thread_cpu->env_ptr;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUState *cpu = env_cpu(env);
|
|
||||||
TaskState *ts = cpu->opaque;
|
TaskState *ts = cpu->opaque;
|
||||||
target_siginfo_t tinfo;
|
target_siginfo_t tinfo;
|
||||||
ucontext_t *uc = puc;
|
ucontext_t *uc = puc;
|
||||||
|
|
|
@ -423,7 +423,7 @@ static const char *get_feature_xml(const char *p, const char **newp,
|
||||||
static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
|
static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
GDBRegisterState *r;
|
GDBRegisterState *r;
|
||||||
|
|
||||||
if (reg < cc->gdb_num_core_regs) {
|
if (reg < cc->gdb_num_core_regs) {
|
||||||
|
@ -441,7 +441,7 @@ static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
|
||||||
static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg)
|
static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
GDBRegisterState *r;
|
GDBRegisterState *r;
|
||||||
|
|
||||||
if (reg < cc->gdb_num_core_regs) {
|
if (reg < cc->gdb_num_core_regs) {
|
||||||
|
|
|
@ -310,7 +310,7 @@ void gdb_handle_v_file_open(GArray *params, void *user_ctx)
|
||||||
uint64_t mode = get_param(params, 2)->val_ull;
|
uint64_t mode = get_param(params, 2)->val_ull;
|
||||||
|
|
||||||
#ifdef CONFIG_LINUX
|
#ifdef CONFIG_LINUX
|
||||||
int fd = do_guest_openat(gdbserver_state.g_cpu->env_ptr, 0, filename,
|
int fd = do_guest_openat(cpu_env(gdbserver_state.g_cpu), 0, filename,
|
||||||
flags, mode, false);
|
flags, mode, false);
|
||||||
#else
|
#else
|
||||||
int fd = open(filename, flags, mode);
|
int fd = open(filename, flags, mode);
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct pvclock_vcpu_time_info {
|
||||||
static uint64_t kvmclock_current_nsec(KVMClockState *s)
|
static uint64_t kvmclock_current_nsec(KVMClockState *s)
|
||||||
{
|
{
|
||||||
CPUState *cpu = first_cpu;
|
CPUState *cpu = first_cpu;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
hwaddr kvmclock_struct_pa;
|
hwaddr kvmclock_struct_pa;
|
||||||
uint64_t migration_tsc = env->tsc;
|
uint64_t migration_tsc = env->tsc;
|
||||||
struct pvclock_vcpu_time_info time;
|
struct pvclock_vcpu_time_info time;
|
||||||
|
|
|
@ -423,7 +423,7 @@ static void mips_gic_realize(DeviceState *dev, Error **errp)
|
||||||
/* Register the env for all VPs with the GIC */
|
/* Register the env for all VPs with the GIC */
|
||||||
for (i = 0; i < s->num_vps; i++) {
|
for (i = 0; i < s->num_vps; i++) {
|
||||||
if (cs != NULL) {
|
if (cs != NULL) {
|
||||||
s->vps[i].env = cs->env_ptr;
|
s->vps[i].env = cpu_env(cs);
|
||||||
cs = CPU_NEXT(cs);
|
cs = CPU_NEXT(cs);
|
||||||
} else {
|
} else {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
|
|
|
@ -131,7 +131,7 @@ static uint64_t riscv_aclint_mtimer_read(void *opaque, hwaddr addr,
|
||||||
size_t hartid = mtimer->hartid_base +
|
size_t hartid = mtimer->hartid_base +
|
||||||
((addr - mtimer->timecmp_base) >> 3);
|
((addr - mtimer->timecmp_base) >> 3);
|
||||||
CPUState *cpu = cpu_by_arch_id(hartid);
|
CPUState *cpu = cpu_by_arch_id(hartid);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
if (!env) {
|
if (!env) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"aclint-mtimer: invalid hartid: %zu", hartid);
|
"aclint-mtimer: invalid hartid: %zu", hartid);
|
||||||
|
@ -174,7 +174,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
|
||||||
size_t hartid = mtimer->hartid_base +
|
size_t hartid = mtimer->hartid_base +
|
||||||
((addr - mtimer->timecmp_base) >> 3);
|
((addr - mtimer->timecmp_base) >> 3);
|
||||||
CPUState *cpu = cpu_by_arch_id(hartid);
|
CPUState *cpu = cpu_by_arch_id(hartid);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
if (!env) {
|
if (!env) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"aclint-mtimer: invalid hartid: %zu", hartid);
|
"aclint-mtimer: invalid hartid: %zu", hartid);
|
||||||
|
@ -233,7 +233,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
|
||||||
/* Check if timer interrupt is triggered for each hart. */
|
/* Check if timer interrupt is triggered for each hart. */
|
||||||
for (i = 0; i < mtimer->num_harts; i++) {
|
for (i = 0; i < mtimer->num_harts; i++) {
|
||||||
CPUState *cpu = cpu_by_arch_id(mtimer->hartid_base + i);
|
CPUState *cpu = cpu_by_arch_id(mtimer->hartid_base + i);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
if (!env) {
|
if (!env) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ DeviceState *riscv_aclint_mtimer_create(hwaddr addr, hwaddr size,
|
||||||
for (i = 0; i < num_harts; i++) {
|
for (i = 0; i < num_harts; i++) {
|
||||||
CPUState *cpu = cpu_by_arch_id(hartid_base + i);
|
CPUState *cpu = cpu_by_arch_id(hartid_base + i);
|
||||||
RISCVCPU *rvcpu = RISCV_CPU(cpu);
|
RISCVCPU *rvcpu = RISCV_CPU(cpu);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
riscv_aclint_mtimer_callback *cb =
|
riscv_aclint_mtimer_callback *cb =
|
||||||
g_new0(riscv_aclint_mtimer_callback, 1);
|
g_new0(riscv_aclint_mtimer_callback, 1);
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ static uint64_t riscv_aclint_swi_read(void *opaque, hwaddr addr,
|
||||||
if (addr < (swi->num_harts << 2)) {
|
if (addr < (swi->num_harts << 2)) {
|
||||||
size_t hartid = swi->hartid_base + (addr >> 2);
|
size_t hartid = swi->hartid_base + (addr >> 2);
|
||||||
CPUState *cpu = cpu_by_arch_id(hartid);
|
CPUState *cpu = cpu_by_arch_id(hartid);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
if (!env) {
|
if (!env) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"aclint-swi: invalid hartid: %zu", hartid);
|
"aclint-swi: invalid hartid: %zu", hartid);
|
||||||
|
@ -432,7 +432,7 @@ static void riscv_aclint_swi_write(void *opaque, hwaddr addr, uint64_t value,
|
||||||
if (addr < (swi->num_harts << 2)) {
|
if (addr < (swi->num_harts << 2)) {
|
||||||
size_t hartid = swi->hartid_base + (addr >> 2);
|
size_t hartid = swi->hartid_base + (addr >> 2);
|
||||||
CPUState *cpu = cpu_by_arch_id(hartid);
|
CPUState *cpu = cpu_by_arch_id(hartid);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
if (!env) {
|
if (!env) {
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"aclint-swi: invalid hartid: %zu", hartid);
|
"aclint-swi: invalid hartid: %zu", hartid);
|
||||||
|
|
|
@ -333,7 +333,7 @@ static void riscv_imsic_realize(DeviceState *dev, Error **errp)
|
||||||
RISCVIMSICState *imsic = RISCV_IMSIC(dev);
|
RISCVIMSICState *imsic = RISCV_IMSIC(dev);
|
||||||
RISCVCPU *rcpu = RISCV_CPU(cpu_by_arch_id(imsic->hartid));
|
RISCVCPU *rcpu = RISCV_CPU(cpu_by_arch_id(imsic->hartid));
|
||||||
CPUState *cpu = cpu_by_arch_id(imsic->hartid);
|
CPUState *cpu = cpu_by_arch_id(imsic->hartid);
|
||||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
CPURISCVState *env = cpu ? cpu_env(cpu) : NULL;
|
||||||
|
|
||||||
if (!kvm_irqchip_in_kernel()) {
|
if (!kvm_irqchip_in_kernel()) {
|
||||||
imsic->num_eistate = imsic->num_pages * imsic->num_irqs;
|
imsic->num_eistate = imsic->num_pages * imsic->num_irqs;
|
||||||
|
|
|
@ -373,7 +373,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
|
||||||
MachineState *machine = MACHINE(pms);
|
MachineState *machine = MACHINE(pms);
|
||||||
unsigned int smp_cpus = machine->smp.cpus;
|
unsigned int smp_cpus = machine->smp.cpus;
|
||||||
const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(pms);
|
const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(pms);
|
||||||
CPUPPCState *env = first_cpu->env_ptr;
|
CPUPPCState *env = cpu_env(first_cpu);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
uint64_t mem_reg_property[] = { 0, cpu_to_be64(machine->ram_size) };
|
uint64_t mem_reg_property[] = { 0, cpu_to_be64(machine->ram_size) };
|
||||||
int fdt_size;
|
int fdt_size;
|
||||||
|
@ -499,7 +499,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
|
||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
env = cpu->env_ptr;
|
env = cpu_env(cpu);
|
||||||
|
|
||||||
cpu_name = g_strdup_printf("/cpus/PowerPC,8544@%x", i);
|
cpu_name = g_strdup_printf("/cpus/PowerPC,8544@%x", i);
|
||||||
qemu_fdt_add_subnode(fdt, cpu_name);
|
qemu_fdt_add_subnode(fdt, cpu_name);
|
||||||
|
|
|
@ -1125,7 +1125,7 @@ static void spapr_dt_hypervisor(SpaprMachineState *spapr, void *fdt)
|
||||||
* Older KVM versions with older guest kernels were broken
|
* Older KVM versions with older guest kernels were broken
|
||||||
* with the magic page, don't allow the guest to map it.
|
* with the magic page, don't allow the guest to map it.
|
||||||
*/
|
*/
|
||||||
if (!kvmppc_get_hypercall(first_cpu->env_ptr, hypercall,
|
if (!kvmppc_get_hypercall(cpu_env(first_cpu), hypercall,
|
||||||
sizeof(hypercall))) {
|
sizeof(hypercall))) {
|
||||||
_FDT(fdt_setprop(fdt, hypervisor, "hcall-instructions",
|
_FDT(fdt_setprop(fdt, hypervisor, "hcall-instructions",
|
||||||
hypercall, sizeof(hypercall)));
|
hypercall, sizeof(hypercall)));
|
||||||
|
|
|
@ -431,7 +431,6 @@ int cpu_exec(CPUState *cpu);
|
||||||
*/
|
*/
|
||||||
static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
|
static inline void cpu_set_cpustate_pointers(ArchCPU *cpu)
|
||||||
{
|
{
|
||||||
cpu->parent_obj.env_ptr = &cpu->env;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate correct placement of CPUArchState. */
|
/* Validate correct placement of CPUArchState. */
|
||||||
|
|
|
@ -427,7 +427,6 @@ struct qemu_work_item;
|
||||||
* @num_ases: number of CPUAddressSpaces in @cpu_ases
|
* @num_ases: number of CPUAddressSpaces in @cpu_ases
|
||||||
* @as: Pointer to the first AddressSpace, for the convenience of targets which
|
* @as: Pointer to the first AddressSpace, for the convenience of targets which
|
||||||
* only have a single AddressSpace
|
* only have a single AddressSpace
|
||||||
* @env_ptr: Pointer to subclass-specific CPUArchState field.
|
|
||||||
* @gdb_regs: Additional GDB registers.
|
* @gdb_regs: Additional GDB registers.
|
||||||
* @gdb_num_regs: Number of total registers accessible to GDB.
|
* @gdb_num_regs: Number of total registers accessible to GDB.
|
||||||
* @gdb_num_g_regs: Number of registers in GDB 'g' packets.
|
* @gdb_num_g_regs: Number of registers in GDB 'g' packets.
|
||||||
|
@ -501,8 +500,6 @@ struct CPUState {
|
||||||
AddressSpace *as;
|
AddressSpace *as;
|
||||||
MemoryRegion *memory;
|
MemoryRegion *memory;
|
||||||
|
|
||||||
CPUArchState *env_ptr;
|
|
||||||
|
|
||||||
CPUJumpCache *tb_jmp_cache;
|
CPUJumpCache *tb_jmp_cache;
|
||||||
|
|
||||||
struct GDBRegisterState *gdb_regs;
|
struct GDBRegisterState *gdb_regs;
|
||||||
|
@ -582,6 +579,12 @@ struct CPUState {
|
||||||
QEMU_BUILD_BUG_ON(offsetof(CPUState, neg) !=
|
QEMU_BUILD_BUG_ON(offsetof(CPUState, neg) !=
|
||||||
sizeof(CPUState) - sizeof(CPUNegativeOffsetState));
|
sizeof(CPUState) - sizeof(CPUNegativeOffsetState));
|
||||||
|
|
||||||
|
static inline CPUArchState *cpu_env(CPUState *cpu)
|
||||||
|
{
|
||||||
|
/* We validate that CPUArchState follows CPUState in cpu-all.h. */
|
||||||
|
return (CPUArchState *)(cpu + 1);
|
||||||
|
}
|
||||||
|
|
||||||
typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ;
|
typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ;
|
||||||
extern CPUTailQ cpus;
|
extern CPUTailQ cpus;
|
||||||
|
|
||||||
|
|
|
@ -593,7 +593,7 @@ const char *elf_hwcap2_str(uint32_t bit)
|
||||||
|
|
||||||
static const char *get_elf_platform(void)
|
static const char *get_elf_platform(void)
|
||||||
{
|
{
|
||||||
CPUARMState *env = thread_cpu->env_ptr;
|
CPUARMState *env = cpu_env(thread_cpu);
|
||||||
|
|
||||||
#if TARGET_BIG_ENDIAN
|
#if TARGET_BIG_ENDIAN
|
||||||
# define END "b"
|
# define END "b"
|
||||||
|
@ -4430,7 +4430,7 @@ static int fill_note_info(struct elf_note_info *info,
|
||||||
if (cpu == thread_cpu) {
|
if (cpu == thread_cpu) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fill_thread_info(info, cpu->env_ptr);
|
fill_thread_info(info, cpu_env(cpu));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ void cpu_loop(CPUX86State *env)
|
||||||
|
|
||||||
static void target_cpu_free(void *obj)
|
static void target_cpu_free(void *obj)
|
||||||
{
|
{
|
||||||
CPUArchState *env = ((CPUState *)obj)->env_ptr;
|
CPUArchState *env = cpu_env(obj);
|
||||||
target_munmap(env->gdt.base, sizeof(uint64_t) * TARGET_GDT_ENTRIES);
|
target_munmap(env->gdt.base, sizeof(uint64_t) * TARGET_GDT_ENTRIES);
|
||||||
g_free(obj);
|
g_free(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
|
||||||
{
|
{
|
||||||
CPUState *cpu = env_cpu(env);
|
CPUState *cpu = env_cpu(env);
|
||||||
CPUState *new_cpu = cpu_create(cpu_type);
|
CPUState *new_cpu = cpu_create(cpu_type);
|
||||||
CPUArchState *new_env = new_cpu->env_ptr;
|
CPUArchState *new_env = cpu_env(new_cpu);
|
||||||
CPUBreakpoint *bp;
|
CPUBreakpoint *bp;
|
||||||
|
|
||||||
/* Reset non arch specific state */
|
/* Reset non arch specific state */
|
||||||
|
@ -794,7 +794,7 @@ int main(int argc, char **argv, char **envp)
|
||||||
ac->init_machine(NULL);
|
ac->init_machine(NULL);
|
||||||
}
|
}
|
||||||
cpu = cpu_create(cpu_type);
|
cpu = cpu_create(cpu_type);
|
||||||
env = cpu->env_ptr;
|
env = cpu_env(cpu);
|
||||||
cpu_reset(cpu);
|
cpu_reset(cpu);
|
||||||
thread_cpu = cpu;
|
thread_cpu = cpu;
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ void signal_init(void)
|
||||||
void force_sig(int sig)
|
void force_sig(int sig)
|
||||||
{
|
{
|
||||||
CPUState *cpu = thread_cpu;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
target_siginfo_t info = {};
|
target_siginfo_t info = {};
|
||||||
|
|
||||||
info.si_signo = sig;
|
info.si_signo = sig;
|
||||||
|
@ -636,7 +636,7 @@ void force_sig(int sig)
|
||||||
void force_sig_fault(int sig, int code, abi_ulong addr)
|
void force_sig_fault(int sig, int code, abi_ulong addr)
|
||||||
{
|
{
|
||||||
CPUState *cpu = thread_cpu;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUArchState *env = cpu->env_ptr;
|
CPUArchState *env = cpu_env(cpu);
|
||||||
target_siginfo_t info = {};
|
target_siginfo_t info = {};
|
||||||
|
|
||||||
info.si_signo = sig;
|
info.si_signo = sig;
|
||||||
|
@ -695,10 +695,9 @@ void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr,
|
||||||
|
|
||||||
/* abort execution with signal */
|
/* abort execution with signal */
|
||||||
static G_NORETURN
|
static G_NORETURN
|
||||||
void dump_core_and_abort(CPUArchState *cpu_env, int target_sig)
|
void dump_core_and_abort(CPUArchState *env, int target_sig)
|
||||||
{
|
{
|
||||||
CPUState *cpu = thread_cpu;
|
CPUState *cpu = env_cpu(env);
|
||||||
CPUArchState *env = cpu->env_ptr;
|
|
||||||
TaskState *ts = (TaskState *)cpu->opaque;
|
TaskState *ts = (TaskState *)cpu->opaque;
|
||||||
int host_sig, core_dumped = 0;
|
int host_sig, core_dumped = 0;
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
@ -724,7 +723,7 @@ void dump_core_and_abort(CPUArchState *cpu_env, int target_sig)
|
||||||
target_sig, strsignal(host_sig), "core dumped" );
|
target_sig, strsignal(host_sig), "core dumped" );
|
||||||
}
|
}
|
||||||
|
|
||||||
preexit_cleanup(cpu_env, 128 + target_sig);
|
preexit_cleanup(env, 128 + target_sig);
|
||||||
|
|
||||||
/* The proper exit code for dying from an uncaught signal is
|
/* The proper exit code for dying from an uncaught signal is
|
||||||
* -<signal>. The kernel doesn't allow exit() or _exit() to pass
|
* -<signal>. The kernel doesn't allow exit() or _exit() to pass
|
||||||
|
@ -783,8 +782,8 @@ static inline void rewind_if_in_safe_syscall(void *puc)
|
||||||
|
|
||||||
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
|
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
|
||||||
{
|
{
|
||||||
CPUArchState *env = thread_cpu->env_ptr;
|
CPUState *cpu = thread_cpu;
|
||||||
CPUState *cpu = env_cpu(env);
|
CPUArchState *env = cpu_env(cpu);
|
||||||
TaskState *ts = cpu->opaque;
|
TaskState *ts = cpu->opaque;
|
||||||
target_siginfo_t tinfo;
|
target_siginfo_t tinfo;
|
||||||
host_sigcontext *uc = puc;
|
host_sigcontext *uc = puc;
|
||||||
|
|
|
@ -81,7 +81,7 @@ CPUArchState *mon_get_cpu_env(Monitor *mon)
|
||||||
{
|
{
|
||||||
CPUState *cs = mon_get_cpu(mon);
|
CPUState *cs = mon_get_cpu(mon);
|
||||||
|
|
||||||
return cs ? cs->env_ptr : NULL;
|
return cs ? cpu_env(cs) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_get_cpu_index(Monitor *mon)
|
int monitor_get_cpu_index(Monitor *mon)
|
||||||
|
|
|
@ -251,7 +251,7 @@ static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
|
static void common_semi_rw_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
{
|
{
|
||||||
/* Recover the original length from the third argument. */
|
/* Recover the original length from the third argument. */
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
target_ulong args = common_semi_arg(cs, 1);
|
target_ulong args = common_semi_arg(cs, 1);
|
||||||
target_ulong arg2;
|
target_ulong arg2;
|
||||||
GET_ARG(2);
|
GET_ARG(2);
|
||||||
|
@ -322,7 +322,7 @@ static void
|
||||||
common_semi_readc_cb(CPUState *cs, uint64_t ret, int err)
|
common_semi_readc_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
{
|
{
|
||||||
if (!err) {
|
if (!err) {
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
|
|
||||||
if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) {
|
if (get_user_u8(ch, common_semi_stack_bottom(cs) - 1)) {
|
||||||
|
@ -361,7 +361,7 @@ static const uint8_t featurefile_data[] = {
|
||||||
*/
|
*/
|
||||||
void do_common_semihosting(CPUState *cs)
|
void do_common_semihosting(CPUState *cs)
|
||||||
{
|
{
|
||||||
CPUArchState *env = cs->env_ptr;
|
CPUArchState *env = cpu_env(cs);
|
||||||
target_ulong args;
|
target_ulong args;
|
||||||
target_ulong arg0, arg1, arg2, arg3;
|
target_ulong arg0, arg1, arg2, arg3;
|
||||||
target_ulong ul_ret;
|
target_ulong ul_ret;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
static int validate_strlen(CPUState *cs, target_ulong str, target_ulong tlen)
|
static int validate_strlen(CPUState *cs, target_ulong str, target_ulong tlen)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (tlen == 0) {
|
if (tlen == 0) {
|
||||||
|
@ -54,7 +54,7 @@ static int validate_lock_user_string(char **pstr, CPUState *cs,
|
||||||
target_ulong tstr, target_ulong tlen)
|
target_ulong tstr, target_ulong tlen)
|
||||||
{
|
{
|
||||||
int ret = validate_strlen(cs, tstr, tlen);
|
int ret = validate_strlen(cs, tstr, tlen);
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
@ -74,7 +74,7 @@ static int validate_lock_user_string(char **pstr, CPUState *cs,
|
||||||
static int copy_stat_to_user(CPUState *cs, target_ulong addr,
|
static int copy_stat_to_user(CPUState *cs, target_ulong addr,
|
||||||
const struct stat *s)
|
const struct stat *s)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
struct gdb_stat *p;
|
struct gdb_stat *p;
|
||||||
|
|
||||||
if (s->st_dev != (uint32_t)s->st_dev ||
|
if (s->st_dev != (uint32_t)s->st_dev ||
|
||||||
|
@ -258,7 +258,7 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong fname, target_ulong fname_len,
|
target_ulong fname, target_ulong fname_len,
|
||||||
int gdb_flags, int mode)
|
int gdb_flags, int mode)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *p;
|
char *p;
|
||||||
int ret, host_flags = O_BINARY;
|
int ret, host_flags = O_BINARY;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ static void host_close(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
GuestFD *gf, target_ulong buf, target_ulong len)
|
GuestFD *gf, target_ulong buf, target_ulong len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
void *ptr = lock_user(VERIFY_WRITE, buf, len, 0);
|
void *ptr = lock_user(VERIFY_WRITE, buf, len, 0);
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ static void host_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void host_write(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void host_write(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
GuestFD *gf, target_ulong buf, target_ulong len)
|
GuestFD *gf, target_ulong buf, target_ulong len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
void *ptr = lock_user(VERIFY_READ, buf, len, 1);
|
void *ptr = lock_user(VERIFY_READ, buf, len, 1);
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ static void host_stat(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong fname, target_ulong fname_len,
|
target_ulong fname, target_ulong fname_len,
|
||||||
target_ulong addr)
|
target_ulong addr)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
char *name;
|
char *name;
|
||||||
int ret, err;
|
int ret, err;
|
||||||
|
@ -440,7 +440,7 @@ static void host_stat(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void host_remove(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void host_remove(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong fname, target_ulong fname_len)
|
target_ulong fname, target_ulong fname_len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *p;
|
char *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong oname, target_ulong oname_len,
|
target_ulong oname, target_ulong oname_len,
|
||||||
target_ulong nname, target_ulong nname_len)
|
target_ulong nname, target_ulong nname_len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *ostr, *nstr;
|
char *ostr, *nstr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ static void host_rename(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong cmd, target_ulong cmd_len)
|
target_ulong cmd, target_ulong cmd_len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *p;
|
char *p;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ static void host_system(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void host_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void host_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
target_ulong tv_addr, target_ulong tz_addr)
|
target_ulong tv_addr, target_ulong tz_addr)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
struct gdb_timeval *p;
|
struct gdb_timeval *p;
|
||||||
int64_t rt;
|
int64_t rt;
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ static void host_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void staticfile_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void staticfile_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
GuestFD *gf, target_ulong buf, target_ulong len)
|
GuestFD *gf, target_ulong buf, target_ulong len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
target_ulong rest = gf->staticfile.len - gf->staticfile.off;
|
target_ulong rest = gf->staticfile.len - gf->staticfile.off;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ static void staticfile_flen(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
GuestFD *gf, target_ulong buf, target_ulong len)
|
GuestFD *gf, target_ulong buf, target_ulong len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -622,7 +622,7 @@ static void console_read(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,
|
static void console_write(CPUState *cs, gdb_syscall_complete_cb complete,
|
||||||
GuestFD *gf, target_ulong buf, target_ulong len)
|
GuestFD *gf, target_ulong buf, target_ulong len)
|
||||||
{
|
{
|
||||||
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
|
CPUArchState *env G_GNUC_UNUSED = cpu_env(cs);
|
||||||
char *ptr = lock_user(VERIFY_READ, buf, len, 1);
|
char *ptr = lock_user(VERIFY_READ, buf, len, 1);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -2871,7 +2871,7 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
|
||||||
static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUAlphaState *env = cpu->env_ptr;
|
CPUAlphaState *env = cpu_env(cpu);
|
||||||
int64_t bound;
|
int64_t bound;
|
||||||
|
|
||||||
ctx->tbflags = ctx->base.tb->flags;
|
ctx->tbflags = ctx->base.tb->flags;
|
||||||
|
@ -2917,7 +2917,7 @@ static void alpha_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUAlphaState *env = cpu->env_ptr;
|
CPUAlphaState *env = cpu_env(cpu);
|
||||||
uint32_t insn = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
uint32_t insn = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
||||||
|
|
||||||
ctx->base.pc_next += 4;
|
ctx->base.pc_next += 4;
|
||||||
|
|
|
@ -38,7 +38,7 @@ static inline void common_semi_set_ret(CPUState *cs, target_ulong ret)
|
||||||
|
|
||||||
static inline bool common_semi_sys_exit_extended(CPUState *cs, int nr)
|
static inline bool common_semi_sys_exit_extended(CPUState *cs, int nr)
|
||||||
{
|
{
|
||||||
return (nr == TARGET_SYS_EXIT_EXTENDED || is_a64(cs->env_ptr));
|
return nr == TARGET_SYS_EXIT_EXTENDED || is_a64(cpu_env(cs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_64bit_semihosting(CPUArchState *env)
|
static inline bool is_64bit_semihosting(CPUArchState *env)
|
||||||
|
|
|
@ -80,7 +80,7 @@ void arm_cpu_synchronize_from_tb(CPUState *cs,
|
||||||
{
|
{
|
||||||
/* The program counter is always up to date with CF_PCREL. */
|
/* The program counter is always up to date with CF_PCREL. */
|
||||||
if (!(tb_cflags(tb) & CF_PCREL)) {
|
if (!(tb_cflags(tb) & CF_PCREL)) {
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
/*
|
/*
|
||||||
* It's OK to look at env for the current mode here, because it's
|
* It's OK to look at env for the current mode here, because it's
|
||||||
* never possible for an AArch64 TB to chain to an AArch32 TB.
|
* never possible for an AArch64 TB to chain to an AArch32 TB.
|
||||||
|
@ -97,7 +97,7 @@ void arm_restore_state_to_opc(CPUState *cs,
|
||||||
const TranslationBlock *tb,
|
const TranslationBlock *tb,
|
||||||
const uint64_t *data)
|
const uint64_t *data)
|
||||||
{
|
{
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
|
|
||||||
if (is_a64(env)) {
|
if (is_a64(env)) {
|
||||||
if (tb_cflags(tb) & CF_PCREL) {
|
if (tb_cflags(tb) & CF_PCREL) {
|
||||||
|
@ -560,7 +560,7 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
|
||||||
unsigned int cur_el, bool secure,
|
unsigned int cur_el, bool secure,
|
||||||
uint64_t hcr_el2)
|
uint64_t hcr_el2)
|
||||||
{
|
{
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
bool pstate_unmasked;
|
bool pstate_unmasked;
|
||||||
bool unmasked = false;
|
bool unmasked = false;
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
|
||||||
static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
uint32_t cur_el = arm_current_el(env);
|
uint32_t cur_el = arm_current_el(env);
|
||||||
bool secure = arm_is_secure(env);
|
bool secure = arm_is_secure(env);
|
||||||
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
|
uint64_t hcr_el2 = arm_hcr_el2_eff(env);
|
||||||
|
|
|
@ -10297,7 +10297,7 @@ static const int8_t target_el_table[2][2][2][2][2][4] = {
|
||||||
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
|
uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
|
||||||
uint32_t cur_el, bool secure)
|
uint32_t cur_el, bool secure)
|
||||||
{
|
{
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
bool rw;
|
bool rw;
|
||||||
bool scr;
|
bool scr;
|
||||||
bool hcr;
|
bool hcr;
|
||||||
|
|
|
@ -13982,7 +13982,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase,
|
||||||
CPUState *cpu)
|
CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUARMState *env = cpu->env_ptr;
|
CPUARMState *env = cpu_env(cpu);
|
||||||
ARMCPU *arm_cpu = env_archcpu(env);
|
ARMCPU *arm_cpu = env_archcpu(env);
|
||||||
CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb);
|
CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb);
|
||||||
int bound, core_mmu_idx;
|
int bound, core_mmu_idx;
|
||||||
|
@ -14089,7 +14089,7 @@ static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *s = container_of(dcbase, DisasContext, base);
|
DisasContext *s = container_of(dcbase, DisasContext, base);
|
||||||
CPUARMState *env = cpu->env_ptr;
|
CPUARMState *env = cpu_env(cpu);
|
||||||
uint64_t pc = s->base.pc_next;
|
uint64_t pc = s->base.pc_next;
|
||||||
uint32_t insn;
|
uint32_t insn;
|
||||||
|
|
||||||
|
|
|
@ -9089,7 +9089,7 @@ static bool insn_crosses_page(CPUARMState *env, DisasContext *s)
|
||||||
static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUARMState *env = cs->env_ptr;
|
CPUARMState *env = cpu_env(cs);
|
||||||
ARMCPU *cpu = env_archcpu(env);
|
ARMCPU *cpu = env_archcpu(env);
|
||||||
CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb);
|
CPUARMTBFlags tb_flags = arm_tbflags_from_tb(dc->base.tb);
|
||||||
uint32_t condexec, core_mmu_idx;
|
uint32_t condexec, core_mmu_idx;
|
||||||
|
@ -9317,7 +9317,7 @@ static void arm_post_translate_insn(DisasContext *dc)
|
||||||
static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUARMState *env = cpu->env_ptr;
|
CPUARMState *env = cpu_env(cpu);
|
||||||
uint32_t pc = dc->base.pc_next;
|
uint32_t pc = dc->base.pc_next;
|
||||||
unsigned int insn;
|
unsigned int insn;
|
||||||
|
|
||||||
|
@ -9407,7 +9407,7 @@ static bool thumb_insn_is_unconditional(DisasContext *s, uint32_t insn)
|
||||||
static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUARMState *env = cpu->env_ptr;
|
CPUARMState *env = cpu_env(cpu);
|
||||||
uint32_t pc = dc->base.pc_next;
|
uint32_t pc = dc->base.pc_next;
|
||||||
uint32_t insn;
|
uint32_t insn;
|
||||||
bool is_16bit;
|
bool is_16bit;
|
||||||
|
|
|
@ -2657,7 +2657,7 @@ static bool canonicalize_skip(DisasContext *ctx)
|
||||||
static void avr_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void avr_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUAVRState *env = cs->env_ptr;
|
CPUAVRState *env = cpu_env(cs);
|
||||||
uint32_t tb_flags = ctx->base.tb->flags;
|
uint32_t tb_flags = ctx->base.tb->flags;
|
||||||
|
|
||||||
ctx->cs = cs;
|
ctx->cs = cs;
|
||||||
|
|
|
@ -2948,7 +2948,7 @@ static unsigned int crisv32_decoder(CPUCRISState *env, DisasContext *dc)
|
||||||
static void cris_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void cris_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUCRISState *env = cs->env_ptr;
|
CPUCRISState *env = cpu_env(cs);
|
||||||
uint32_t tb_flags = dc->base.tb->flags;
|
uint32_t tb_flags = dc->base.tb->flags;
|
||||||
uint32_t pc_start;
|
uint32_t pc_start;
|
||||||
|
|
||||||
|
@ -3006,7 +3006,7 @@ static void cris_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUCRISState *env = cs->env_ptr;
|
CPUCRISState *env = cpu_env(cs);
|
||||||
unsigned int insn_len;
|
unsigned int insn_len;
|
||||||
|
|
||||||
/* Pretty disas. */
|
/* Pretty disas. */
|
||||||
|
|
|
@ -1053,7 +1053,7 @@ static void hexagon_tr_init_disas_context(DisasContextBase *dcbase,
|
||||||
CPUState *cs)
|
CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
HexagonCPU *hex_cpu = env_archcpu(cs->env_ptr);
|
HexagonCPU *hex_cpu = env_archcpu(cpu_env(cs));
|
||||||
uint32_t hex_flags = dcbase->tb->flags;
|
uint32_t hex_flags = dcbase->tb->flags;
|
||||||
|
|
||||||
ctx->mem_idx = MMU_USER_IDX;
|
ctx->mem_idx = MMU_USER_IDX;
|
||||||
|
@ -1094,7 +1094,7 @@ static bool pkt_crosses_page(CPUHexagonState *env, DisasContext *ctx)
|
||||||
static void hexagon_tr_translate_packet(DisasContextBase *dcbase, CPUState *cpu)
|
static void hexagon_tr_translate_packet(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUHexagonState *env = cpu->env_ptr;
|
CPUHexagonState *env = cpu_env(cpu);
|
||||||
|
|
||||||
decode_and_translate_packet(env, ctx);
|
decode_and_translate_packet(env, ctx);
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,7 @@ void HELPER(itlbp)(CPUHPPAState *env, target_ulong addr, target_ureg reg)
|
||||||
synchronous across all processors. */
|
synchronous across all processors. */
|
||||||
static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
|
static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
|
||||||
{
|
{
|
||||||
CPUHPPAState *env = cpu->env_ptr;
|
CPUHPPAState *env = cpu_env(cpu);
|
||||||
target_ulong addr = (target_ulong) data.target_ptr;
|
target_ulong addr = (target_ulong) data.target_ptr;
|
||||||
hppa_tlb_entry *ent = hppa_find_tlb(env, addr);
|
hppa_tlb_entry *ent = hppa_find_tlb(env, addr);
|
||||||
|
|
||||||
|
|
|
@ -3450,7 +3450,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a)
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
if (ctx->tb_flags & PSW_C) {
|
if (ctx->tb_flags & PSW_C) {
|
||||||
CPUHPPAState *env = ctx->cs->env_ptr;
|
CPUHPPAState *env = cpu_env(ctx->cs);
|
||||||
int type = hppa_artype_for_page(env, ctx->base.pc_next);
|
int type = hppa_artype_for_page(env, ctx->base.pc_next);
|
||||||
/* If we could not find a TLB entry, then we need to generate an
|
/* If we could not find a TLB entry, then we need to generate an
|
||||||
ITLB miss exception so the kernel will provide it.
|
ITLB miss exception so the kernel will provide it.
|
||||||
|
@ -4119,7 +4119,7 @@ static void hppa_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
|
||||||
static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void hppa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUHPPAState *env = cs->env_ptr;
|
CPUHPPAState *env = cpu_env(cs);
|
||||||
DisasJumpType ret;
|
DisasJumpType ret;
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ nvmm_set_segment(struct nvmm_x64_state_seg *nseg, const SegmentCache *qseg)
|
||||||
static void
|
static void
|
||||||
nvmm_set_registers(CPUState *cpu)
|
nvmm_set_registers(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
struct nvmm_machine *mach = get_nvmm_mach();
|
struct nvmm_machine *mach = get_nvmm_mach();
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||||
|
@ -215,7 +215,7 @@ nvmm_get_segment(SegmentCache *qseg, const struct nvmm_x64_state_seg *nseg)
|
||||||
static void
|
static void
|
||||||
nvmm_get_registers(CPUState *cpu)
|
nvmm_get_registers(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
struct nvmm_machine *mach = get_nvmm_mach();
|
struct nvmm_machine *mach = get_nvmm_mach();
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||||
|
@ -340,7 +340,7 @@ nvmm_get_registers(CPUState *cpu)
|
||||||
static bool
|
static bool
|
||||||
nvmm_can_take_int(CPUState *cpu)
|
nvmm_can_take_int(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||||
struct nvmm_machine *mach = get_nvmm_mach();
|
struct nvmm_machine *mach = get_nvmm_mach();
|
||||||
|
@ -387,7 +387,7 @@ nvmm_can_take_nmi(CPUState *cpu)
|
||||||
static void
|
static void
|
||||||
nvmm_vcpu_pre_run(CPUState *cpu)
|
nvmm_vcpu_pre_run(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
struct nvmm_machine *mach = get_nvmm_mach();
|
struct nvmm_machine *mach = get_nvmm_mach();
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||||
|
@ -473,8 +473,8 @@ static void
|
||||||
nvmm_vcpu_post_run(CPUState *cpu, struct nvmm_vcpu_exit *exit)
|
nvmm_vcpu_post_run(CPUState *cpu, struct nvmm_vcpu_exit *exit)
|
||||||
{
|
{
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
uint64_t tpr;
|
uint64_t tpr;
|
||||||
|
|
||||||
env->eflags = exit->exitstate.rflags;
|
env->eflags = exit->exitstate.rflags;
|
||||||
|
@ -645,7 +645,7 @@ static int
|
||||||
nvmm_handle_halted(struct nvmm_machine *mach, CPUState *cpu,
|
nvmm_handle_halted(struct nvmm_machine *mach, CPUState *cpu,
|
||||||
struct nvmm_vcpu_exit *exit)
|
struct nvmm_vcpu_exit *exit)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
|
@ -678,11 +678,11 @@ nvmm_inject_ud(struct nvmm_machine *mach, struct nvmm_vcpu *vcpu)
|
||||||
static int
|
static int
|
||||||
nvmm_vcpu_loop(CPUState *cpu)
|
nvmm_vcpu_loop(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
struct nvmm_machine *mach = get_nvmm_mach();
|
struct nvmm_machine *mach = get_nvmm_mach();
|
||||||
AccelCPUState *qcpu = cpu->accel;
|
AccelCPUState *qcpu = cpu->accel;
|
||||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
struct nvmm_vcpu_exit *exit = vcpu->exit;
|
struct nvmm_vcpu_exit *exit = vcpu->exit;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -1595,7 +1595,7 @@ illegal:
|
||||||
*/
|
*/
|
||||||
static void disas_insn_new(DisasContext *s, CPUState *cpu, int b)
|
static void disas_insn_new(DisasContext *s, CPUState *cpu, int b)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
bool first = true;
|
bool first = true;
|
||||||
X86DecodedInsn decode;
|
X86DecodedInsn decode;
|
||||||
X86DecodeFunc decode_func = decode_root;
|
X86DecodeFunc decode_func = decode_root;
|
||||||
|
|
|
@ -597,7 +597,7 @@ bool x86_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
||||||
MMUAccessType access_type, int mmu_idx,
|
MMUAccessType access_type, int mmu_idx,
|
||||||
bool probe, uintptr_t retaddr)
|
bool probe, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cs->env_ptr;
|
CPUX86State *env = cpu_env(cs);
|
||||||
TranslateResult out;
|
TranslateResult out;
|
||||||
TranslateFault err;
|
TranslateFault err;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
|
||||||
{
|
{
|
||||||
/* The instruction pointer is always up to date with CF_PCREL. */
|
/* The instruction pointer is always up to date with CF_PCREL. */
|
||||||
if (!(tb_cflags(tb) & CF_PCREL)) {
|
if (!(tb_cflags(tb) & CF_PCREL)) {
|
||||||
CPUX86State *env = cs->env_ptr;
|
CPUX86State *env = cpu_env(cs);
|
||||||
env->eip = tb->pc - tb->cs_base;
|
env->eip = tb->pc - tb->cs_base;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3079,7 +3079,7 @@ static void gen_cmpxchg16b(DisasContext *s, CPUX86State *env, int modrm)
|
||||||
be stopped. Return the next pc value */
|
be stopped. Return the next pc value */
|
||||||
static bool disas_insn(DisasContext *s, CPUState *cpu)
|
static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
int b, prefixes;
|
int b, prefixes;
|
||||||
int shift;
|
int shift;
|
||||||
MemOp ot, aflag, dflag;
|
MemOp ot, aflag, dflag;
|
||||||
|
@ -6918,7 +6918,7 @@ void tcg_x86_init(void)
|
||||||
static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
uint32_t flags = dc->base.tb->flags;
|
uint32_t flags = dc->base.tb->flags;
|
||||||
uint32_t cflags = tb_cflags(dc->base.tb);
|
uint32_t cflags = tb_cflags(dc->base.tb);
|
||||||
int cpl = (flags >> HF_CPL_SHIFT) & 3;
|
int cpl = (flags >> HF_CPL_SHIFT) & 3;
|
||||||
|
|
|
@ -300,7 +300,7 @@ static SegmentCache whpx_seg_h2q(const WHV_X64_SEGMENT_REGISTER *hs)
|
||||||
/* X64 Extended Control Registers */
|
/* X64 Extended Control Registers */
|
||||||
static void whpx_set_xcrs(CPUState *cpu)
|
static void whpx_set_xcrs(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
WHV_REGISTER_VALUE xcr0;
|
WHV_REGISTER_VALUE xcr0;
|
||||||
|
@ -321,7 +321,7 @@ static void whpx_set_xcrs(CPUState *cpu)
|
||||||
|
|
||||||
static int whpx_set_tsc(CPUState *cpu)
|
static int whpx_set_tsc(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||||
WHV_REGISTER_VALUE tsc_val;
|
WHV_REGISTER_VALUE tsc_val;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -382,8 +382,8 @@ static void whpx_set_registers(CPUState *cpu, int level)
|
||||||
{
|
{
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
AccelCPUState *vcpu = cpu->accel;
|
AccelCPUState *vcpu = cpu->accel;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
struct whpx_register_set vcxt;
|
struct whpx_register_set vcxt;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
int idx;
|
int idx;
|
||||||
|
@ -556,7 +556,7 @@ static void whpx_set_registers(CPUState *cpu, int level)
|
||||||
|
|
||||||
static int whpx_get_tsc(CPUState *cpu)
|
static int whpx_get_tsc(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||||
WHV_REGISTER_VALUE tsc_val;
|
WHV_REGISTER_VALUE tsc_val;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -576,7 +576,7 @@ static int whpx_get_tsc(CPUState *cpu)
|
||||||
/* X64 Extended Control Registers */
|
/* X64 Extended Control Registers */
|
||||||
static void whpx_get_xcrs(CPUState *cpu)
|
static void whpx_get_xcrs(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
WHV_REGISTER_VALUE xcr0;
|
WHV_REGISTER_VALUE xcr0;
|
||||||
|
@ -601,8 +601,8 @@ static void whpx_get_registers(CPUState *cpu)
|
||||||
{
|
{
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
AccelCPUState *vcpu = cpu->accel;
|
AccelCPUState *vcpu = cpu->accel;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
struct whpx_register_set vcxt;
|
struct whpx_register_set vcxt;
|
||||||
uint64_t tpr, apic_base;
|
uint64_t tpr, apic_base;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -1400,7 +1400,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
||||||
{
|
{
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->vcpu_dirty) {
|
||||||
/* The CPU registers have been modified by other parts of QEMU. */
|
/* The CPU registers have been modified by other parts of QEMU. */
|
||||||
CPUArchState *env = (CPUArchState *)(cpu->env_ptr);
|
CPUArchState *env = cpu_env(cpu);
|
||||||
return env->eip;
|
return env->eip;
|
||||||
} else if (exit_context_valid) {
|
} else if (exit_context_valid) {
|
||||||
/*
|
/*
|
||||||
|
@ -1439,7 +1439,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
||||||
|
|
||||||
static int whpx_handle_halt(CPUState *cpu)
|
static int whpx_handle_halt(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
CPUX86State *env = cpu_env(cpu);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
|
@ -1460,8 +1460,8 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
AccelCPUState *vcpu = cpu->accel;
|
AccelCPUState *vcpu = cpu->accel;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
int irq;
|
int irq;
|
||||||
uint8_t tpr;
|
uint8_t tpr;
|
||||||
WHV_X64_PENDING_INTERRUPTION_REGISTER new_int;
|
WHV_X64_PENDING_INTERRUPTION_REGISTER new_int;
|
||||||
|
@ -1582,8 +1582,8 @@ static void whpx_vcpu_pre_run(CPUState *cpu)
|
||||||
static void whpx_vcpu_post_run(CPUState *cpu)
|
static void whpx_vcpu_post_run(CPUState *cpu)
|
||||||
{
|
{
|
||||||
AccelCPUState *vcpu = cpu->accel;
|
AccelCPUState *vcpu = cpu->accel;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
|
|
||||||
env->eflags = vcpu->exit_ctx.VpContext.Rflags;
|
env->eflags = vcpu->exit_ctx.VpContext.Rflags;
|
||||||
|
|
||||||
|
@ -1606,8 +1606,8 @@ static void whpx_vcpu_post_run(CPUState *cpu)
|
||||||
|
|
||||||
static void whpx_vcpu_process_async_events(CPUState *cpu)
|
static void whpx_vcpu_process_async_events(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
AccelCPUState *vcpu = cpu->accel;
|
AccelCPUState *vcpu = cpu->accel;
|
||||||
|
|
||||||
if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) &&
|
if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) &&
|
||||||
|
@ -2147,8 +2147,8 @@ int whpx_init_vcpu(CPUState *cpu)
|
||||||
struct whpx_state *whpx = &whpx_global;
|
struct whpx_state *whpx = &whpx_global;
|
||||||
AccelCPUState *vcpu = NULL;
|
AccelCPUState *vcpu = NULL;
|
||||||
Error *local_error = NULL;
|
Error *local_error = NULL;
|
||||||
CPUX86State *env = cpu->env_ptr;
|
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
|
CPUX86State *env = &x86_cpu->env;
|
||||||
UINT64 freq = 0;
|
UINT64 freq = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2245,7 +2245,7 @@ int whpx_init_vcpu(CPUState *cpu)
|
||||||
cpu->vcpu_dirty = true;
|
cpu->vcpu_dirty = true;
|
||||||
cpu->accel = vcpu;
|
cpu->accel = vcpu;
|
||||||
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
|
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
|
||||||
qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr);
|
qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ static void loongarch_tr_init_disas_context(DisasContextBase *dcbase,
|
||||||
CPUState *cs)
|
CPUState *cs)
|
||||||
{
|
{
|
||||||
int64_t bound;
|
int64_t bound;
|
||||||
CPULoongArchState *env = cs->env_ptr;
|
CPULoongArchState *env = cpu_env(cs);
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
|
|
||||||
ctx->page_start = ctx->base.pc_first & TARGET_PAGE_MASK;
|
ctx->page_start = ctx->base.pc_first & TARGET_PAGE_MASK;
|
||||||
|
@ -282,7 +282,7 @@ static uint64_t make_address_pc(DisasContext *ctx, uint64_t addr)
|
||||||
|
|
||||||
static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
CPULoongArchState *env = cs->env_ptr;
|
CPULoongArchState *env = cpu_env(cs);
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
|
|
||||||
ctx->opcode = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
ctx->opcode = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
||||||
|
|
|
@ -5990,7 +5990,7 @@ void register_m68k_insns (CPUM68KState *env)
|
||||||
static void m68k_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
static void m68k_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUM68KState *env = cpu->env_ptr;
|
CPUM68KState *env = cpu_env(cpu);
|
||||||
|
|
||||||
dc->env = env;
|
dc->env = env;
|
||||||
dc->pc = dc->base.pc_first;
|
dc->pc = dc->base.pc_first;
|
||||||
|
@ -6021,7 +6021,7 @@ static void m68k_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void m68k_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void m68k_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUM68KState *env = cpu->env_ptr;
|
CPUM68KState *env = cpu_env(cpu);
|
||||||
uint16_t insn = read_im16(env, dc);
|
uint16_t insn = read_im16(env, dc);
|
||||||
|
|
||||||
opcode_table[insn](env, dc, insn);
|
opcode_table[insn](env, dc, insn);
|
||||||
|
|
|
@ -1630,7 +1630,7 @@ static void mb_tr_insn_start(DisasContextBase *dcb, CPUState *cs)
|
||||||
static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs)
|
static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcb, DisasContext, base);
|
DisasContext *dc = container_of(dcb, DisasContext, base);
|
||||||
CPUMBState *env = cs->env_ptr;
|
CPUMBState *env = cpu_env(cs);
|
||||||
uint32_t ir;
|
uint32_t ir;
|
||||||
|
|
||||||
/* TODO: This should raise an exception, not terminate qemu. */
|
/* TODO: This should raise an exception, not terminate qemu. */
|
||||||
|
|
|
@ -126,7 +126,7 @@ static void report_fault(CPUMIPSState *env)
|
||||||
|
|
||||||
static void uhi_cb(CPUState *cs, uint64_t ret, int err)
|
static void uhi_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
{
|
{
|
||||||
CPUMIPSState *env = cs->env_ptr;
|
CPUMIPSState *env = cpu_env(cs);
|
||||||
|
|
||||||
#define E(N) case E##N: err = UHI_E##N; break
|
#define E(N) case E##N: err = UHI_E##N; break
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ static void uhi_fstat_cb(CPUState *cs, uint64_t ret, int err)
|
||||||
QEMU_BUILD_BUG_ON(sizeof(UHIStat) < sizeof(struct gdb_stat));
|
QEMU_BUILD_BUG_ON(sizeof(UHIStat) < sizeof(struct gdb_stat));
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
CPUMIPSState *env = cs->env_ptr;
|
CPUMIPSState *env = cpu_env(cs);
|
||||||
target_ulong addr = env->active_tc.gpr[5];
|
target_ulong addr = env->active_tc.gpr[5];
|
||||||
UHIStat *dst = lock_user(VERIFY_WRITE, addr, sizeof(UHIStat), 1);
|
UHIStat *dst = lock_user(VERIFY_WRITE, addr, sizeof(UHIStat), 1);
|
||||||
struct gdb_stat s;
|
struct gdb_stat s;
|
||||||
|
|
|
@ -15376,7 +15376,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
|
||||||
static void mips_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void mips_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUMIPSState *env = cs->env_ptr;
|
CPUMIPSState *env = cpu_env(cs);
|
||||||
|
|
||||||
ctx->page_start = ctx->base.pc_first & TARGET_PAGE_MASK;
|
ctx->page_start = ctx->base.pc_first & TARGET_PAGE_MASK;
|
||||||
ctx->saved_pc = -1;
|
ctx->saved_pc = -1;
|
||||||
|
@ -15447,7 +15447,7 @@ static void mips_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
|
||||||
|
|
||||||
static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
CPUMIPSState *env = cs->env_ptr;
|
CPUMIPSState *env = cpu_env(cs);
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
int insn_bytes;
|
int insn_bytes;
|
||||||
int is_slot;
|
int is_slot;
|
||||||
|
|
|
@ -944,7 +944,7 @@ static const char * const cr_regnames[NUM_CR_REGS] = {
|
||||||
static void nios2_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void nios2_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUNios2State *env = cs->env_ptr;
|
CPUNios2State *env = cpu_env(cs);
|
||||||
Nios2CPU *cpu = env_archcpu(env);
|
Nios2CPU *cpu = env_archcpu(env);
|
||||||
int page_insns;
|
int page_insns;
|
||||||
|
|
||||||
|
@ -970,7 +970,7 @@ static void nios2_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
|
||||||
static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void nios2_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUNios2State *env = cs->env_ptr;
|
CPUNios2State *env = cpu_env(cs);
|
||||||
const Nios2Instruction *instr;
|
const Nios2Instruction *instr;
|
||||||
uint32_t code, pc;
|
uint32_t code, pc;
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
|
|
|
@ -1525,7 +1525,7 @@ static bool trans_lf_sfun_d(DisasContext *dc, arg_ab_pair *a)
|
||||||
static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs)
|
static void openrisc_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcb, DisasContext, base);
|
DisasContext *dc = container_of(dcb, DisasContext, base);
|
||||||
CPUOpenRISCState *env = cs->env_ptr;
|
CPUOpenRISCState *env = cpu_env(cs);
|
||||||
int bound;
|
int bound;
|
||||||
|
|
||||||
dc->mem_idx = cpu_mmu_index(env, false);
|
dc->mem_idx = cpu_mmu_index(env, false);
|
||||||
|
|
|
@ -3189,7 +3189,7 @@ void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
|
||||||
MMUAccessType access_type,
|
MMUAccessType access_type,
|
||||||
int mmu_idx, uintptr_t retaddr)
|
int mmu_idx, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
uint32_t insn;
|
uint32_t insn;
|
||||||
|
|
||||||
/* Restore state and reload the insn we executed, for filling in DSISR. */
|
/* Restore state and reload the insn we executed, for filling in DSISR. */
|
||||||
|
@ -3220,7 +3220,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||||
int mmu_idx, MemTxAttrs attrs,
|
int mmu_idx, MemTxAttrs attrs,
|
||||||
MemTxResult response, uintptr_t retaddr)
|
MemTxResult response, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
|
|
||||||
switch (env->excp_model) {
|
switch (env->excp_model) {
|
||||||
#if defined(TARGET_PPC64)
|
#if defined(TARGET_PPC64)
|
||||||
|
@ -3264,7 +3264,7 @@ void ppc_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||||
void ppc_cpu_debug_excp_handler(CPUState *cs)
|
void ppc_cpu_debug_excp_handler(CPUState *cs)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_PPC64)
|
#if defined(TARGET_PPC64)
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
|
|
||||||
if (env->insns_flags2 & PPC2_ISA207S) {
|
if (env->insns_flags2 & PPC2_ISA207S) {
|
||||||
if (cs->watchpoint_hit) {
|
if (cs->watchpoint_hit) {
|
||||||
|
@ -3286,7 +3286,7 @@ void ppc_cpu_debug_excp_handler(CPUState *cs)
|
||||||
bool ppc_cpu_debug_check_breakpoint(CPUState *cs)
|
bool ppc_cpu_debug_check_breakpoint(CPUState *cs)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_PPC64)
|
#if defined(TARGET_PPC64)
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
|
|
||||||
if (env->insns_flags2 & PPC2_ISA207S) {
|
if (env->insns_flags2 & PPC2_ISA207S) {
|
||||||
target_ulong priv;
|
target_ulong priv;
|
||||||
|
@ -3313,7 +3313,7 @@ bool ppc_cpu_debug_check_breakpoint(CPUState *cs)
|
||||||
bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
|
bool ppc_cpu_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
|
||||||
{
|
{
|
||||||
#if defined(TARGET_PPC64)
|
#if defined(TARGET_PPC64)
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
|
|
||||||
if (env->insns_flags2 & PPC2_ISA207S) {
|
if (env->insns_flags2 & PPC2_ISA207S) {
|
||||||
if (wp == env->dawr0_watchpoint) {
|
if (wp == env->dawr0_watchpoint) {
|
||||||
|
|
|
@ -7320,7 +7320,7 @@ static bool decode_legacy(PowerPCCPU *cpu, DisasContext *ctx, uint32_t insn)
|
||||||
static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
uint32_t hflags = ctx->base.tb->flags;
|
uint32_t hflags = ctx->base.tb->flags;
|
||||||
|
|
||||||
ctx->spr_cb = env->spr_cb;
|
ctx->spr_cb = env->spr_cb;
|
||||||
|
@ -7384,7 +7384,7 @@ static void ppc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||||
CPUPPCState *env = cs->env_ptr;
|
CPUPPCState *env = cpu_env(cs);
|
||||||
target_ulong pc;
|
target_ulong pc;
|
||||||
uint32_t insn;
|
uint32_t insn;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUState *cpu = ctx->cs;
|
CPUState *cpu = ctx->cs;
|
||||||
CPURISCVState *env = cpu->env_ptr;
|
CPURISCVState *env = cpu_env(cpu);
|
||||||
|
|
||||||
return cpu_ldl_code(env, pc);
|
return cpu_ldl_code(env, pc);
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1166,7 @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
|
||||||
static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPURISCVState *env = cs->env_ptr;
|
CPURISCVState *env = cpu_env(cs);
|
||||||
RISCVCPU *cpu = RISCV_CPU(cs);
|
RISCVCPU *cpu = RISCV_CPU(cs);
|
||||||
uint32_t tb_flags = ctx->base.tb->flags;
|
uint32_t tb_flags = ctx->base.tb->flags;
|
||||||
|
|
||||||
|
@ -1219,7 +1219,7 @@ static void riscv_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPURISCVState *env = cpu->env_ptr;
|
CPURISCVState *env = cpu_env(cpu);
|
||||||
uint16_t opcode16 = translator_lduw(env, &ctx->base, ctx->base.pc_next);
|
uint16_t opcode16 = translator_lduw(env, &ctx->base, ctx->base.pc_next);
|
||||||
|
|
||||||
ctx->ol = ctx->xl;
|
ctx->ol = ctx->xl;
|
||||||
|
|
|
@ -183,12 +183,9 @@ static bool rx_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
||||||
|
|
||||||
static void rx_cpu_init(Object *obj)
|
static void rx_cpu_init(Object *obj)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(obj);
|
|
||||||
RXCPU *cpu = RX_CPU(obj);
|
RXCPU *cpu = RX_CPU(obj);
|
||||||
CPURXState *env = &cpu->env;
|
|
||||||
|
|
||||||
cpu_set_cpustate_pointers(cpu);
|
cpu_set_cpustate_pointers(cpu);
|
||||||
cs->env_ptr = env;
|
|
||||||
qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2);
|
qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2200,7 +2200,7 @@ static bool trans_WAIT(DisasContext *ctx, arg_WAIT *a)
|
||||||
|
|
||||||
static void rx_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void rx_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
CPURXState *env = cs->env_ptr;
|
CPURXState *env = cpu_env(cs);
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
ctx->env = env;
|
ctx->env = env;
|
||||||
ctx->tb_flags = ctx->base.tb->flags;
|
ctx->tb_flags = ctx->base.tb->flags;
|
||||||
|
|
|
@ -6463,7 +6463,7 @@ static target_ulong get_next_pc(CPUS390XState *env, DisasContext *s,
|
||||||
|
|
||||||
static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
CPUS390XState *env = cs->env_ptr;
|
CPUS390XState *env = cpu_env(cs);
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
|
|
||||||
dc->base.is_jmp = translate_one(env, dc);
|
dc->base.is_jmp = translate_one(env, dc);
|
||||||
|
|
|
@ -29,7 +29,7 @@ void superh_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
||||||
MMUAccessType access_type,
|
MMUAccessType access_type,
|
||||||
int mmu_idx, uintptr_t retaddr)
|
int mmu_idx, uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
CPUSH4State *env = cs->env_ptr;
|
CPUSH4State *env = cpu_env(cs);
|
||||||
|
|
||||||
env->tea = addr;
|
env->tea = addr;
|
||||||
switch (access_type) {
|
switch (access_type) {
|
||||||
|
|
|
@ -2179,7 +2179,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env)
|
||||||
static void sh4_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void sh4_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUSH4State *env = cs->env_ptr;
|
CPUSH4State *env = cpu_env(cs);
|
||||||
uint32_t tbflags;
|
uint32_t tbflags;
|
||||||
int bound;
|
int bound;
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ static void sh4_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
|
||||||
|
|
||||||
static void sh4_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void sh4_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
CPUSH4State *env = cs->env_ptr;
|
CPUSH4State *env = cpu_env(cs);
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
|
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifdef CONFIG_USER_ONLY
|
||||||
|
|
|
@ -5568,7 +5568,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
|
||||||
static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUSPARCState *env = cs->env_ptr;
|
CPUSPARCState *env = cpu_env(cs);
|
||||||
int bound;
|
int bound;
|
||||||
|
|
||||||
dc->pc = dc->base.pc_first;
|
dc->pc = dc->base.pc_first;
|
||||||
|
@ -5625,7 +5625,7 @@ static void sparc_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
|
||||||
static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
static void sparc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUSPARCState *env = cs->env_ptr;
|
CPUSPARCState *env = cpu_env(cs);
|
||||||
unsigned int insn;
|
unsigned int insn;
|
||||||
|
|
||||||
insn = translator_ldl(env, &dc->base, dc->pc);
|
insn = translator_ldl(env, &dc->base, dc->pc);
|
||||||
|
|
|
@ -8366,7 +8366,7 @@ static void tricore_tr_init_disas_context(DisasContextBase *dcbase,
|
||||||
CPUState *cs)
|
CPUState *cs)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUTriCoreState *env = cs->env_ptr;
|
CPUTriCoreState *env = cpu_env(cs);
|
||||||
ctx->mem_idx = cpu_mmu_index(env, false);
|
ctx->mem_idx = cpu_mmu_index(env, false);
|
||||||
|
|
||||||
uint32_t tb_flags = (uint32_t)ctx->base.tb->flags;
|
uint32_t tb_flags = (uint32_t)ctx->base.tb->flags;
|
||||||
|
@ -8411,7 +8411,7 @@ static bool insn_crosses_page(CPUTriCoreState *env, DisasContext *ctx)
|
||||||
static void tricore_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void tricore_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||||
CPUTriCoreState *env = cpu->env_ptr;
|
CPUTriCoreState *env = cpu_env(cpu);
|
||||||
uint16_t insn_lo;
|
uint16_t insn_lo;
|
||||||
bool is_16bit;
|
bool is_16bit;
|
||||||
|
|
||||||
|
|
|
@ -1140,7 +1140,7 @@ static void xtensa_tr_init_disas_context(DisasContextBase *dcbase,
|
||||||
CPUState *cpu)
|
CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUXtensaState *env = cpu->env_ptr;
|
CPUXtensaState *env = cpu_env(cpu);
|
||||||
uint32_t tb_flags = dc->base.tb->flags;
|
uint32_t tb_flags = dc->base.tb->flags;
|
||||||
|
|
||||||
dc->config = env->config;
|
dc->config = env->config;
|
||||||
|
@ -1180,7 +1180,7 @@ static void xtensa_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||||
{
|
{
|
||||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||||
CPUXtensaState *env = cpu->env_ptr;
|
CPUXtensaState *env = cpu_env(cpu);
|
||||||
target_ulong page_start;
|
target_ulong page_start;
|
||||||
|
|
||||||
/* These two conditions only apply to the first insn in the TB,
|
/* These two conditions only apply to the first insn in the TB,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue