Accelerators patches
A lot of trivial cleanups and simplifications (moving methods around, adding/removing #include statements). Most notable changes: - Rename NEED_CPU_H -> COMPILING_PER_TARGET - Rename few template headers using the '.h.inc' suffix - Extract some definitions / declarations into their own header: - accel/tcg/user-retaddr.h (helper_retaddr) - include/exec/abi_ptr.h (abi_ptr) - include/exec/breakpoint.h (CPUBreakpoint, CPUWatchpoint) - include/exec/mmu-access-type.h (MMUAccessType) - include/user/tswap-target.h (tswapl, bswaptls) -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmYsAuEACgkQ4+MsLN6t wN78Rg//V9UoE0U9Lh6Sd2WpcSAYP9D1CBa+iGXhrmel0utER1sQLu022nvcLdHc XtCgtX3H0yECF8dPX02rVp8IbSlOv3c8N/a6BxD79cRGqgXBYR/dEUqfXqeLJn3l a58YU3i7sLNQ0l7VnwTiBnI0lw170/xJl2B2mcR1SvWuH3dr5vTeIXNureu36ORo rc0oqWHbw1Pyyn8ADE2kPyFCOiwPwvcOvAk8dXGfib+mNCwNVV+ZUtAPi711VD8d 9VW2gu2sXwnWdpROrSugSw+aPVF4UjltL9qJEl5bxoqWFmlET1Zn2NpKvsocUXmh CMQQS2Tr4LpaaVQJGxx0yUe0B65X5+gCkIhsMOubED7GRyTCjrkOPm6exz3ge6WV YmIboggFAk3OjAzLs7yZVkWsTK1Y3+3eX0u7AWPUsUu7rCT/Toc6QxDS7eT2hJfq UDXI355PGbImgiArQa+OsT7v1Le4/iQa+TfN4fdUDpxEdfaxhnijWh+E91CEp+w/ Mq7db9Z1aMnhFKIKdkPYyfwB74yXQrmYchJ0QojZjbzqNGwkt9VeC7O9RcYjEaHM hMIexwccxexqGH22wn8vPd6ZVKtiLaG4AXO0v6Dn2YJ7/zb/ntcI6lRZqdBAHKNK MzkjTRRRR0wAfu8Lk8CaNNEqUP4Po43fbYymo6AZhIR8NqfApL0= =ifBx -----END PGP SIGNATURE----- Merge tag 'accel-20240426' of https://github.com/philmd/qemu into staging Accelerators patches A lot of trivial cleanups and simplifications (moving methods around, adding/removing #include statements). Most notable changes: - Rename NEED_CPU_H -> COMPILING_PER_TARGET - Rename few template headers using the '.h.inc' suffix - Extract some definitions / declarations into their own header: - accel/tcg/user-retaddr.h (helper_retaddr) - include/exec/abi_ptr.h (abi_ptr) - include/exec/breakpoint.h (CPUBreakpoint, CPUWatchpoint) - include/exec/mmu-access-type.h (MMUAccessType) - include/user/tswap-target.h (tswapl, bswaptls) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmYsAuEACgkQ4+MsLN6t # wN78Rg//V9UoE0U9Lh6Sd2WpcSAYP9D1CBa+iGXhrmel0utER1sQLu022nvcLdHc # XtCgtX3H0yECF8dPX02rVp8IbSlOv3c8N/a6BxD79cRGqgXBYR/dEUqfXqeLJn3l # a58YU3i7sLNQ0l7VnwTiBnI0lw170/xJl2B2mcR1SvWuH3dr5vTeIXNureu36ORo # rc0oqWHbw1Pyyn8ADE2kPyFCOiwPwvcOvAk8dXGfib+mNCwNVV+ZUtAPi711VD8d # 9VW2gu2sXwnWdpROrSugSw+aPVF4UjltL9qJEl5bxoqWFmlET1Zn2NpKvsocUXmh # CMQQS2Tr4LpaaVQJGxx0yUe0B65X5+gCkIhsMOubED7GRyTCjrkOPm6exz3ge6WV # YmIboggFAk3OjAzLs7yZVkWsTK1Y3+3eX0u7AWPUsUu7rCT/Toc6QxDS7eT2hJfq # UDXI355PGbImgiArQa+OsT7v1Le4/iQa+TfN4fdUDpxEdfaxhnijWh+E91CEp+w/ # Mq7db9Z1aMnhFKIKdkPYyfwB74yXQrmYchJ0QojZjbzqNGwkt9VeC7O9RcYjEaHM # hMIexwccxexqGH22wn8vPd6ZVKtiLaG4AXO0v6Dn2YJ7/zb/ntcI6lRZqdBAHKNK # MzkjTRRRR0wAfu8Lk8CaNNEqUP4Po43fbYymo6AZhIR8NqfApL0= # =ifBx # -----END PGP SIGNATURE----- # gpg: Signature made Fri 26 Apr 2024 12:39:13 PM PDT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] * tag 'accel-20240426' of https://github.com/philmd/qemu: (38 commits) plugins: Include missing 'qemu/bitmap.h' header hw/core: Avoid including the full 'hw/core/cpu.h' in 'tcg-cpu-ops.h' exec: Move CPUTLBEntry helpers to cputlb.c exec: Restrict inclusion of 'user/guest-base.h' exec: Rename 'exec/user/guest-base.h' as 'user/guest-base.h' exec: Restrict 'cpu_ldst.h' to TCG accelerator exec: Restrict TCG specific declarations of 'cputlb.h' exec: Declare CPUBreakpoint/CPUWatchpoint type in 'breakpoint.h' header exec: Declare MMUAccessType type in 'mmu-access-type.h' header exec: Declare abi_ptr type in its own 'abi_ptr.h' header exec/user: Do not include 'cpu.h' in 'abitypes.h' exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h' exec: Declare target_words_bigendian() in 'exec/tswap.h' exec/cpu-all: Remove unused tswapls() definitions exec/cpu-all: Remove unused 'qemu/thread.h' header exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion accel/hvf: Use accel-specific per-vcpu @dirty field accel/nvmm: Use accel-specific per-vcpu @dirty field accel/whpx: Use accel-specific per-vcpu @dirty field accel/tcg: Rename helper-head.h -> helper-head.h.inc ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
fd87be1dad
@ -3692,6 +3692,7 @@ Overall usermode emulation
|
|||||||
M: Riku Voipio <riku.voipio@iki.fi>
|
M: Riku Voipio <riku.voipio@iki.fi>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: accel/tcg/user-exec*.c
|
F: accel/tcg/user-exec*.c
|
||||||
|
F: include/exec/user/
|
||||||
F: include/user/
|
F: include/user/
|
||||||
F: common-user/
|
F: common-user/
|
||||||
|
|
||||||
|
@ -204,15 +204,15 @@ static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
|
|||||||
|
|
||||||
static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
static void do_hvf_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
if (!cpu->vcpu_dirty) {
|
if (!cpu->accel->dirty) {
|
||||||
hvf_get_registers(cpu);
|
hvf_get_registers(cpu);
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hvf_cpu_synchronize_state(CPUState *cpu)
|
static void hvf_cpu_synchronize_state(CPUState *cpu)
|
||||||
{
|
{
|
||||||
if (!cpu->vcpu_dirty) {
|
if (!cpu->accel->dirty) {
|
||||||
run_on_cpu(cpu, do_hvf_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
run_on_cpu(cpu, do_hvf_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ static void do_hvf_cpu_synchronize_set_dirty(CPUState *cpu,
|
|||||||
run_on_cpu_data arg)
|
run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
/* QEMU state is the reference, push it to HVF now and on next entry */
|
/* QEMU state is the reference, push it to HVF now and on next entry */
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hvf_cpu_synchronize_post_reset(CPUState *cpu)
|
static void hvf_cpu_synchronize_post_reset(CPUState *cpu)
|
||||||
@ -402,7 +402,7 @@ static int hvf_init_vcpu(CPUState *cpu)
|
|||||||
#else
|
#else
|
||||||
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->accel->fd, HV_VCPU_DEFAULT);
|
r = hv_vcpu_create((hv_vcpuid_t *)&cpu->accel->fd, HV_VCPU_DEFAULT);
|
||||||
#endif
|
#endif
|
||||||
cpu->vcpu_dirty = 1;
|
cpu->accel->dirty = true;
|
||||||
assert_hvf_ok(r);
|
assert_hvf_ok(r);
|
||||||
|
|
||||||
cpu->accel->guest_debug_enabled = false;
|
cpu->accel->guest_debug_enabled = false;
|
||||||
|
@ -18,10 +18,6 @@ void tb_flush(CPUState *cpu)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlb_set_dirty(CPUState *cpu, vaddr vaddr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int probe_access_flags(CPUArchState *env, vaddr addr, int size,
|
int probe_access_flags(CPUArchState *env, vaddr addr, int size,
|
||||||
MMUAccessType access_type, int mmu_idx,
|
MMUAccessType access_type, int mmu_idx,
|
||||||
bool nonfault, void **phost, uintptr_t retaddr)
|
bool nonfault, void **phost, uintptr_t retaddr)
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
#include "tb-context.h"
|
#include "tb-context.h"
|
||||||
#include "internal-common.h"
|
#include "internal-common.h"
|
||||||
#include "internal-target.h"
|
#include "internal-target.h"
|
||||||
|
#if defined(CONFIG_USER_ONLY)
|
||||||
|
#include "user-retaddr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* -icount align implementation. */
|
/* -icount align implementation. */
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include "exec/tb-flush.h"
|
#include "exec/tb-flush.h"
|
||||||
#include "exec/memory-internal.h"
|
#include "exec/memory-internal.h"
|
||||||
#include "exec/ram_addr.h"
|
#include "exec/ram_addr.h"
|
||||||
|
#include "exec/mmu-access-type.h"
|
||||||
|
#include "exec/tlb-common.h"
|
||||||
|
#include "exec/vaddr.h"
|
||||||
#include "tcg/tcg.h"
|
#include "tcg/tcg.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "exec/log.h"
|
#include "exec/log.h"
|
||||||
@ -95,6 +98,54 @@ static inline size_t sizeof_tlb(CPUTLBDescFast *fast)
|
|||||||
return fast->mask + (1 << CPU_TLB_ENTRY_BITS);
|
return fast->mask + (1 << CPU_TLB_ENTRY_BITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint64_t tlb_read_idx(const CPUTLBEntry *entry,
|
||||||
|
MMUAccessType access_type)
|
||||||
|
{
|
||||||
|
/* Do not rearrange the CPUTLBEntry structure members. */
|
||||||
|
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_read) !=
|
||||||
|
MMU_DATA_LOAD * sizeof(uint64_t));
|
||||||
|
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_write) !=
|
||||||
|
MMU_DATA_STORE * sizeof(uint64_t));
|
||||||
|
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_code) !=
|
||||||
|
MMU_INST_FETCH * sizeof(uint64_t));
|
||||||
|
|
||||||
|
#if TARGET_LONG_BITS == 32
|
||||||
|
/* Use qatomic_read, in case of addr_write; only care about low bits. */
|
||||||
|
const uint32_t *ptr = (uint32_t *)&entry->addr_idx[access_type];
|
||||||
|
ptr += HOST_BIG_ENDIAN;
|
||||||
|
return qatomic_read(ptr);
|
||||||
|
#else
|
||||||
|
const uint64_t *ptr = &entry->addr_idx[access_type];
|
||||||
|
# if TCG_OVERSIZED_GUEST
|
||||||
|
return *ptr;
|
||||||
|
# else
|
||||||
|
/* ofs might correspond to .addr_write, so use qatomic_read */
|
||||||
|
return qatomic_read(ptr);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry)
|
||||||
|
{
|
||||||
|
return tlb_read_idx(entry, MMU_DATA_STORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the TLB index corresponding to the mmu_idx + address pair. */
|
||||||
|
static inline uintptr_t tlb_index(CPUState *cpu, uintptr_t mmu_idx,
|
||||||
|
vaddr addr)
|
||||||
|
{
|
||||||
|
uintptr_t size_mask = cpu->neg.tlb.f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS;
|
||||||
|
|
||||||
|
return (addr >> TARGET_PAGE_BITS) & size_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the TLB entry corresponding to the mmu_idx + address pair. */
|
||||||
|
static inline CPUTLBEntry *tlb_entry(CPUState *cpu, uintptr_t mmu_idx,
|
||||||
|
vaddr addr)
|
||||||
|
{
|
||||||
|
return &cpu->neg.tlb.f[mmu_idx].table[tlb_index(cpu, mmu_idx, addr)];
|
||||||
|
}
|
||||||
|
|
||||||
static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns,
|
static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns,
|
||||||
size_t max_entries)
|
size_t max_entries)
|
||||||
{
|
{
|
||||||
@ -1039,7 +1090,7 @@ static inline void tlb_set_dirty1_locked(CPUTLBEntry *tlb_entry,
|
|||||||
|
|
||||||
/* update the TLB corresponding to virtual page vaddr
|
/* update the TLB corresponding to virtual page vaddr
|
||||||
so that it is no longer dirty */
|
so that it is no longer dirty */
|
||||||
void tlb_set_dirty(CPUState *cpu, vaddr addr)
|
static void tlb_set_dirty(CPUState *cpu, vaddr addr)
|
||||||
{
|
{
|
||||||
int mmu_idx;
|
int mmu_idx;
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
* See the COPYING file in the top-level directory.
|
* See the COPYING file in the top-level directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "host/load-extract-al16-al8.h"
|
#include "host/load-extract-al16-al8.h.inc"
|
||||||
#include "host/store-insert-al16.h"
|
#include "host/store-insert-al16.h.inc"
|
||||||
|
|
||||||
#ifdef CONFIG_ATOMIC64
|
#ifdef CONFIG_ATOMIC64
|
||||||
# define HAVE_al8 true
|
# define HAVE_al8 true
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
#ifndef ACCEL_TCG_TB_JMP_CACHE_H
|
#ifndef ACCEL_TCG_TB_JMP_CACHE_H
|
||||||
#define ACCEL_TCG_TB_JMP_CACHE_H
|
#define ACCEL_TCG_TB_JMP_CACHE_H
|
||||||
|
|
||||||
|
#include "qemu/rcu.h"
|
||||||
|
#include "exec/cpu-common.h"
|
||||||
|
|
||||||
#define TB_JMP_CACHE_BITS 12
|
#define TB_JMP_CACHE_BITS 12
|
||||||
#define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
|
#define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include "exec/tb-flush.h"
|
#include "exec/tb-flush.h"
|
||||||
#include "exec/gdbstub.h"
|
#include "exec/gdbstub.h"
|
||||||
|
|
||||||
|
#include "hw/core/cpu.h"
|
||||||
|
|
||||||
#include "tcg-accel-ops.h"
|
#include "tcg-accel-ops.h"
|
||||||
#include "tcg-accel-ops-mttcg.h"
|
#include "tcg-accel-ops-mttcg.h"
|
||||||
#include "tcg-accel-ops-rr.h"
|
#include "tcg-accel-ops-rr.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/translator.h"
|
#include "exec/translator.h"
|
||||||
|
#include "exec/cpu_ldst.h"
|
||||||
#include "exec/plugin-gen.h"
|
#include "exec/plugin-gen.h"
|
||||||
#include "tcg/tcg-op-common.h"
|
#include "tcg/tcg-op-common.h"
|
||||||
#include "internal-target.h"
|
#include "internal-target.h"
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "tcg/tcg-ldst.h"
|
#include "tcg/tcg-ldst.h"
|
||||||
#include "internal-common.h"
|
#include "internal-common.h"
|
||||||
#include "internal-target.h"
|
#include "internal-target.h"
|
||||||
|
#include "user-retaddr.h"
|
||||||
|
|
||||||
__thread uintptr_t helper_retaddr;
|
__thread uintptr_t helper_retaddr;
|
||||||
|
|
||||||
|
28
accel/tcg/user-retaddr.h
Normal file
28
accel/tcg/user-retaddr.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef ACCEL_TCG_USER_RETADDR_H
|
||||||
|
#define ACCEL_TCG_USER_RETADDR_H
|
||||||
|
|
||||||
|
#include "qemu/atomic.h"
|
||||||
|
|
||||||
|
extern __thread uintptr_t helper_retaddr;
|
||||||
|
|
||||||
|
static inline void set_helper_retaddr(uintptr_t ra)
|
||||||
|
{
|
||||||
|
helper_retaddr = ra;
|
||||||
|
/*
|
||||||
|
* Ensure that this write is visible to the SIGSEGV handler that
|
||||||
|
* may be invoked due to a subsequent invalid memory operation.
|
||||||
|
*/
|
||||||
|
signal_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void clear_helper_retaddr(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Ensure that previous memory operations have succeeded before
|
||||||
|
* removing the data visible to the signal handler.
|
||||||
|
*/
|
||||||
|
signal_barrier();
|
||||||
|
helper_retaddr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "target_arch_elf.h"
|
#include "target_arch_elf.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
#define bsd_get_ncpu() 1 /* until we pull in bsd-proc.[hc] */
|
#define bsd_get_ncpu() 1 /* until we pull in bsd-proc.[hc] */
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include "target_arch_sigtramp.h"
|
#include "target_arch_sigtramp.h"
|
||||||
#include "qemu/guest-random.h"
|
#include "qemu/guest-random.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The initial FreeBSD stack is as follows:
|
* The initial FreeBSD stack is as follows:
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "qemu/help_option.h"
|
#include "qemu/help_option.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
#include "user/guest-base.h"
|
||||||
#include "tcg/startup.h"
|
#include "tcg/startup.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/envlist.h"
|
#include "qemu/envlist.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "target_arch_elf.h"
|
#include "target_arch_elf.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
/* this flag is uneffective under linux too, should be deleted */
|
/* this flag is uneffective under linux too, should be deleted */
|
||||||
#ifndef MAP_DENYWRITE
|
#ifndef MAP_DENYWRITE
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "target_arch_elf.h"
|
#include "target_arch_elf.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
/* this flag is uneffective under linux too, should be deleted */
|
/* this flag is uneffective under linux too, should be deleted */
|
||||||
#ifndef MAP_DENYWRITE
|
#ifndef MAP_DENYWRITE
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
#include "gdbstub/user.h"
|
#include "gdbstub/user.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <sys/ioccom.h>
|
#include <sys/ioccom.h>
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
#include "os-strace.h" /* OS dependent strace print functions */
|
#include "os-strace.h" /* OS dependent strace print functions */
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
#include "sysemu/tcg.h"
|
#include "sysemu/tcg.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
#include "exec/replay-core.h"
|
#include "exec/replay-core.h"
|
||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "disas/disas.h"
|
#include "disas/disas.h"
|
||||||
#include "disas/capstone.h"
|
#include "disas/capstone.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
|
|
||||||
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "hw/cpu/cluster.h"
|
#include "hw/cpu/cluster.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "hw/core/cpu.h"
|
||||||
|
|
||||||
#include "sysemu/hw_accel.h"
|
#include "sysemu/hw_accel.h"
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "include/qemu/lockable.h"
|
#include "include/qemu/lockable.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/audio/virtio-snd.h"
|
#include "hw/audio/virtio-snd.h"
|
||||||
#include "hw/core/cpu.h"
|
|
||||||
|
|
||||||
#define VIRTIO_SOUND_VM_VERSION 1
|
#define VIRTIO_SOUND_VM_VERSION 1
|
||||||
#define VIRTIO_SOUND_JACK_DEFAULT 0
|
#define VIRTIO_SOUND_JACK_DEFAULT 0
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "exec/tswap.h"
|
||||||
#include "hw/core/sysemu-cpu-ops.h"
|
#include "hw/core/sysemu-cpu-ops.h"
|
||||||
|
|
||||||
bool cpu_paging_enabled(const CPUState *cpu)
|
bool cpu_paging_enabled(const CPUState *cpu)
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "exec/tswap.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "exec/tswap.h"
|
||||||
#include "hw/display/vga.h"
|
#include "hw/display/vga.h"
|
||||||
#include "hw/i386/x86.h"
|
#include "hw/i386/x86.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
#include "qom/object_interfaces.h"
|
#include "qom/object_interfaces.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
|
33
include/exec/abi_ptr.h
Normal file
33
include/exec/abi_ptr.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* QEMU abi_ptr type definitions
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
*/
|
||||||
|
#ifndef EXEC_ABI_PTR_H
|
||||||
|
#define EXEC_ABI_PTR_H
|
||||||
|
|
||||||
|
#include "cpu-param.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_USER_ONLY)
|
||||||
|
/*
|
||||||
|
* sparc32plus has 64bit long but 32bit space address
|
||||||
|
* this can make bad result with g2h() and h2g()
|
||||||
|
*/
|
||||||
|
#if TARGET_VIRT_ADDR_SPACE_BITS <= 32
|
||||||
|
typedef uint32_t abi_ptr;
|
||||||
|
#define TARGET_ABI_FMT_ptr "%x"
|
||||||
|
#else
|
||||||
|
typedef uint64_t abi_ptr;
|
||||||
|
#define TARGET_ABI_FMT_ptr "%"PRIx64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* !CONFIG_USER_ONLY */
|
||||||
|
|
||||||
|
#include "exec/target_long.h"
|
||||||
|
|
||||||
|
typedef target_ulong abi_ptr;
|
||||||
|
#define TARGET_ABI_FMT_ptr TARGET_FMT_lx
|
||||||
|
|
||||||
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
|
|
||||||
|
#endif
|
30
include/exec/breakpoint.h
Normal file
30
include/exec/breakpoint.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* QEMU breakpoint & watchpoint definitions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef EXEC_BREAKPOINT_H
|
||||||
|
#define EXEC_BREAKPOINT_H
|
||||||
|
|
||||||
|
#include "qemu/queue.h"
|
||||||
|
#include "exec/vaddr.h"
|
||||||
|
#include "exec/memattrs.h"
|
||||||
|
|
||||||
|
typedef struct CPUBreakpoint {
|
||||||
|
vaddr pc;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
QTAILQ_ENTRY(CPUBreakpoint) entry;
|
||||||
|
} CPUBreakpoint;
|
||||||
|
|
||||||
|
typedef struct CPUWatchpoint {
|
||||||
|
vaddr vaddr;
|
||||||
|
vaddr len;
|
||||||
|
vaddr hitaddr;
|
||||||
|
MemTxAttrs hitattrs;
|
||||||
|
int flags; /* BP_* */
|
||||||
|
QTAILQ_ENTRY(CPUWatchpoint) entry;
|
||||||
|
} CPUWatchpoint;
|
||||||
|
|
||||||
|
#endif
|
@ -22,9 +22,7 @@
|
|||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
#include "exec/tswap.h"
|
#include "exec/tswap.h"
|
||||||
#include "qemu/thread.h"
|
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
#include "qemu/rcu.h"
|
|
||||||
|
|
||||||
/* some important defines:
|
/* some important defines:
|
||||||
*
|
*
|
||||||
@ -38,16 +36,6 @@
|
|||||||
#define BSWAP_NEEDED
|
#define BSWAP_NEEDED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TARGET_LONG_SIZE == 4
|
|
||||||
#define tswapl(s) tswap32(s)
|
|
||||||
#define tswapls(s) tswap32s((uint32_t *)(s))
|
|
||||||
#define bswaptls(s) bswap32s(s)
|
|
||||||
#else
|
|
||||||
#define tswapl(s) tswap64(s)
|
|
||||||
#define tswapls(s) tswap64s((uint64_t *)(s))
|
|
||||||
#define bswaptls(s) bswap64s(s)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Target-endianness CPU memory access functions. These fit into the
|
/* Target-endianness CPU memory access functions. These fit into the
|
||||||
* {ld,st}{type}{sign}{size}{endian}_p naming scheme described in bswap.h.
|
* {ld,st}{type}{sign}{size}{endian}_p naming scheme described in bswap.h.
|
||||||
*/
|
*/
|
||||||
@ -77,9 +65,6 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
#include "exec/user/abitypes.h"
|
#include "exec/user/abitypes.h"
|
||||||
#include "exec/user/guest-base.h"
|
|
||||||
|
|
||||||
extern bool have_guest_base;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If non-zero, the guest virtual address space is a contiguous subset
|
* If non-zero, the guest virtual address space is a contiguous subset
|
||||||
@ -391,6 +376,7 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)
|
|||||||
#endif /* !CONFIG_USER_ONLY */
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
|
|
||||||
/* Validate correct placement of CPUArchState. */
|
/* Validate correct placement of CPUArchState. */
|
||||||
|
#include "cpu.h"
|
||||||
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
|
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
|
||||||
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
|
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef CPU_DEFS_H
|
#ifndef CPU_DEFS_H
|
||||||
#define CPU_DEFS_H
|
#define CPU_DEFS_H
|
||||||
|
|
||||||
#ifndef NEED_CPU_H
|
#ifndef COMPILING_PER_TARGET
|
||||||
#error cpu.h included from common code
|
#error cpu.h included from common code
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Software MMU support
|
* Software MMU support (per-target)
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -62,21 +62,18 @@
|
|||||||
#ifndef CPU_LDST_H
|
#ifndef CPU_LDST_H
|
||||||
#define CPU_LDST_H
|
#define CPU_LDST_H
|
||||||
|
|
||||||
|
#ifndef CONFIG_TCG
|
||||||
|
#error Can only include this header with TCG
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "exec/memopidx.h"
|
#include "exec/memopidx.h"
|
||||||
|
#include "exec/abi_ptr.h"
|
||||||
|
#include "exec/mmu-access-type.h"
|
||||||
#include "qemu/int128.h"
|
#include "qemu/int128.h"
|
||||||
#include "cpu.h"
|
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
/* sparc32plus has 64bit long but 32bit space address
|
|
||||||
* this can make bad result with g2h() and h2g()
|
#include "user/guest-base.h"
|
||||||
*/
|
|
||||||
#if TARGET_VIRT_ADDR_SPACE_BITS <= 32
|
|
||||||
typedef uint32_t abi_ptr;
|
|
||||||
#define TARGET_ABI_FMT_ptr "%x"
|
|
||||||
#else
|
|
||||||
typedef uint64_t abi_ptr;
|
|
||||||
#define TARGET_ABI_FMT_ptr "%"PRIx64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TARGET_TAGGED_ADDRESSES
|
#ifndef TARGET_TAGGED_ADDRESSES
|
||||||
static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x)
|
static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x)
|
||||||
@ -120,10 +117,8 @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len)
|
|||||||
assert(h2g_valid(x)); \
|
assert(h2g_valid(x)); \
|
||||||
h2g_nocheck(x); \
|
h2g_nocheck(x); \
|
||||||
})
|
})
|
||||||
#else
|
|
||||||
typedef vaddr abi_ptr;
|
#endif /* CONFIG_USER_ONLY */
|
||||||
#define TARGET_ABI_FMT_ptr VADDR_PRIx
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t cpu_ldub_data(CPUArchState *env, abi_ptr ptr);
|
uint32_t cpu_ldub_data(CPUArchState *env, abi_ptr ptr);
|
||||||
int cpu_ldsb_data(CPUArchState *env, abi_ptr ptr);
|
int cpu_ldsb_data(CPUArchState *env, abi_ptr ptr);
|
||||||
@ -300,84 +295,6 @@ Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, abi_ptr addr,
|
|||||||
Int128 cmpv, Int128 newv,
|
Int128 cmpv, Int128 newv,
|
||||||
MemOpIdx oi, uintptr_t retaddr);
|
MemOpIdx oi, uintptr_t retaddr);
|
||||||
|
|
||||||
#if defined(CONFIG_USER_ONLY)
|
|
||||||
|
|
||||||
extern __thread uintptr_t helper_retaddr;
|
|
||||||
|
|
||||||
static inline void set_helper_retaddr(uintptr_t ra)
|
|
||||||
{
|
|
||||||
helper_retaddr = ra;
|
|
||||||
/*
|
|
||||||
* Ensure that this write is visible to the SIGSEGV handler that
|
|
||||||
* may be invoked due to a subsequent invalid memory operation.
|
|
||||||
*/
|
|
||||||
signal_barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void clear_helper_retaddr(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Ensure that previous memory operations have succeeded before
|
|
||||||
* removing the data visible to the signal handler.
|
|
||||||
*/
|
|
||||||
signal_barrier();
|
|
||||||
helper_retaddr = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include "tcg/oversized-guest.h"
|
|
||||||
|
|
||||||
static inline uint64_t tlb_read_idx(const CPUTLBEntry *entry,
|
|
||||||
MMUAccessType access_type)
|
|
||||||
{
|
|
||||||
/* Do not rearrange the CPUTLBEntry structure members. */
|
|
||||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_read) !=
|
|
||||||
MMU_DATA_LOAD * sizeof(uint64_t));
|
|
||||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_write) !=
|
|
||||||
MMU_DATA_STORE * sizeof(uint64_t));
|
|
||||||
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_code) !=
|
|
||||||
MMU_INST_FETCH * sizeof(uint64_t));
|
|
||||||
|
|
||||||
#if TARGET_LONG_BITS == 32
|
|
||||||
/* Use qatomic_read, in case of addr_write; only care about low bits. */
|
|
||||||
const uint32_t *ptr = (uint32_t *)&entry->addr_idx[access_type];
|
|
||||||
ptr += HOST_BIG_ENDIAN;
|
|
||||||
return qatomic_read(ptr);
|
|
||||||
#else
|
|
||||||
const uint64_t *ptr = &entry->addr_idx[access_type];
|
|
||||||
# if TCG_OVERSIZED_GUEST
|
|
||||||
return *ptr;
|
|
||||||
# else
|
|
||||||
/* ofs might correspond to .addr_write, so use qatomic_read */
|
|
||||||
return qatomic_read(ptr);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry)
|
|
||||||
{
|
|
||||||
return tlb_read_idx(entry, MMU_DATA_STORE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the TLB index corresponding to the mmu_idx + address pair. */
|
|
||||||
static inline uintptr_t tlb_index(CPUState *cpu, uintptr_t mmu_idx,
|
|
||||||
vaddr addr)
|
|
||||||
{
|
|
||||||
uintptr_t size_mask = cpu->neg.tlb.f[mmu_idx].mask >> CPU_TLB_ENTRY_BITS;
|
|
||||||
|
|
||||||
return (addr >> TARGET_PAGE_BITS) & size_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the TLB entry corresponding to the mmu_idx + address pair. */
|
|
||||||
static inline CPUTLBEntry *tlb_entry(CPUState *cpu, uintptr_t mmu_idx,
|
|
||||||
vaddr addr)
|
|
||||||
{
|
|
||||||
return &cpu->neg.tlb.f[mmu_idx].table[tlb_index(cpu, mmu_idx, addr)];
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(CONFIG_USER_ONLY) */
|
|
||||||
|
|
||||||
#if TARGET_BIG_ENDIAN
|
#if TARGET_BIG_ENDIAN
|
||||||
# define cpu_lduw_data cpu_lduw_be_data
|
# define cpu_lduw_data cpu_lduw_be_data
|
||||||
# define cpu_ldsw_data cpu_ldsw_be_data
|
# define cpu_ldsw_data cpu_ldsw_be_data
|
||||||
|
@ -22,9 +22,14 @@
|
|||||||
|
|
||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_TCG
|
||||||
|
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
/* cputlb.c */
|
/* cputlb.c */
|
||||||
void tlb_protect_code(ram_addr_t ram_addr);
|
void tlb_protect_code(ram_addr_t ram_addr);
|
||||||
void tlb_unprotect_code(ram_addr_t ram_addr);
|
void tlb_unprotect_code(ram_addr_t ram_addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_TCG */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,8 +22,10 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#if defined(CONFIG_USER_ONLY)
|
#if defined(CONFIG_USER_ONLY)
|
||||||
|
#include "exec/abi_ptr.h"
|
||||||
#include "exec/cpu_ldst.h"
|
#include "exec/cpu_ldst.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "exec/mmu-access-type.h"
|
||||||
#include "exec/translation-block.h"
|
#include "exec/translation-block.h"
|
||||||
#include "qemu/clang-tsa.h"
|
#include "qemu/clang-tsa.h"
|
||||||
|
|
||||||
@ -654,7 +656,6 @@ static inline void mmap_unlock(void) {}
|
|||||||
#define WITH_MMAP_LOCK_GUARD()
|
#define WITH_MMAP_LOCK_GUARD()
|
||||||
|
|
||||||
void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length);
|
void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length);
|
||||||
void tlb_set_dirty(CPUState *cpu, vaddr addr);
|
|
||||||
void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
|
void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
|
||||||
|
|
||||||
MemoryRegionSection *
|
MemoryRegionSection *
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "tcg/tcg.h"
|
#include "tcg/tcg.h"
|
||||||
#include "tcg/helper-info.h"
|
#include "tcg/helper-info.h"
|
||||||
#include "exec/helper-head.h"
|
#include "exec/helper-head.h.inc"
|
||||||
|
|
||||||
#define DEF_HELPER_FLAGS_0(name, flags, ret) \
|
#define DEF_HELPER_FLAGS_0(name, flags, ret) \
|
||||||
extern TCGHelperInfo glue(helper_info_, name); \
|
extern TCGHelperInfo glue(helper_info_, name); \
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#define dh_ctype_noreturn G_NORETURN void
|
#define dh_ctype_noreturn G_NORETURN void
|
||||||
#define dh_ctype(t) dh_ctype_##t
|
#define dh_ctype(t) dh_ctype_##t
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
# ifdef TARGET_LONG_BITS
|
# ifdef TARGET_LONG_BITS
|
||||||
# if TARGET_LONG_BITS == 32
|
# if TARGET_LONG_BITS == 32
|
||||||
# define dh_alias_tl i32
|
# define dh_alias_tl i32
|
||||||
@ -54,7 +54,7 @@
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# define dh_ctype_tl target_ulong
|
# define dh_ctype_tl target_ulong
|
||||||
#endif
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
/* We can't use glue() here because it falls foul of C preprocessor
|
/* We can't use glue() here because it falls foul of C preprocessor
|
||||||
recursive expansion rules. */
|
recursive expansion rules. */
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "tcg/tcg.h"
|
#include "tcg/tcg.h"
|
||||||
#include "tcg/helper-info.h"
|
#include "tcg/helper-info.h"
|
||||||
#include "exec/helper-head.h"
|
#include "exec/helper-head.h.inc"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need one more level of indirection before stringification
|
* Need one more level of indirection before stringification
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Define HELPER_H for the header file to be expanded.
|
* Define HELPER_H for the header file to be expanded.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "exec/helper-head.h"
|
#include "exec/helper-head.h.inc"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Work around an issue with --enable-lto, in which GCC's ipa-split pass
|
* Work around an issue with --enable-lto, in which GCC's ipa-split pass
|
||||||
|
@ -35,7 +35,7 @@ typedef enum MemOp {
|
|||||||
MO_LE = 0,
|
MO_LE = 0,
|
||||||
MO_BE = MO_BSWAP,
|
MO_BE = MO_BSWAP,
|
||||||
#endif
|
#endif
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#if TARGET_BIG_ENDIAN
|
#if TARGET_BIG_ENDIAN
|
||||||
MO_TE = MO_BE,
|
MO_TE = MO_BE,
|
||||||
#else
|
#else
|
||||||
@ -135,7 +135,7 @@ typedef enum MemOp {
|
|||||||
MO_BESL = MO_BE | MO_SL,
|
MO_BESL = MO_BE | MO_SL,
|
||||||
MO_BESQ = MO_BE | MO_SQ,
|
MO_BESQ = MO_BE | MO_SQ,
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
MO_TEUW = MO_TE | MO_UW,
|
MO_TEUW = MO_TE | MO_UW,
|
||||||
MO_TEUL = MO_TE | MO_UL,
|
MO_TEUL = MO_TE | MO_UL,
|
||||||
MO_TEUQ = MO_TE | MO_UQ,
|
MO_TEUQ = MO_TE | MO_UQ,
|
||||||
|
@ -3107,7 +3107,7 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
|
|||||||
MemTxResult address_space_set(AddressSpace *as, hwaddr addr,
|
MemTxResult address_space_set(AddressSpace *as, hwaddr addr,
|
||||||
uint8_t c, hwaddr len, MemTxAttrs attrs);
|
uint8_t c, hwaddr len, MemTxAttrs attrs);
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
/* enum device_endian to MemOp. */
|
/* enum device_endian to MemOp. */
|
||||||
static inline MemOp devend_memop(enum device_endian end)
|
static inline MemOp devend_memop(enum device_endian end)
|
||||||
{
|
{
|
||||||
@ -3125,7 +3125,7 @@ static inline MemOp devend_memop(enum device_endian end)
|
|||||||
return (end == non_host_endianness) ? MO_BSWAP : 0;
|
return (end == non_host_endianness) ? MO_BSWAP : 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Inhibit technologies that require discarding of pages in RAM blocks, e.g.,
|
* Inhibit technologies that require discarding of pages in RAM blocks, e.g.,
|
||||||
|
18
include/exec/mmu-access-type.h
Normal file
18
include/exec/mmu-access-type.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* QEMU MMU Access type definitions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef EXEC_MMU_ACCESS_TYPE_H
|
||||||
|
#define EXEC_MMU_ACCESS_TYPE_H
|
||||||
|
|
||||||
|
typedef enum MMUAccessType {
|
||||||
|
MMU_DATA_LOAD = 0,
|
||||||
|
MMU_DATA_STORE = 1,
|
||||||
|
MMU_INST_FETCH = 2
|
||||||
|
#define MMU_ACCESS_COUNT 3
|
||||||
|
} MMUAccessType;
|
||||||
|
|
||||||
|
#endif
|
@ -26,6 +26,7 @@
|
|||||||
#include "exec/ramlist.h"
|
#include "exec/ramlist.h"
|
||||||
#include "exec/ramblock.h"
|
#include "exec/ramblock.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
#include "qemu/rcu.h"
|
||||||
|
|
||||||
extern uint64_t total_dirty_pages;
|
extern uint64_t total_dirty_pages;
|
||||||
|
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
#include "exec/cpu_ldst.h" /* for abi_ptr */
|
#include "exec/cpu-common.h"
|
||||||
|
#include "exec/cpu-defs.h"
|
||||||
|
#include "exec/abi_ptr.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gen_intermediate_code
|
* gen_intermediate_code
|
||||||
|
@ -8,18 +8,28 @@
|
|||||||
#ifndef TSWAP_H
|
#ifndef TSWAP_H
|
||||||
#define TSWAP_H
|
#define TSWAP_H
|
||||||
|
|
||||||
#include "hw/core/cpu.h"
|
|
||||||
#include "qemu/bswap.h"
|
#include "qemu/bswap.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* target_words_bigendian:
|
||||||
|
* Returns true if the (default) endianness of the target is big endian,
|
||||||
|
* false otherwise. Note that in target-specific code, you can use
|
||||||
|
* TARGET_BIG_ENDIAN directly instead. On the other hand, common
|
||||||
|
* code should normally never need to know about the endianness of the
|
||||||
|
* target, so please do *not* use this function unless you know very well
|
||||||
|
* what you are doing!
|
||||||
|
*/
|
||||||
|
bool target_words_bigendian(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're in target-specific code, we can hard-code the swapping
|
* If we're in target-specific code, we can hard-code the swapping
|
||||||
* condition, otherwise we have to do (slower) run-time checks.
|
* condition, otherwise we have to do (slower) run-time checks.
|
||||||
*/
|
*/
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#define target_needs_bswap() (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
|
#define target_needs_bswap() (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
|
||||||
#else
|
#else
|
||||||
#define target_needs_bswap() (target_words_bigendian() != HOST_BIG_ENDIAN)
|
#define target_needs_bswap() (target_words_bigendian() != HOST_BIG_ENDIAN)
|
||||||
#endif
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
static inline uint16_t tswap16(uint16_t s)
|
static inline uint16_t tswap16(uint16_t s)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
#ifndef EXEC_USER_ABITYPES_H
|
#ifndef EXEC_USER_ABITYPES_H
|
||||||
#define EXEC_USER_ABITYPES_H
|
#define EXEC_USER_ABITYPES_H
|
||||||
|
|
||||||
#include "cpu.h"
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
#error Cannot include this header from system emulation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "exec/cpu-defs.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
#ifdef TARGET_ABI32
|
#ifdef TARGET_ABI32
|
||||||
#define TARGET_ABI_BITS 32
|
#define TARGET_ABI_BITS 32
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
||||||
/*
|
|
||||||
* Declaration of guest_base.
|
|
||||||
* Copyright (c) 2003 Fabrice Bellard
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXEC_USER_GUEST_BASE_H
|
|
||||||
#define EXEC_USER_GUEST_BASE_H
|
|
||||||
|
|
||||||
extern uintptr_t guest_base;
|
|
||||||
|
|
||||||
#endif
|
|
@ -12,8 +12,12 @@
|
|||||||
#ifndef _GDBSTUB_HELPERS_H_
|
#ifndef _GDBSTUB_HELPERS_H_
|
||||||
#define _GDBSTUB_HELPERS_H_
|
#define _GDBSTUB_HELPERS_H_
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifndef COMPILING_PER_TARGET
|
||||||
#include "cpu.h"
|
#error "gdbstub helpers should only be included by target specific code"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "exec/tswap.h"
|
||||||
|
#include "cpu-param.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The GDB remote protocol transfers values in target byte order. As
|
* The GDB remote protocol transfers values in target byte order. As
|
||||||
@ -96,8 +100,4 @@ static inline uint8_t *gdb_get_reg_ptr(GByteArray *buf, int len)
|
|||||||
#define ldtul_p(addr) ldl_p(addr)
|
#define ldtul_p(addr) ldl_p(addr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
#error "gdbstub helpers should only be included by target specific code"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _GDBSTUB_HELPERS_H_ */
|
#endif /* _GDBSTUB_HELPERS_H_ */
|
||||||
|
@ -22,9 +22,11 @@
|
|||||||
|
|
||||||
#include "hw/qdev-core.h"
|
#include "hw/qdev-core.h"
|
||||||
#include "disas/dis-asm.h"
|
#include "disas/dis-asm.h"
|
||||||
|
#include "exec/breakpoint.h"
|
||||||
#include "exec/hwaddr.h"
|
#include "exec/hwaddr.h"
|
||||||
#include "exec/vaddr.h"
|
#include "exec/vaddr.h"
|
||||||
#include "exec/memattrs.h"
|
#include "exec/memattrs.h"
|
||||||
|
#include "exec/mmu-access-type.h"
|
||||||
#include "exec/tlb-common.h"
|
#include "exec/tlb-common.h"
|
||||||
#include "qapi/qapi-types-run-state.h"
|
#include "qapi/qapi-types-run-state.h"
|
||||||
#include "qemu/bitmap.h"
|
#include "qemu/bitmap.h"
|
||||||
@ -80,13 +82,6 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU,
|
|||||||
typedef struct ArchCPU CpuInstanceType; \
|
typedef struct ArchCPU CpuInstanceType; \
|
||||||
OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME);
|
OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME);
|
||||||
|
|
||||||
typedef enum MMUAccessType {
|
|
||||||
MMU_DATA_LOAD = 0,
|
|
||||||
MMU_DATA_STORE = 1,
|
|
||||||
MMU_INST_FETCH = 2
|
|
||||||
#define MMU_ACCESS_COUNT 3
|
|
||||||
} MMUAccessType;
|
|
||||||
|
|
||||||
typedef struct CPUWatchpoint CPUWatchpoint;
|
typedef struct CPUWatchpoint CPUWatchpoint;
|
||||||
|
|
||||||
/* see accel-cpu.h */
|
/* see accel-cpu.h */
|
||||||
@ -353,21 +348,6 @@ typedef struct CPUNegativeOffsetState {
|
|||||||
bool can_do_io;
|
bool can_do_io;
|
||||||
} CPUNegativeOffsetState;
|
} CPUNegativeOffsetState;
|
||||||
|
|
||||||
typedef struct CPUBreakpoint {
|
|
||||||
vaddr pc;
|
|
||||||
int flags; /* BP_* */
|
|
||||||
QTAILQ_ENTRY(CPUBreakpoint) entry;
|
|
||||||
} CPUBreakpoint;
|
|
||||||
|
|
||||||
struct CPUWatchpoint {
|
|
||||||
vaddr vaddr;
|
|
||||||
vaddr len;
|
|
||||||
vaddr hitaddr;
|
|
||||||
MemTxAttrs hitattrs;
|
|
||||||
int flags; /* BP_* */
|
|
||||||
QTAILQ_ENTRY(CPUWatchpoint) entry;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct KVMState;
|
struct KVMState;
|
||||||
struct kvm_run;
|
struct kvm_run;
|
||||||
|
|
||||||
@ -525,6 +505,7 @@ struct CPUState {
|
|||||||
uint32_t kvm_fetch_index;
|
uint32_t kvm_fetch_index;
|
||||||
uint64_t dirty_pages;
|
uint64_t dirty_pages;
|
||||||
int kvm_vcpu_stats_fd;
|
int kvm_vcpu_stats_fd;
|
||||||
|
bool vcpu_dirty;
|
||||||
|
|
||||||
/* Use by accel-block: CPU is executing an ioctl() */
|
/* Use by accel-block: CPU is executing an ioctl() */
|
||||||
QemuLockCnt in_ioctl_lock;
|
QemuLockCnt in_ioctl_lock;
|
||||||
@ -546,8 +527,6 @@ struct CPUState {
|
|||||||
int32_t exception_index;
|
int32_t exception_index;
|
||||||
|
|
||||||
AccelCPUState *accel;
|
AccelCPUState *accel;
|
||||||
/* shared by kvm and hvf */
|
|
||||||
bool vcpu_dirty;
|
|
||||||
|
|
||||||
/* Used to keep track of an outstanding cpu throttle thread for migration
|
/* Used to keep track of an outstanding cpu throttle thread for migration
|
||||||
* autoconverge
|
* autoconverge
|
||||||
@ -1169,20 +1148,9 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
|
|||||||
void cpu_exec_unrealizefn(CPUState *cpu);
|
void cpu_exec_unrealizefn(CPUState *cpu);
|
||||||
void cpu_exec_reset_hold(CPUState *cpu);
|
void cpu_exec_reset_hold(CPUState *cpu);
|
||||||
|
|
||||||
/**
|
|
||||||
* target_words_bigendian:
|
|
||||||
* Returns true if the (default) endianness of the target is big endian,
|
|
||||||
* false otherwise. Note that in target-specific code, you can use
|
|
||||||
* TARGET_BIG_ENDIAN directly instead. On the other hand, common
|
|
||||||
* code should normally never need to know about the endianness of the
|
|
||||||
* target, so please do *not* use this function unless you know very well
|
|
||||||
* what you are doing!
|
|
||||||
*/
|
|
||||||
bool target_words_bigendian(void);
|
|
||||||
|
|
||||||
const char *target_name(void);
|
const char *target_name(void);
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
|
||||||
@ -1197,7 +1165,7 @@ extern const VMStateDescription vmstate_cpu_common;
|
|||||||
}
|
}
|
||||||
#endif /* !CONFIG_USER_ONLY */
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
|
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#define UNASSIGNED_CPU_INDEX -1
|
#define UNASSIGNED_CPU_INDEX -1
|
||||||
#define UNASSIGNED_CLUSTER_INDEX -1
|
#define UNASSIGNED_CLUSTER_INDEX -1
|
||||||
|
@ -10,7 +10,11 @@
|
|||||||
#ifndef TCG_CPU_OPS_H
|
#ifndef TCG_CPU_OPS_H
|
||||||
#define TCG_CPU_OPS_H
|
#define TCG_CPU_OPS_H
|
||||||
|
|
||||||
#include "hw/core/cpu.h"
|
#include "exec/breakpoint.h"
|
||||||
|
#include "exec/hwaddr.h"
|
||||||
|
#include "exec/memattrs.h"
|
||||||
|
#include "exec/mmu-access-type.h"
|
||||||
|
#include "exec/vaddr.h"
|
||||||
|
|
||||||
struct TCGCPUOps {
|
struct TCGCPUOps {
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config-host.h"
|
#include "config-host.h"
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#include CONFIG_TARGET
|
#include CONFIG_TARGET
|
||||||
#else
|
#else
|
||||||
#include "exec/poison.h"
|
#include "exec/poison.h"
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/option.h"
|
#include "qemu/option.h"
|
||||||
#include "qemu/plugin-event.h"
|
#include "qemu/plugin-event.h"
|
||||||
|
#include "qemu/bitmap.h"
|
||||||
#include "exec/memopidx.h"
|
#include "exec/memopidx.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
#error Cannot include semihosting/uaccess.h from user emulation
|
#error Cannot include semihosting/uaccess.h from user emulation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "exec/cpu-common.h"
|
||||||
|
#include "exec/cpu-defs.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
|
|
||||||
#define get_user_u64(val, addr) \
|
#define get_user_u64(val, addr) \
|
||||||
({ uint64_t val_ = 0; \
|
({ uint64_t val_ = 0; \
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "qemu/accel.h"
|
#include "qemu/accel.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
#ifdef CONFIG_HVF
|
#ifdef CONFIG_HVF
|
||||||
@ -26,7 +26,7 @@ extern bool hvf_allowed;
|
|||||||
#define hvf_enabled() 0
|
#define hvf_enabled() 0
|
||||||
#endif /* !CONFIG_HVF */
|
#endif /* !CONFIG_HVF */
|
||||||
|
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
|
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ typedef struct HVFState HVFState;
|
|||||||
DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
|
DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
|
||||||
TYPE_HVF_ACCEL)
|
TYPE_HVF_ACCEL)
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
struct hvf_sw_breakpoint {
|
struct hvf_sw_breakpoint {
|
||||||
vaddr pc;
|
vaddr pc;
|
||||||
vaddr saved_insn;
|
vaddr saved_insn;
|
||||||
@ -66,6 +66,6 @@ void hvf_arch_update_guest_debug(CPUState *cpu);
|
|||||||
* Return whether the guest supports debugging.
|
* Return whether the guest supports debugging.
|
||||||
*/
|
*/
|
||||||
bool hvf_arch_supports_guest_debug(void);
|
bool hvf_arch_supports_guest_debug(void);
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,6 +55,7 @@ struct AccelCPUState {
|
|||||||
bool vtimer_masked;
|
bool vtimer_masked;
|
||||||
sigset_t unblock_ipi_mask;
|
sigset_t unblock_ipi_mask;
|
||||||
bool guest_debug_enabled;
|
bool guest_debug_enabled;
|
||||||
|
bool dirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
void assert_hvf_ok(hv_return_t ret);
|
void assert_hvf_ok(hv_return_t ret);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "qemu/accel.h"
|
#include "qemu/accel.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
# ifdef CONFIG_KVM
|
# ifdef CONFIG_KVM
|
||||||
# include <linux/kvm.h>
|
# include <linux/kvm.h>
|
||||||
# define CONFIG_KVM_IS_POSSIBLE
|
# define CONFIG_KVM_IS_POSSIBLE
|
||||||
@ -210,7 +210,7 @@ bool kvm_arm_supports_user_irq(void);
|
|||||||
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
||||||
int kvm_on_sigbus(int code, void *addr);
|
int kvm_on_sigbus(int code, void *addr);
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
void kvm_flush_coalesced_mmio_buffer(void);
|
void kvm_flush_coalesced_mmio_buffer(void);
|
||||||
@ -435,7 +435,7 @@ void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len);
|
|||||||
int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
|
int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr,
|
||||||
hwaddr *phys_addr);
|
hwaddr *phys_addr);
|
||||||
|
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
void kvm_cpu_synchronize_state(CPUState *cpu);
|
void kvm_cpu_synchronize_state(CPUState *cpu);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#ifndef QEMU_NVMM_H
|
#ifndef QEMU_NVMM_H
|
||||||
#define QEMU_NVMM_H
|
#define QEMU_NVMM_H
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
|
|
||||||
#ifdef CONFIG_NVMM
|
#ifdef CONFIG_NVMM
|
||||||
|
|
||||||
@ -24,6 +24,6 @@ int nvmm_enabled(void);
|
|||||||
|
|
||||||
#endif /* CONFIG_NVMM */
|
#endif /* CONFIG_NVMM */
|
||||||
|
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#endif /* QEMU_NVMM_H */
|
#endif /* QEMU_NVMM_H */
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef QEMU_WHPX_H
|
#ifndef QEMU_WHPX_H
|
||||||
#define QEMU_WHPX_H
|
#define QEMU_WHPX_H
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
|
|
||||||
#ifdef CONFIG_WHPX
|
#ifdef CONFIG_WHPX
|
||||||
|
|
||||||
@ -29,6 +29,6 @@ bool whpx_apic_in_platform(void);
|
|||||||
|
|
||||||
#endif /* CONFIG_WHPX */
|
#endif /* CONFIG_WHPX */
|
||||||
|
|
||||||
#endif /* NEED_CPU_H */
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#endif /* QEMU_WHPX_H */
|
#endif /* QEMU_WHPX_H */
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
#include "exec/cpu-common.h"
|
#include "exec/cpu-common.h"
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
# ifdef CONFIG_XEN
|
# ifdef CONFIG_XEN
|
||||||
# define CONFIG_XEN_IS_POSSIBLE
|
# define CONFIG_XEN_IS_POSSIBLE
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define CONFIG_XEN_IS_POSSIBLE
|
# define CONFIG_XEN_IS_POSSIBLE
|
||||||
#endif
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#ifdef CONFIG_XEN_IS_POSSIBLE
|
#ifdef CONFIG_XEN_IS_POSSIBLE
|
||||||
|
|
||||||
|
18
include/user/guest-base.h
Normal file
18
include/user/guest-base.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
/*
|
||||||
|
* Declaration of guest_base.
|
||||||
|
* Copyright (c) 2003 Fabrice Bellard
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef USER_GUEST_BASE_H
|
||||||
|
#define USER_GUEST_BASE_H
|
||||||
|
|
||||||
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
#error Cannot include this header from system emulation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern uintptr_t guest_base;
|
||||||
|
|
||||||
|
extern bool have_guest_base;
|
||||||
|
|
||||||
|
#endif
|
22
include/user/tswap-target.h
Normal file
22
include/user/tswap-target.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* target-specific swap() definitions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 Fabrice Bellard
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
*/
|
||||||
|
#ifndef USER_TSWAP_H
|
||||||
|
#define USER_TSWAP_H
|
||||||
|
|
||||||
|
#include "exec/cpu-defs.h"
|
||||||
|
#include "exec/tswap.h"
|
||||||
|
|
||||||
|
#if TARGET_LONG_SIZE == 4
|
||||||
|
#define tswapl(s) tswap32(s)
|
||||||
|
#define bswaptls(s) bswap32s(s)
|
||||||
|
#else
|
||||||
|
#define tswapl(s) tswap64(s)
|
||||||
|
#define bswaptls(s) bswap64s(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -7,6 +7,8 @@
|
|||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
#include "user/guest-base.h"
|
||||||
#include "user-internals.h"
|
#include "user-internals.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "user-internals.h"
|
#include "user-internals.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
#include "linux-user/trace.h"
|
#include "linux-user/trace.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
|
|
||||||
/* from the Linux kernel - /arch/x86/include/uapi/asm/sigcontext.h */
|
/* from the Linux kernel - /arch/x86/include/uapi/asm/sigcontext.h */
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "qemu/help_option.h"
|
#include "qemu/help_option.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "qemu/plugin.h"
|
#include "qemu/plugin.h"
|
||||||
|
#include "user/guest-base.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
#include "exec/gdbstub.h"
|
#include "exec/gdbstub.h"
|
||||||
#include "gdbstub/user.h"
|
#include "gdbstub/user.h"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "user-internals.h"
|
#include "user-internals.h"
|
||||||
#include "signal-common.h"
|
#include "signal-common.h"
|
||||||
#include "linux-user/trace.h"
|
#include "linux-user/trace.h"
|
||||||
|
#include "user/tswap-target.h"
|
||||||
#include "vdso-asmoffset.h"
|
#include "vdso-asmoffset.h"
|
||||||
|
|
||||||
/* See arch/powerpc/include/asm/ucontext.h. Only used for 32-bit PPC;
|
/* See arch/powerpc/include/asm/ucontext.h. Only used for 32-bit PPC;
|
||||||
|
@ -3523,7 +3523,7 @@ if get_option('b_lto')
|
|||||||
pagevary = declare_dependency(link_with: pagevary)
|
pagevary = declare_dependency(link_with: pagevary)
|
||||||
endif
|
endif
|
||||||
common_ss.add(pagevary)
|
common_ss.add(pagevary)
|
||||||
specific_ss.add(files('page-vary-target.c'))
|
specific_ss.add(files('page-target.c', 'page-vary-target.c'))
|
||||||
|
|
||||||
subdir('backends')
|
subdir('backends')
|
||||||
subdir('disas')
|
subdir('disas')
|
||||||
@ -3610,7 +3610,7 @@ foreach d, list : target_modules
|
|||||||
if target.endswith('-softmmu')
|
if target.endswith('-softmmu')
|
||||||
config_target = config_target_mak[target]
|
config_target = config_target_mak[target]
|
||||||
target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
|
target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
|
||||||
c_args = ['-DNEED_CPU_H',
|
c_args = ['-DCOMPILING_PER_TARGET',
|
||||||
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
|
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
|
||||||
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
|
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
|
||||||
target_module_ss = module_ss.apply(config_target, strict: false)
|
target_module_ss = module_ss.apply(config_target, strict: false)
|
||||||
@ -3793,7 +3793,7 @@ foreach target : target_dirs
|
|||||||
target_base_arch = config_target['TARGET_BASE_ARCH']
|
target_base_arch = config_target['TARGET_BASE_ARCH']
|
||||||
arch_srcs = [config_target_h[target]]
|
arch_srcs = [config_target_h[target]]
|
||||||
arch_deps = []
|
arch_deps = []
|
||||||
c_args = ['-DNEED_CPU_H',
|
c_args = ['-DCOMPILING_PER_TARGET',
|
||||||
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
|
'-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
|
||||||
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
|
'-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
|
||||||
link_args = emulator_link_args
|
link_args = emulator_link_args
|
||||||
|
44
page-target.c
Normal file
44
page-target.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* QEMU page values getters (target independent)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 Fabrice Bellard
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include "exec/target_page.h"
|
||||||
|
#include "exec/cpu-defs.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
#include "exec/cpu-all.h"
|
||||||
|
|
||||||
|
size_t qemu_target_page_size(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qemu_target_page_mask(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qemu_target_page_bits(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qemu_target_page_bits_min(void)
|
||||||
|
{
|
||||||
|
return TARGET_PAGE_BITS_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert target pages to MiB (2**20). */
|
||||||
|
size_t qemu_target_pages_to_MiB(size_t pages)
|
||||||
|
{
|
||||||
|
int page_bits = TARGET_PAGE_BITS;
|
||||||
|
|
||||||
|
/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
|
||||||
|
g_assert(page_bits < 20);
|
||||||
|
|
||||||
|
return pages >> (20 - page_bits);
|
||||||
|
}
|
@ -92,7 +92,7 @@ echo trace/generated-tracers.h:
|
|||||||
analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
|
analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
|
||||||
|
|
||||||
echo target/i386/cpu.h:
|
echo target/i386/cpu.h:
|
||||||
analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h
|
analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h
|
||||||
|
|
||||||
echo hw/hw.h + NEED_CPU_H:
|
echo hw/hw.h + COMPILING_PER_TARGET:
|
||||||
analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
|
analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
|
||||||
|
@ -12,10 +12,7 @@
|
|||||||
#include "gdbstub/syscalls.h"
|
#include "gdbstub/syscalls.h"
|
||||||
#include "semihosting/semihost.h"
|
#include "semihosting/semihost.h"
|
||||||
#include "semihosting/guestfd.h"
|
#include "semihosting/guestfd.h"
|
||||||
#ifdef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
#include "qemu.h"
|
|
||||||
#else
|
|
||||||
#include "semihosting/uaccess.h"
|
|
||||||
#include CONFIG_DEVICES
|
#include CONFIG_DEVICES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3540,36 +3540,6 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Allows code that needs to deal with migration bitmaps etc to still be built
|
|
||||||
* target independent.
|
|
||||||
*/
|
|
||||||
size_t qemu_target_page_size(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_target_page_bits(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_BITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int qemu_target_page_bits_min(void)
|
|
||||||
{
|
|
||||||
return TARGET_PAGE_BITS_MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert target pages to MiB (2**20). */
|
|
||||||
size_t qemu_target_pages_to_MiB(size_t pages)
|
|
||||||
{
|
|
||||||
int page_bits = TARGET_PAGE_BITS;
|
|
||||||
|
|
||||||
/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */
|
|
||||||
g_assert(page_bits < 20);
|
|
||||||
|
|
||||||
return pages >> (20 - page_bits);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cpu_physical_memory_is_io(hwaddr phys_addr)
|
bool cpu_physical_memory_is_io(hwaddr phys_addr)
|
||||||
{
|
{
|
||||||
MemoryRegion*mr;
|
MemoryRegion*mr;
|
||||||
|
@ -27,4 +27,7 @@
|
|||||||
# define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS)
|
# define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Alpha processors have a weak memory model */
|
||||||
|
#define TCG_GUEST_DEFAULT_MO (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
#include "exec/cpu-defs.h"
|
#include "exec/cpu-defs.h"
|
||||||
#include "qemu/cpu-float.h"
|
#include "qemu/cpu-float.h"
|
||||||
|
|
||||||
/* Alpha processors have a weak memory model */
|
|
||||||
#define TCG_GUEST_DEFAULT_MO (0)
|
|
||||||
|
|
||||||
#define ICACHE_LINE_SIZE 32
|
#define ICACHE_LINE_SIZE 32
|
||||||
#define DCACHE_LINE_SIZE 32
|
#define DCACHE_LINE_SIZE 32
|
||||||
|
|
||||||
|
@ -27,14 +27,16 @@
|
|||||||
# else
|
# else
|
||||||
# define TARGET_PAGE_BITS 12
|
# define TARGET_PAGE_BITS 12
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else /* !CONFIG_USER_ONLY */
|
||||||
/*
|
/*
|
||||||
* ARMv7 and later CPUs have 4K pages minimum, but ARMv5 and v6
|
* ARMv7 and later CPUs have 4K pages minimum, but ARMv5 and v6
|
||||||
* have to support 1K tiny pages.
|
* have to support 1K tiny pages.
|
||||||
*/
|
*/
|
||||||
# define TARGET_PAGE_BITS_VARY
|
# define TARGET_PAGE_BITS_VARY
|
||||||
# define TARGET_PAGE_BITS_MIN 10
|
# define TARGET_PAGE_BITS_MIN 10
|
||||||
|
#endif /* !CONFIG_USER_ONLY */
|
||||||
#endif
|
|
||||||
|
/* ARM processors have a weak memory model */
|
||||||
|
#define TCG_GUEST_DEFAULT_MO (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
#include "target/arm/multiprocessing.h"
|
#include "target/arm/multiprocessing.h"
|
||||||
#include "target/arm/gtimer.h"
|
#include "target/arm/gtimer.h"
|
||||||
|
|
||||||
/* ARM processors have a weak memory model */
|
|
||||||
#define TCG_GUEST_DEFAULT_MO (0)
|
|
||||||
|
|
||||||
#ifdef TARGET_AARCH64
|
#ifdef TARGET_AARCH64
|
||||||
#define KVM_HAVE_MCE_INJECTION 1
|
#define KVM_HAVE_MCE_INJECTION 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -806,9 +806,9 @@ int hvf_put_registers(CPUState *cpu)
|
|||||||
|
|
||||||
static void flush_cpu_state(CPUState *cpu)
|
static void flush_cpu_state(CPUState *cpu)
|
||||||
{
|
{
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->accel->dirty) {
|
||||||
hvf_put_registers(cpu);
|
hvf_put_registers(cpu);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#ifndef TARGET_ARM_INTERNALS_H
|
#ifndef TARGET_ARM_INTERNALS_H
|
||||||
#define TARGET_ARM_INTERNALS_H
|
#define TARGET_ARM_INTERNALS_H
|
||||||
|
|
||||||
|
#include "exec/breakpoint.h"
|
||||||
#include "hw/registerfields.h"
|
#include "hw/registerfields.h"
|
||||||
#include "tcg/tcg-gvec-desc.h"
|
#include "tcg/tcg-gvec-desc.h"
|
||||||
#include "syndrome.h"
|
#include "syndrome.h"
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
#ifndef ARM_KVM_CONSTS_H
|
#ifndef ARM_KVM_CONSTS_H
|
||||||
#define ARM_KVM_CONSTS_H
|
#define ARM_KVM_CONSTS_H
|
||||||
|
|
||||||
#ifdef NEED_CPU_H
|
#ifdef COMPILING_PER_TARGET
|
||||||
#ifdef CONFIG_KVM
|
#ifdef CONFIG_KVM
|
||||||
#include <linux/kvm.h>
|
#include <linux/kvm.h>
|
||||||
#include <linux/psci.h>
|
#include <linux/psci.h>
|
||||||
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y)
|
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* COMPILING_PER_TARGET */
|
||||||
|
|
||||||
#ifndef MISMATCH_CHECK
|
#ifndef MISMATCH_CHECK
|
||||||
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(0)
|
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(0)
|
||||||
|
@ -32,4 +32,6 @@
|
|||||||
#define TARGET_PHYS_ADDR_SPACE_BITS 24
|
#define TARGET_PHYS_ADDR_SPACE_BITS 24
|
||||||
#define TARGET_VIRT_ADDR_SPACE_BITS 24
|
#define TARGET_VIRT_ADDR_SPACE_BITS 24
|
||||||
|
|
||||||
|
#define TCG_GUEST_DEFAULT_MO 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#define CPU_RESOLVING_TYPE TYPE_AVR_CPU
|
#define CPU_RESOLVING_TYPE TYPE_AVR_CPU
|
||||||
|
|
||||||
#define TCG_GUEST_DEFAULT_MO 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AVR has two memory spaces, data & code.
|
* AVR has two memory spaces, data & code.
|
||||||
* e.g. both have 0 address
|
* e.g. both have 0 address
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "gdbstub/helpers.h"
|
#include "gdbstub/helpers.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
int avr_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
int avr_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "exec/helper-gen.h"
|
#include "exec/helper-gen.h"
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
#include "exec/translation-block.h"
|
#include "exec/translation-block.h"
|
||||||
|
#include "exec/cpu_ldst.h"
|
||||||
#include "exec/log.h"
|
#include "exec/log.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "attribs.h"
|
#include "attribs.h"
|
||||||
|
@ -21,4 +21,12 @@
|
|||||||
|
|
||||||
#define TARGET_PAGE_BITS 12
|
#define TARGET_PAGE_BITS 12
|
||||||
|
|
||||||
|
/* PA-RISC 1.x processors have a strong memory model. */
|
||||||
|
/*
|
||||||
|
* ??? While we do not yet implement PA-RISC 2.0, those processors have
|
||||||
|
* a weak memory model, but with TLB bits that force ordering on a per-page
|
||||||
|
* basis. It's probably easier to fall back to a strong memory model.
|
||||||
|
*/
|
||||||
|
#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,12 +25,6 @@
|
|||||||
#include "qemu/cpu-float.h"
|
#include "qemu/cpu-float.h"
|
||||||
#include "qemu/interval-tree.h"
|
#include "qemu/interval-tree.h"
|
||||||
|
|
||||||
/* PA-RISC 1.x processors have a strong memory model. */
|
|
||||||
/* ??? While we do not yet implement PA-RISC 2.0, those processors have
|
|
||||||
a weak memory model, but with TLB bits that force ordering on a per-page
|
|
||||||
basis. It's probably easier to fall back to a strong memory model. */
|
|
||||||
#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL
|
|
||||||
|
|
||||||
#define MMU_ABS_W_IDX 6
|
#define MMU_ABS_W_IDX 6
|
||||||
#define MMU_ABS_IDX 7
|
#define MMU_ABS_IDX 7
|
||||||
#define MMU_KERNEL_IDX 8
|
#define MMU_KERNEL_IDX 8
|
||||||
|
@ -24,4 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define TARGET_PAGE_BITS 12
|
#define TARGET_PAGE_BITS 12
|
||||||
|
|
||||||
|
/* The x86 has a strong memory model with some store-after-load re-ordering */
|
||||||
|
#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
|
|
||||||
#define XEN_NR_VIRQS 24
|
#define XEN_NR_VIRQS 24
|
||||||
|
|
||||||
/* The x86 has a strong memory model with some store-after-load re-ordering */
|
|
||||||
#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)
|
|
||||||
|
|
||||||
#define KVM_HAVE_MCE_INJECTION 1
|
#define KVM_HAVE_MCE_INJECTION 1
|
||||||
|
|
||||||
/* support for self modifying code even if the modified instruction is
|
/* support for self modifying code even if the modified instruction is
|
||||||
|
@ -419,9 +419,9 @@ int hvf_vcpu_exec(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->accel->dirty) {
|
||||||
hvf_put_registers(cpu);
|
hvf_put_registers(cpu);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hvf_inject_interrupts(cpu)) {
|
if (hvf_inject_interrupts(cpu)) {
|
||||||
|
@ -427,7 +427,7 @@ int hvf_process_events(CPUState *cs)
|
|||||||
X86CPU *cpu = X86_CPU(cs);
|
X86CPU *cpu = X86_CPU(cs);
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
|
|
||||||
if (!cs->vcpu_dirty) {
|
if (!cs->accel->dirty) {
|
||||||
/* light weight sync for CPU_INTERRUPT_HARD and IF_MASK */
|
/* light weight sync for CPU_INTERRUPT_HARD and IF_MASK */
|
||||||
env->eflags = rreg(cs->accel->fd, HV_X86_RFLAGS);
|
env->eflags = rreg(cs->accel->fd, HV_X86_RFLAGS);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ struct AccelCPUState {
|
|||||||
struct nvmm_vcpu vcpu;
|
struct nvmm_vcpu vcpu;
|
||||||
uint8_t tpr;
|
uint8_t tpr;
|
||||||
bool stop;
|
bool stop;
|
||||||
|
bool dirty;
|
||||||
|
|
||||||
/* Window-exiting for INTs/NMIs. */
|
/* Window-exiting for INTs/NMIs. */
|
||||||
bool int_window_exit;
|
bool int_window_exit;
|
||||||
@ -507,7 +508,7 @@ nvmm_io_callback(struct nvmm_io *io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Needed, otherwise infinite loop. */
|
/* Needed, otherwise infinite loop. */
|
||||||
current_cpu->vcpu_dirty = false;
|
current_cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -516,7 +517,7 @@ nvmm_mem_callback(struct nvmm_mem *mem)
|
|||||||
cpu_physical_memory_rw(mem->gpa, mem->data, mem->size, mem->write);
|
cpu_physical_memory_rw(mem->gpa, mem->data, mem->size, mem->write);
|
||||||
|
|
||||||
/* Needed, otherwise infinite loop. */
|
/* Needed, otherwise infinite loop. */
|
||||||
current_cpu->vcpu_dirty = false;
|
current_cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nvmm_assist_callbacks nvmm_callbacks = {
|
static struct nvmm_assist_callbacks nvmm_callbacks = {
|
||||||
@ -726,9 +727,9 @@ nvmm_vcpu_loop(CPUState *cpu)
|
|||||||
* Inner VCPU loop.
|
* Inner VCPU loop.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->accel->dirty) {
|
||||||
nvmm_set_registers(cpu);
|
nvmm_set_registers(cpu);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qcpu->stop) {
|
if (qcpu->stop) {
|
||||||
@ -826,32 +827,32 @@ static void
|
|||||||
do_nvmm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
do_nvmm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
nvmm_get_registers(cpu);
|
nvmm_get_registers(cpu);
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_nvmm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg)
|
do_nvmm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
nvmm_set_registers(cpu);
|
nvmm_set_registers(cpu);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_nvmm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg)
|
do_nvmm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
nvmm_set_registers(cpu);
|
nvmm_set_registers(cpu);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_nvmm_cpu_synchronize_pre_loadvm(CPUState *cpu, run_on_cpu_data arg)
|
do_nvmm_cpu_synchronize_pre_loadvm(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvmm_cpu_synchronize_state(CPUState *cpu)
|
void nvmm_cpu_synchronize_state(CPUState *cpu)
|
||||||
{
|
{
|
||||||
if (!cpu->vcpu_dirty) {
|
if (!cpu->accel->dirty) {
|
||||||
run_on_cpu(cpu, do_nvmm_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
run_on_cpu(cpu, do_nvmm_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -981,7 +982,7 @@ nvmm_init_vcpu(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
cpu->accel = qcpu;
|
cpu->accel = qcpu;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "tcg-cpu.h"
|
#include "tcg-cpu.h"
|
||||||
|
#include "exec/exec-all.h"
|
||||||
#include "exec/cpu_ldst.h"
|
#include "exec/cpu_ldst.h"
|
||||||
#include "exec/helper-proto.h"
|
#include "exec/helper-proto.h"
|
||||||
#include "fpu/softfloat.h"
|
#include "fpu/softfloat.h"
|
||||||
|
@ -237,6 +237,7 @@ struct AccelCPUState {
|
|||||||
uint64_t tpr;
|
uint64_t tpr;
|
||||||
uint64_t apic_base;
|
uint64_t apic_base;
|
||||||
bool interruption_pending;
|
bool interruption_pending;
|
||||||
|
bool dirty;
|
||||||
|
|
||||||
/* Must be the last field as it may have a tail */
|
/* Must be the last field as it may have a tail */
|
||||||
WHV_RUN_VP_EXIT_CONTEXT exit_ctx;
|
WHV_RUN_VP_EXIT_CONTEXT exit_ctx;
|
||||||
@ -839,7 +840,7 @@ static HRESULT CALLBACK whpx_emu_setreg_callback(
|
|||||||
* The emulator just successfully wrote the register state. We clear the
|
* The emulator just successfully wrote the register state. We clear the
|
||||||
* dirty state so we avoid the double write on resume of the VP.
|
* dirty state so we avoid the double write on resume of the VP.
|
||||||
*/
|
*/
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
@ -1394,7 +1395,7 @@ static int whpx_last_vcpu_stopping(CPUState *cpu)
|
|||||||
/* Returns the address of the next instruction that is about to be executed. */
|
/* Returns the address of the next instruction that is about to be executed. */
|
||||||
static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
||||||
{
|
{
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->accel->dirty) {
|
||||||
/* The CPU registers have been modified by other parts of QEMU. */
|
/* The CPU registers have been modified by other parts of QEMU. */
|
||||||
return cpu_env(cpu)->eip;
|
return cpu_env(cpu)->eip;
|
||||||
} else if (exit_context_valid) {
|
} else if (exit_context_valid) {
|
||||||
@ -1713,9 +1714,9 @@ static int whpx_vcpu_run(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (cpu->vcpu_dirty) {
|
if (cpu->accel->dirty) {
|
||||||
whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE);
|
whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exclusive_step_mode == WHPX_STEP_NONE) {
|
if (exclusive_step_mode == WHPX_STEP_NONE) {
|
||||||
@ -2063,9 +2064,9 @@ static int whpx_vcpu_run(CPUState *cpu)
|
|||||||
|
|
||||||
static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
if (!cpu->vcpu_dirty) {
|
if (!cpu->accel->dirty) {
|
||||||
whpx_get_registers(cpu);
|
whpx_get_registers(cpu);
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2073,20 +2074,20 @@ static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu,
|
|||||||
run_on_cpu_data arg)
|
run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
whpx_set_registers(cpu, WHPX_SET_RESET_STATE);
|
whpx_set_registers(cpu, WHPX_SET_RESET_STATE);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_whpx_cpu_synchronize_post_init(CPUState *cpu,
|
static void do_whpx_cpu_synchronize_post_init(CPUState *cpu,
|
||||||
run_on_cpu_data arg)
|
run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
whpx_set_registers(cpu, WHPX_SET_FULL_STATE);
|
whpx_set_registers(cpu, WHPX_SET_FULL_STATE);
|
||||||
cpu->vcpu_dirty = false;
|
cpu->accel->dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu,
|
static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu,
|
||||||
run_on_cpu_data arg)
|
run_on_cpu_data arg)
|
||||||
{
|
{
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2095,7 +2096,7 @@ static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu,
|
|||||||
|
|
||||||
void whpx_cpu_synchronize_state(CPUState *cpu)
|
void whpx_cpu_synchronize_state(CPUState *cpu)
|
||||||
{
|
{
|
||||||
if (!cpu->vcpu_dirty) {
|
if (!cpu->accel->dirty) {
|
||||||
run_on_cpu(cpu, do_whpx_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
run_on_cpu(cpu, do_whpx_cpu_synchronize_state, RUN_ON_CPU_NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2235,7 +2236,7 @@ int whpx_init_vcpu(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vcpu->interruptable = true;
|
vcpu->interruptable = true;
|
||||||
cpu->vcpu_dirty = true;
|
cpu->accel->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, env);
|
qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
|
||||||
|
@ -14,4 +14,6 @@
|
|||||||
|
|
||||||
#define TARGET_PAGE_BITS 12
|
#define TARGET_PAGE_BITS 12
|
||||||
|
|
||||||
|
#define TCG_GUEST_DEFAULT_MO (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
#define IOCSR_MEM_SIZE 0x428
|
#define IOCSR_MEM_SIZE 0x428
|
||||||
|
|
||||||
#define TCG_GUEST_DEFAULT_MO (0)
|
|
||||||
|
|
||||||
#define FCSR0_M1 0x1f /* FCSR1 mask, Enables */
|
#define FCSR0_M1 0x1f /* FCSR1 mask, Enables */
|
||||||
#define FCSR0_M2 0x1f1f0000 /* FCSR2 mask, Cause and Flags */
|
#define FCSR0_M2 0x1f1f0000 /* FCSR2 mask, Cause and Flags */
|
||||||
#define FCSR0_M3 0x300 /* FCSR3 mask, Round Mode */
|
#define FCSR0_M3 0x300 /* FCSR3 mask, Round Mode */
|
||||||
|
@ -18,5 +18,3 @@ subdir('sh4')
|
|||||||
subdir('sparc')
|
subdir('sparc')
|
||||||
subdir('tricore')
|
subdir('tricore')
|
||||||
subdir('xtensa')
|
subdir('xtensa')
|
||||||
|
|
||||||
specific_ss.add(files('target-common.c'))
|
|
||||||
|
@ -29,4 +29,7 @@
|
|||||||
/* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */
|
/* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */
|
||||||
#define TARGET_PAGE_BITS 12
|
#define TARGET_PAGE_BITS 12
|
||||||
|
|
||||||
|
/* MicroBlaze is always in-order. */
|
||||||
|
#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "exec/exec-all.h"
|
#include "exec/exec-all.h"
|
||||||
|
#include "exec/cpu_ldst.h"
|
||||||
#include "exec/gdbstub.h"
|
#include "exec/gdbstub.h"
|
||||||
#include "fpu/softfloat-helpers.h"
|
#include "fpu/softfloat-helpers.h"
|
||||||
#include "tcg/tcg.h"
|
#include "tcg/tcg.h"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user