* Add missing ERRP_GUARD() statements in functions that need it
* Prefer fast cpu_env() over slower CPU QOM cast macro -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmXwPhYRHHRodXRoQHJl ZGhhdC5jb20ACgkQLtnXdP5wLbWHvBAAgKx5LHFjz3xREVA+LkDTQ49mz0lK3s32 SGvNlIHjiaDGVttVYhVC4sinBWUruG4Lyv/2QN72OJBzn6WUsEUQE3KPH1d7Y3/s wS9X7mj70n4kugWJqeIJP5AXSRasHmWoQ4QJLVQRJd6+Eb9jqwep0x7bYkI1de6D bL1Q7bIfkFeNQBXaiPWAm2i+hqmT4C1r8HEAGZIjAsMFrjy/hzBEjNV+pnh6ZSq9 Vp8BsPWRfLU2XHm4WX0o8d89WUMAfUGbVkddEl/XjIHDrUD+Zbd1HAhLyfhsmrnE jXIwSzm+ML1KX4MoF5ilGtg8Oo0gQDEBy9/xck6G0HCm9lIoLKlgTxK9glr2vdT8 yxZmrM9Hder7F9hKKxmb127xgU6AmL7rYmVqsoQMNAq22D6Xr4UDpgFRXNk2/wO6 zZZBkfZ4H4MpZXbd/KJpXvYH5mQA4IpkOy8LJdE+dbcHX7Szy9ksZdPA+Z10hqqf zqS13qTs3abxymy2Q/tO3hPKSJCk1+vCGUkN60Wm+9VoLWGoU43qMc7gnY/pCS7m 0rFKtvfwFHhokX1orK0lP/ppVzPv/5oFIeK8YDY9if+N+dU2LCwVZHIuf2/VJPRq wmgH2vAn3JDoRKPxTGX9ly6AMxuZaeP92qBTOPap0gDhihYzIpaCq9ecEBoTakI7 tdFhV0iRr08= =NiP4 -----END PGP SIGNATURE----- Merge tag 'pull-request-2024-03-12' of https://gitlab.com/thuth/qemu into staging * Add missing ERRP_GUARD() statements in functions that need it * Prefer fast cpu_env() over slower CPU QOM cast macro # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmXwPhYRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbWHvBAAgKx5LHFjz3xREVA+LkDTQ49mz0lK3s32 # SGvNlIHjiaDGVttVYhVC4sinBWUruG4Lyv/2QN72OJBzn6WUsEUQE3KPH1d7Y3/s # wS9X7mj70n4kugWJqeIJP5AXSRasHmWoQ4QJLVQRJd6+Eb9jqwep0x7bYkI1de6D # bL1Q7bIfkFeNQBXaiPWAm2i+hqmT4C1r8HEAGZIjAsMFrjy/hzBEjNV+pnh6ZSq9 # Vp8BsPWRfLU2XHm4WX0o8d89WUMAfUGbVkddEl/XjIHDrUD+Zbd1HAhLyfhsmrnE # jXIwSzm+ML1KX4MoF5ilGtg8Oo0gQDEBy9/xck6G0HCm9lIoLKlgTxK9glr2vdT8 # yxZmrM9Hder7F9hKKxmb127xgU6AmL7rYmVqsoQMNAq22D6Xr4UDpgFRXNk2/wO6 # zZZBkfZ4H4MpZXbd/KJpXvYH5mQA4IpkOy8LJdE+dbcHX7Szy9ksZdPA+Z10hqqf # zqS13qTs3abxymy2Q/tO3hPKSJCk1+vCGUkN60Wm+9VoLWGoU43qMc7gnY/pCS7m # 0rFKtvfwFHhokX1orK0lP/ppVzPv/5oFIeK8YDY9if+N+dU2LCwVZHIuf2/VJPRq # wmgH2vAn3JDoRKPxTGX9ly6AMxuZaeP92qBTOPap0gDhihYzIpaCq9ecEBoTakI7 # tdFhV0iRr08= # =NiP4 # -----END PGP SIGNATURE----- # gpg: Signature made Tue 12 Mar 2024 11:35:50 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2024-03-12' of https://gitlab.com/thuth/qemu: (55 commits) user: Prefer fast cpu_env() over slower CPU QOM cast macro target/xtensa: Prefer fast cpu_env() over slower CPU QOM cast macro target/tricore: Prefer fast cpu_env() over slower CPU QOM cast macro target/sparc: Prefer fast cpu_env() over slower CPU QOM cast macro target/sh4: Prefer fast cpu_env() over slower CPU QOM cast macro target/rx: Prefer fast cpu_env() over slower CPU QOM cast macro target/ppc: Prefer fast cpu_env() over slower CPU QOM cast macro target/openrisc: Prefer fast cpu_env() over slower CPU QOM cast macro target/nios2: Prefer fast cpu_env() over slower CPU QOM cast macro target/mips: Prefer fast cpu_env() over slower CPU QOM cast macro target/microblaze: Prefer fast cpu_env() over slower CPU QOM cast macro target/m68k: Prefer fast cpu_env() over slower CPU QOM cast macro target/loongarch: Prefer fast cpu_env() over slower CPU QOM cast macro target/i386/hvf: Use CPUState typedef target/hexagon: Prefer fast cpu_env() over slower CPU QOM cast macro target/cris: Prefer fast cpu_env() over slower CPU QOM cast macro target/avr: Prefer fast cpu_env() over slower CPU QOM cast macro target/alpha: Prefer fast cpu_env() over slower CPU QOM cast macro target: Replace CPU_GET_CLASS(cpu -> obj) in cpu_reset_hold() handler bulk: Call in place single use cpu_env() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
e692f9c6a6
@ -436,7 +436,6 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
|
||||
static inline TranslationBlock * QEMU_DISABLE_CFI
|
||||
cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
|
||||
{
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
uintptr_t ret;
|
||||
TranslationBlock *last_tb;
|
||||
const void *tb_ptr = itb->tc.ptr;
|
||||
@ -446,7 +445,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
|
||||
}
|
||||
|
||||
qemu_thread_jit_execute();
|
||||
ret = tcg_qemu_tb_exec(env, tb_ptr);
|
||||
ret = tcg_qemu_tb_exec(cpu_env(cpu), tb_ptr);
|
||||
cpu->neg.can_do_io = true;
|
||||
qemu_plugin_disable_mem_helpers(cpu);
|
||||
/*
|
||||
|
@ -43,6 +43,7 @@ static void iommufd_backend_finalize(Object *obj)
|
||||
|
||||
static void iommufd_backend_set_fd(Object *obj, const char *str, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
IOMMUFDBackend *be = IOMMUFD_BACKEND(obj);
|
||||
int fd = -1;
|
||||
|
||||
|
6
block.c
6
block.c
@ -534,9 +534,9 @@ typedef struct CreateCo {
|
||||
int coroutine_fn bdrv_co_create(BlockDriver *drv, const char *filename,
|
||||
QemuOpts *opts, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int ret;
|
||||
GLOBAL_STATE_CODE();
|
||||
ERRP_GUARD();
|
||||
|
||||
if (!drv->bdrv_co_create_opts) {
|
||||
error_setg(errp, "Driver '%s' does not support image creation",
|
||||
@ -633,6 +633,7 @@ int coroutine_fn bdrv_co_create_opts_simple(BlockDriver *drv,
|
||||
QemuOpts *opts,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BlockBackend *blk;
|
||||
QDict *options;
|
||||
int64_t size = 0;
|
||||
@ -1998,6 +1999,7 @@ fail_opts:
|
||||
|
||||
static QDict *parse_json_filename(const char *filename, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
QObject *options_obj;
|
||||
QDict *options;
|
||||
int ret;
|
||||
@ -3585,6 +3587,7 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd,
|
||||
int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||
const char *bdref_key, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
char *backing_filename = NULL;
|
||||
char *bdref_key_dot;
|
||||
const char *reference = NULL;
|
||||
@ -3851,6 +3854,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
|
||||
QDict *snapshot_options,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
g_autofree char *tmp_filename = NULL;
|
||||
int64_t total_size;
|
||||
QemuOpts *opts = NULL;
|
||||
|
@ -407,6 +407,7 @@ out:
|
||||
static int cbw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BDRVCopyBeforeWriteState *s = bs->opaque;
|
||||
BdrvDirtyBitmap *bitmap = NULL;
|
||||
int64_t cluster_size;
|
||||
|
@ -852,6 +852,7 @@ static coroutine_fn int nbd_co_do_receive_one_chunk(
|
||||
BDRVNBDState *s, uint64_t cookie, bool only_structured,
|
||||
int *request_ret, QEMUIOVector *qiov, void **payload, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int ret;
|
||||
int i = COOKIE_TO_INDEX(cookie);
|
||||
void *local_payload = NULL;
|
||||
|
@ -168,6 +168,7 @@ static QemuOptsList runtime_opts = {
|
||||
static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q,
|
||||
unsigned nentries, size_t entry_bytes, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
size_t bytes;
|
||||
int r;
|
||||
|
||||
@ -221,6 +222,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s,
|
||||
unsigned idx, size_t size,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int i, r;
|
||||
NVMeQueuePair *q;
|
||||
uint64_t prp_list_iova;
|
||||
@ -535,6 +537,7 @@ static int nvme_admin_cmd_sync(BlockDriverState *bs, NvmeCmd *cmd)
|
||||
/* Returns true on success, false on failure. */
|
||||
static bool nvme_identify(BlockDriverState *bs, int namespace, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BDRVNVMeState *s = bs->opaque;
|
||||
bool ret = false;
|
||||
QEMU_AUTO_VFREE union {
|
||||
|
@ -46,11 +46,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
|
||||
bool flat,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
ImageInfo **p_image_info;
|
||||
ImageInfo *backing_info;
|
||||
BlockDriverState *backing;
|
||||
BlockDeviceInfo *info;
|
||||
ERRP_GUARD();
|
||||
|
||||
if (!bs->drv) {
|
||||
error_setg(errp, "Block device %s is ejected", bs->node_name);
|
||||
@ -330,8 +330,8 @@ void bdrv_query_image_info(BlockDriverState *bs,
|
||||
bool skip_implicit_filters,
|
||||
Error **errp)
|
||||
{
|
||||
ImageInfo *info;
|
||||
ERRP_GUARD();
|
||||
ImageInfo *info;
|
||||
|
||||
info = g_new0(ImageInfo, 1);
|
||||
bdrv_do_query_node_info(bs, qapi_ImageInfo_base(info), errp);
|
||||
@ -382,10 +382,10 @@ void bdrv_query_block_graph_info(BlockDriverState *bs,
|
||||
BlockGraphInfo **p_info,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BlockGraphInfo *info;
|
||||
BlockChildInfoList **children_list_tail;
|
||||
BdrvChild *c;
|
||||
ERRP_GUARD();
|
||||
|
||||
info = g_new0(BlockGraphInfo, 1);
|
||||
bdrv_do_query_node_info(bs, qapi_BlockGraphInfo_base(info), errp);
|
||||
|
@ -1710,6 +1710,7 @@ bool coroutine_fn qcow2_co_can_store_new_dirty_bitmap(BlockDriverState *bs,
|
||||
uint32_t granularity,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
uint64_t bitmap_directory_size = 0;
|
||||
|
@ -3483,6 +3483,7 @@ static uint64_t qcow2_opt_get_refcount_bits_del(QemuOpts *opts, int version,
|
||||
static int coroutine_fn GRAPH_UNLOCKED
|
||||
qcow2_co_create(BlockdevCreateOptions *create_options, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BlockdevCreateOptionsQcow2 *qcow2_opts;
|
||||
QDict *options;
|
||||
|
||||
@ -4283,6 +4284,7 @@ static int coroutine_fn GRAPH_RDLOCK
|
||||
qcow2_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
|
||||
PreallocMode prealloc, BdrvRequestFlags flags, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BDRVQcow2State *s = bs->opaque;
|
||||
uint64_t old_length;
|
||||
int64_t new_l1_size;
|
||||
|
@ -1579,6 +1579,7 @@ bdrv_qed_co_change_backing_file(BlockDriverState *bs, const char *backing_file,
|
||||
static void coroutine_fn GRAPH_RDLOCK
|
||||
bdrv_qed_co_invalidate_cache(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BDRVQEDState *s = bs->opaque;
|
||||
int ret;
|
||||
|
||||
|
@ -566,6 +566,7 @@ int bdrv_all_delete_snapshot(const char *name,
|
||||
bool has_devices, strList *devices,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
g_autoptr(GList) bdrvs = NULL;
|
||||
GList *iterbdrvs;
|
||||
|
||||
@ -605,6 +606,7 @@ int bdrv_all_goto_snapshot(const char *name,
|
||||
bool has_devices, strList *devices,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
g_autoptr(GList) bdrvs = NULL;
|
||||
GList *iterbdrvs;
|
||||
int ret;
|
||||
|
@ -738,6 +738,7 @@ static int coroutine_fn GRAPH_UNLOCKED
|
||||
vdi_co_do_create(BlockdevCreateOptions *create_options, size_t block_size,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
BlockdevCreateOptionsVdi *vdi_opts;
|
||||
int ret = 0;
|
||||
uint64_t bytes = 0;
|
||||
|
@ -1147,6 +1147,7 @@ static int GRAPH_RDLOCK
|
||||
vmdk_parse_extents(const char *desc, BlockDriverState *bs, QDict *options,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int ret;
|
||||
int matches;
|
||||
char access[11];
|
||||
|
@ -463,14 +463,13 @@ static int fatal_signal(int sig)
|
||||
void force_sig_fault(int sig, int code, abi_ulong addr)
|
||||
{
|
||||
CPUState *cpu = thread_cpu;
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
target_siginfo_t info = {};
|
||||
|
||||
info.si_signo = sig;
|
||||
info.si_errno = 0;
|
||||
info.si_code = code;
|
||||
info.si_addr = addr;
|
||||
queue_signal(env, sig, QEMU_SI_FAULT, &info);
|
||||
queue_signal(cpu_env(cpu), sig, QEMU_SI_FAULT, &info);
|
||||
}
|
||||
|
||||
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)
|
||||
|
@ -1682,6 +1682,7 @@ static bool apply_iothread_vq_mapping(
|
||||
/* Context: BQL held */
|
||||
static bool virtio_blk_vq_aio_context_init(VirtIOBlock *s, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(s);
|
||||
VirtIOBlkConf *conf = &s->conf;
|
||||
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
|
||||
|
@ -718,7 +718,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
|
||||
mc->possible_cpu_arch_ids(machine);
|
||||
|
||||
for (i = 0; i < machine->possible_cpus->len; i++) {
|
||||
Object *cpu;
|
||||
CPUState *cpu;
|
||||
HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);
|
||||
|
||||
cpu_item->type = g_strdup(machine->possible_cpus->cpus[i].type);
|
||||
@ -728,7 +728,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine)
|
||||
|
||||
cpu = machine->possible_cpus->cpus[i].cpu;
|
||||
if (cpu) {
|
||||
cpu_item->qom_path = object_get_canonical_path(cpu);
|
||||
cpu_item->qom_path = object_get_canonical_path(OBJECT(cpu));
|
||||
}
|
||||
QAPI_LIST_PREPEND(head, cpu_item);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state,
|
||||
CXLFixedMemoryWindowOptions *object,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
g_autofree CXLFixedWindow *fw = g_malloc0(sizeof(*fw));
|
||||
strList *target;
|
||||
int i;
|
||||
|
@ -991,7 +991,7 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
|
||||
}
|
||||
vga_init(vga, OBJECT(s), pci_address_space(dev),
|
||||
pci_address_space_io(dev), true);
|
||||
vga->con = graphic_console_init(DEVICE(s), 0, s->vga.hw_ops, &s->vga);
|
||||
vga->con = graphic_console_init(DEVICE(s), 0, s->vga.hw_ops, vga);
|
||||
if (s->cursor_guest_mode) {
|
||||
vga->cursor_invalidate = ati_cursor_invalidate;
|
||||
vga->cursor_draw_line = ati_cursor_draw_line;
|
||||
|
@ -714,6 +714,7 @@ static void macfb_nubus_set_irq(void *opaque, int n, int level)
|
||||
|
||||
static void macfb_nubus_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
NubusDevice *nd = NUBUS_DEVICE(dev);
|
||||
MacfbNubusState *s = NUBUS_MACFB(dev);
|
||||
MacfbNubusDeviceClass *ndc = NUBUS_MACFB_GET_CLASS(dev);
|
||||
|
@ -225,7 +225,7 @@ void x86_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
}
|
||||
|
||||
found_cpu = x86_find_cpu_slot(MACHINE(x86ms), cpu->apic_id, NULL);
|
||||
found_cpu->cpu = OBJECT(dev);
|
||||
found_cpu->cpu = CPU(dev);
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
@ -152,6 +152,7 @@ static int ioapic_dispatch_post_load(void *opaque, int version_id)
|
||||
|
||||
static void ioapic_common_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
IOAPICCommonState *s = IOAPIC_COMMON(dev);
|
||||
IOAPICCommonClass *info;
|
||||
|
||||
@ -162,6 +163,9 @@ static void ioapic_common_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
info = IOAPIC_COMMON_GET_CLASS(s);
|
||||
info->realize(dev, errp);
|
||||
if (*errp) {
|
||||
return;
|
||||
}
|
||||
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->io_memory);
|
||||
ioapic_no++;
|
||||
|
@ -858,7 +858,7 @@ static void loongarch_init(MachineState *machine)
|
||||
for (i = 0; i < possible_cpus->len; i++) {
|
||||
cpu = cpu_create(machine->cpu_type);
|
||||
cpu->cpu_index = i;
|
||||
machine->possible_cpus->cpus[i].cpu = OBJECT(cpu);
|
||||
machine->possible_cpus->cpus[i].cpu = cpu;
|
||||
lacpu = LOONGARCH_CPU(cpu);
|
||||
lacpu->phy_id = machine->possible_cpus->cpus[i].arch_id;
|
||||
}
|
||||
|
@ -645,6 +645,7 @@ static DOEProtocol doe_cdat_prot[] = {
|
||||
|
||||
static void ct3_realize(PCIDevice *pci_dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
CXLType3Dev *ct3d = CXL_TYPE3(pci_dev);
|
||||
CXLComponentState *cxl_cstate = &ct3d->cxl_cstate;
|
||||
ComponentRegisters *regs = &cxl_cstate->crb;
|
||||
|
@ -737,8 +737,7 @@ static void pmu_realize(DeviceState *dev, Error **errp)
|
||||
timer_mod(s->one_sec_timer, s->one_sec_target);
|
||||
|
||||
if (s->has_adb) {
|
||||
qbus_init(&s->adb_bus, sizeof(s->adb_bus), TYPE_ADB_BUS,
|
||||
dev, "adb.0");
|
||||
qbus_init(adb_bus, sizeof(*adb_bus), TYPE_ADB_BUS, dev, "adb.0");
|
||||
adb_register_autopoll_callback(adb_bus, pmu_adb_poll, s);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ static void pvpanic_pci_realizefn(PCIDevice *dev, Error **errp)
|
||||
PVPanicPCIState *s = PVPANIC_PCI_DEVICE(dev);
|
||||
PVPanicState *ps = &s->pvpanic;
|
||||
|
||||
pvpanic_setup_io(&s->pvpanic, DEVICE(s), 2);
|
||||
pvpanic_setup_io(ps, DEVICE(s), 2);
|
||||
|
||||
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &ps->mr);
|
||||
}
|
||||
|
@ -644,8 +644,7 @@ static void trng_prop_fault_event_set(Object *obj, Visitor *v,
|
||||
Property *prop = opaque;
|
||||
uint32_t *events = object_field_prop_ptr(obj, prop);
|
||||
|
||||
visit_type_uint32(v, name, events, errp);
|
||||
if (*errp) {
|
||||
if (!visit_type_uint32(v, name, events, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ static void cxl_rp_realize(DeviceState *dev, Error **errp)
|
||||
|
||||
cxl_cstate->dvsec_offset = CXL_ROOT_PORT_DVSEC_OFFSET;
|
||||
cxl_cstate->pdev = pci_dev;
|
||||
build_dvsecs(&crp->cxl_cstate);
|
||||
build_dvsecs(cxl_cstate);
|
||||
|
||||
cxl_component_register_block_init(OBJECT(pci_dev), cxl_cstate,
|
||||
TYPE_CXL_ROOT_PORT);
|
||||
|
@ -289,6 +289,7 @@ static void free_default_cdat_table(CDATSubHeader **cdat_table, int num,
|
||||
|
||||
static void cxl_usp_realize(PCIDevice *d, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
PCIEPort *p = PCIE_PORT(d);
|
||||
CXLUpstreamPort *usp = CXL_USP(d);
|
||||
CXLComponentState *cxl_cstate = &usp->cxl_cstate;
|
||||
|
@ -71,8 +71,7 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr,
|
||||
unsigned size)
|
||||
{
|
||||
uint32_t value = 0;
|
||||
PowerPCCPU *cpu = POWERPC_CPU(current_cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUPPCState *env = cpu_env(current_cpu);
|
||||
|
||||
addr &= MPC8544_GUTS_MMIO_SIZE - 1;
|
||||
switch (addr) {
|
||||
|
23
hw/ppc/pnv.c
23
hw/ppc/pnv.c
@ -1265,11 +1265,11 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
/* Processor Service Interface (PSI) Host Bridge */
|
||||
object_property_set_int(OBJECT(&chip8->psi), "bar", PNV_PSIHB_BASE(chip),
|
||||
object_property_set_int(OBJECT(psi8), "bar", PNV_PSIHB_BASE(chip),
|
||||
&error_fatal);
|
||||
object_property_set_link(OBJECT(&chip8->psi), ICS_PROP_XICS,
|
||||
object_property_set_link(OBJECT(psi8), ICS_PROP_XICS,
|
||||
OBJECT(chip8->xics), &error_abort);
|
||||
if (!qdev_realize(DEVICE(&chip8->psi), NULL, errp)) {
|
||||
if (!qdev_realize(DEVICE(psi8), NULL, errp)) {
|
||||
return;
|
||||
}
|
||||
pnv_xscom_add_subregion(chip, PNV_XSCOM_PSIHB_BASE,
|
||||
@ -1300,7 +1300,7 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
pnv_xscom_add_subregion(chip, PNV_XSCOM_OCC_BASE, &chip8->occ.xscom_regs);
|
||||
qdev_connect_gpio_out(DEVICE(&chip8->occ), 0,
|
||||
qdev_get_gpio_in(DEVICE(&chip8->psi), PSIHB_IRQ_OCC));
|
||||
qdev_get_gpio_in(DEVICE(psi8), PSIHB_IRQ_OCC));
|
||||
|
||||
/* OCC SRAM model */
|
||||
memory_region_add_subregion(get_system_memory(), PNV_OCC_SENSOR_BASE(chip),
|
||||
@ -1553,12 +1553,12 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
|
||||
&chip9->xive.xscom_regs);
|
||||
|
||||
/* Processor Service Interface (PSI) Host Bridge */
|
||||
object_property_set_int(OBJECT(&chip9->psi), "bar", PNV9_PSIHB_BASE(chip),
|
||||
object_property_set_int(OBJECT(psi9), "bar", PNV9_PSIHB_BASE(chip),
|
||||
&error_fatal);
|
||||
/* This is the only device with 4k ESB pages */
|
||||
object_property_set_int(OBJECT(&chip9->psi), "shift", XIVE_ESB_4K,
|
||||
object_property_set_int(OBJECT(psi9), "shift", XIVE_ESB_4K,
|
||||
&error_fatal);
|
||||
if (!qdev_realize(DEVICE(&chip9->psi), NULL, errp)) {
|
||||
if (!qdev_realize(DEVICE(psi9), NULL, errp)) {
|
||||
return;
|
||||
}
|
||||
pnv_xscom_add_subregion(chip, PNV9_XSCOM_PSIHB_BASE,
|
||||
@ -1594,7 +1594,7 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
pnv_xscom_add_subregion(chip, PNV9_XSCOM_OCC_BASE, &chip9->occ.xscom_regs);
|
||||
qdev_connect_gpio_out(DEVICE(&chip9->occ), 0, qdev_get_gpio_in(
|
||||
DEVICE(&chip9->psi), PSIHB9_IRQ_OCC));
|
||||
DEVICE(psi9), PSIHB9_IRQ_OCC));
|
||||
|
||||
/* OCC SRAM model */
|
||||
memory_region_add_subregion(get_system_memory(), PNV9_OCC_SENSOR_BASE(chip),
|
||||
@ -1609,7 +1609,7 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
|
||||
pnv_xscom_add_subregion(chip, PNV9_XSCOM_SBE_MBOX_BASE,
|
||||
&chip9->sbe.xscom_mbox_regs);
|
||||
qdev_connect_gpio_out(DEVICE(&chip9->sbe), 0, qdev_get_gpio_in(
|
||||
DEVICE(&chip9->psi), PSIHB9_IRQ_PSU));
|
||||
DEVICE(psi9), PSIHB9_IRQ_PSU));
|
||||
|
||||
/* HOMER */
|
||||
object_property_set_link(OBJECT(&chip9->homer), "chip", OBJECT(chip),
|
||||
@ -1650,7 +1650,7 @@ static void pnv_chip_power9_realize(DeviceState *dev, Error **errp)
|
||||
PNV9_XSCOM_I2CM_SIZE,
|
||||
&chip9->i2c[i].xscom_regs);
|
||||
qdev_connect_gpio_out(DEVICE(&chip9->i2c[i]), 0,
|
||||
qdev_get_gpio_in(DEVICE(&chip9->psi),
|
||||
qdev_get_gpio_in(DEVICE(psi9),
|
||||
PSIHB9_IRQ_SBE_I2C));
|
||||
}
|
||||
}
|
||||
@ -2412,8 +2412,7 @@ static void pnv_machine_set_hb(Object *obj, bool value, Error **errp)
|
||||
|
||||
static void pnv_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)
|
||||
{
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUPPCState *env = cpu_env(cs);
|
||||
|
||||
cpu_synchronize_state(cs);
|
||||
ppc_cpu_do_system_reset(cs);
|
||||
|
@ -44,15 +44,12 @@ static void xscom_complete(CPUState *cs, uint64_t hmer_bits)
|
||||
* passed for the cpu, and no CPU completion is generated.
|
||||
*/
|
||||
if (cs) {
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
/*
|
||||
* TODO: Need a CPU helper to set HMER, also handle generation
|
||||
* of HMIs
|
||||
*/
|
||||
cpu_synchronize_state(cs);
|
||||
env->spr[SPR_HMER] |= hmer_bits;
|
||||
cpu_env(cs)->spr[SPR_HMER] |= hmer_bits;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,7 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env,
|
||||
|
||||
static void spin_kick(CPUState *cs, run_on_cpu_data data)
|
||||
{
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUPPCState *env = cpu_env(cs);
|
||||
SpinInfo *curspin = data.host_ptr;
|
||||
hwaddr map_size = 64 * MiB;
|
||||
hwaddr map_start;
|
||||
|
@ -3481,8 +3481,7 @@ static void spapr_machine_finalizefn(Object *obj)
|
||||
void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg)
|
||||
{
|
||||
SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
|
||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUPPCState *env = cpu_env(cs);
|
||||
|
||||
cpu_synchronize_state(cs);
|
||||
/* If FWNMI is inactive, addr will be -1, which will deliver to 0x100 */
|
||||
@ -3979,7 +3978,6 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
|
||||
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
SpaprCpuCore *core = SPAPR_CPU_CORE(OBJECT(dev));
|
||||
CPUCore *cc = CPU_CORE(dev);
|
||||
CPUState *cs;
|
||||
SpaprDrc *drc;
|
||||
CPUArchId *core_slot;
|
||||
int index;
|
||||
@ -4013,7 +4011,7 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
|
||||
}
|
||||
}
|
||||
|
||||
core_slot->cpu = OBJECT(dev);
|
||||
core_slot->cpu = CPU(dev);
|
||||
|
||||
/*
|
||||
* Set compatibility mode to match the boot CPU, which was either set
|
||||
@ -4029,7 +4027,7 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev)
|
||||
|
||||
if (smc->pre_2_10_has_unused_icps) {
|
||||
for (i = 0; i < cc->nr_threads; i++) {
|
||||
cs = CPU(core->threads[i]);
|
||||
CPUState *cs = CPU(core->threads[i]);
|
||||
pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index);
|
||||
}
|
||||
}
|
||||
|
@ -194,8 +194,7 @@ static void cap_htm_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
|
||||
static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
CPUPPCState *env = cpu_env(first_cpu);
|
||||
|
||||
if (!val) {
|
||||
/* TODO: We don't support disabling vsx yet */
|
||||
@ -213,14 +212,12 @@ static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
|
||||
static void cap_dfp_apply(SpaprMachineState *spapr, uint8_t val, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
|
||||
CPUPPCState *env = &cpu->env;
|
||||
|
||||
if (!val) {
|
||||
/* TODO: We don't support disabling dfp yet */
|
||||
return;
|
||||
}
|
||||
if (!(env->insns_flags2 & PPC2_DFP)) {
|
||||
if (!(cpu_env(first_cpu)->insns_flags2 & PPC2_DFP)) {
|
||||
error_setg(errp, "DFP support not available");
|
||||
error_append_hint(errp, "Try appending -machine cap-dfp=off\n");
|
||||
}
|
||||
|
@ -312,12 +312,12 @@ static void ccw_init(MachineState *machine)
|
||||
static void s390_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
MachineState *ms = MACHINE(hotplug_dev);
|
||||
S390CPU *cpu = S390_CPU(dev);
|
||||
ERRP_GUARD();
|
||||
|
||||
g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
|
||||
ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);
|
||||
ms->possible_cpus->cpus[cpu->env.core_id].cpu = CPU(dev);
|
||||
|
||||
if (s390_has_topology()) {
|
||||
s390_topology_setup_cpu(ms, cpu, errp);
|
||||
|
@ -220,6 +220,7 @@ static int vhost_scsi_set_workers(VHostSCSICommon *vsc, bool per_virtqueue)
|
||||
|
||||
static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
|
||||
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(dev);
|
||||
Error *err = NULL;
|
||||
|
@ -155,6 +155,7 @@ static void vfio_ap_unregister_irq_notifier(VFIOAPDevice *vapdev,
|
||||
|
||||
static void vfio_ap_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int ret;
|
||||
Error *err = NULL;
|
||||
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(dev);
|
||||
|
@ -727,6 +727,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
|
||||
|
||||
static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VFIOGroup *group;
|
||||
char path[32];
|
||||
struct vfio_group_status status = { .argsz = sizeof(status) };
|
||||
|
@ -110,6 +110,7 @@ static const char *index_to_str(VFIODevice *vbasedev, int index)
|
||||
int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex,
|
||||
int action, int fd, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
struct vfio_irq_set *irq_set;
|
||||
int argsz, ret = 0;
|
||||
const char *name;
|
||||
@ -613,6 +614,7 @@ bool vfio_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type)
|
||||
|
||||
int vfio_device_get_name(VFIODevice *vbasedev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
struct stat st;
|
||||
|
||||
if (vbasedev->fd < 0) {
|
||||
@ -644,6 +646,7 @@ int vfio_device_get_name(VFIODevice *vbasedev, Error **errp)
|
||||
|
||||
void vfio_device_set_fd(VFIODevice *vbasedev, const char *str, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
int fd = monitor_fd_param(monitor_cur(), str, errp);
|
||||
|
||||
if (fd < 0) {
|
||||
|
@ -116,6 +116,7 @@ static void iommufd_cdev_unbind_and_disconnect(VFIODevice *vbasedev)
|
||||
|
||||
static int iommufd_cdev_getfd(const char *sysfs_path, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
long int ret = -ENOTTY;
|
||||
char *path, *vfio_dev_path = NULL, *vfio_path = NULL;
|
||||
DIR *dir = NULL;
|
||||
|
@ -1538,6 +1538,7 @@ static bool is_valid_std_cap_offset(uint8_t pos)
|
||||
|
||||
static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
PCIDevice *pdev = &vdev->pdev;
|
||||
int ret, pos;
|
||||
bool c8_conflict = false, d4_conflict = false;
|
||||
@ -1630,6 +1631,7 @@ static int vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp)
|
||||
#define VMD_SHADOW_CAP_LEN 24
|
||||
static int vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
uint8_t membar_phys[16];
|
||||
int ret, pos = 0xE8;
|
||||
|
||||
|
@ -2136,6 +2136,7 @@ static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
|
||||
|
||||
static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
PCIDevice *pdev = &vdev->pdev;
|
||||
uint8_t cap_id, next, size;
|
||||
int ret;
|
||||
@ -2942,6 +2943,7 @@ static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
|
||||
|
||||
static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VFIOPCIDevice *vdev = VFIO_PCI(pdev);
|
||||
VFIODevice *vbasedev = &vdev->vbasedev;
|
||||
char *tmp, *subsys;
|
||||
|
@ -576,6 +576,7 @@ static int vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
|
||||
*/
|
||||
static void vfio_platform_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
|
||||
SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
|
||||
VFIODevice *vbasedev = &vdev->vbasedev;
|
||||
|
@ -56,9 +56,9 @@ static int vu_scmi_start(VirtIODevice *vdev)
|
||||
goto err_host_notifiers;
|
||||
}
|
||||
|
||||
vhost_ack_features(&scmi->vhost_dev, feature_bits, vdev->guest_features);
|
||||
vhost_ack_features(vhost_dev, feature_bits, vdev->guest_features);
|
||||
|
||||
ret = vhost_dev_start(&scmi->vhost_dev, vdev, true);
|
||||
ret = vhost_dev_start(vhost_dev, vdev, true);
|
||||
if (ret < 0) {
|
||||
error_report("Error starting vhost-user-scmi: %d", ret);
|
||||
goto err_guest_notifiers;
|
||||
@ -71,7 +71,7 @@ static int vu_scmi_start(VirtIODevice *vdev)
|
||||
* enabling/disabling irqfd.
|
||||
*/
|
||||
for (i = 0; i < scmi->vhost_dev.nvqs; i++) {
|
||||
vhost_virtqueue_mask(&scmi->vhost_dev, vdev, i, false);
|
||||
vhost_virtqueue_mask(vhost_dev, vdev, i, false);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -121,6 +121,7 @@ static const VMStateDescription vmstate_virtio_vhost_vsock = {
|
||||
|
||||
static void vhost_vsock_device_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(dev);
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VHostVSock *vsock = VHOST_VSOCK(dev);
|
||||
|
@ -2199,6 +2199,7 @@ int vhost_check_device_state(struct vhost_dev *dev, Error **errp)
|
||||
|
||||
int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
/* Maximum chunk size in which to transfer the state */
|
||||
const size_t chunk_size = 1 * 1024 * 1024;
|
||||
g_autofree void *transfer_buf = NULL;
|
||||
@ -2291,6 +2292,7 @@ fail:
|
||||
|
||||
int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
size_t transfer_buf_size = 0;
|
||||
g_autofree void *transfer_buf = NULL;
|
||||
g_autoptr(GError) g_err = NULL;
|
||||
|
@ -1929,7 +1929,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
|
||||
bool modern_pio = proxy->flags & VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY;
|
||||
uint8_t *config;
|
||||
uint32_t size;
|
||||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
VirtIODevice *vdev = virtio_bus_get_device(bus);
|
||||
|
||||
/*
|
||||
* Virtio capabilities present without
|
||||
|
@ -711,7 +711,7 @@ static void xen_pt_destroy(PCIDevice *d) {
|
||||
uint8_t intx;
|
||||
int rc;
|
||||
|
||||
if (machine_irq && !xen_host_pci_device_closed(&s->real_device)) {
|
||||
if (machine_irq && !xen_host_pci_device_closed(host_dev)) {
|
||||
intx = xen_pt_pci_intx(s);
|
||||
rc = xc_domain_unbind_pt_irq(xen_xc, xen_domid, machine_irq,
|
||||
PT_IRQ_TYPE_PCI,
|
||||
@ -760,8 +760,8 @@ static void xen_pt_destroy(PCIDevice *d) {
|
||||
memory_listener_unregister(&s->io_listener);
|
||||
s->listener_set = false;
|
||||
}
|
||||
if (!xen_host_pci_device_closed(&s->real_device)) {
|
||||
xen_host_pci_device_put(&s->real_device);
|
||||
if (!xen_host_pci_device_closed(host_dev)) {
|
||||
xen_host_pci_device_put(host_dev);
|
||||
}
|
||||
}
|
||||
/* init */
|
||||
|
@ -120,7 +120,7 @@ typedef struct CPUArchId {
|
||||
uint64_t arch_id;
|
||||
int64_t vcpus_count;
|
||||
CpuInstanceProperties props;
|
||||
Object *cpu;
|
||||
CPUState *cpu;
|
||||
const char *type;
|
||||
} CPUArchId;
|
||||
|
||||
|
@ -207,7 +207,7 @@
|
||||
*
|
||||
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
|
||||
* - It must not be dereferenced, because it may be null.
|
||||
* - It should not be passed to error_prepend() or
|
||||
* - It should not be passed to error_prepend(), error_vprepend(), or
|
||||
* error_append_hint(), because that doesn't work with &error_fatal.
|
||||
* ERRP_GUARD() lifts these restrictions.
|
||||
*
|
||||
|
@ -323,8 +323,8 @@ void cpu_loop(CPUX86State *env)
|
||||
|
||||
static void target_cpu_free(void *obj)
|
||||
{
|
||||
CPUArchState *env = cpu_env(obj);
|
||||
target_munmap(env->gdt.base, sizeof(uint64_t) * TARGET_GDT_ENTRIES);
|
||||
target_munmap(cpu_env(obj)->gdt.base,
|
||||
sizeof(uint64_t) * TARGET_GDT_ENTRIES);
|
||||
g_free(obj);
|
||||
}
|
||||
|
||||
|
@ -623,7 +623,6 @@ void signal_init(void)
|
||||
void force_sig(int sig)
|
||||
{
|
||||
CPUState *cpu = thread_cpu;
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
target_siginfo_t info = {};
|
||||
|
||||
info.si_signo = sig;
|
||||
@ -631,7 +630,7 @@ void force_sig(int sig)
|
||||
info.si_code = TARGET_SI_KERNEL;
|
||||
info._sifields._kill._pid = 0;
|
||||
info._sifields._kill._uid = 0;
|
||||
queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
|
||||
queue_signal(cpu_env(cpu), info.si_signo, QEMU_SI_KILL, &info);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -641,14 +640,13 @@ void force_sig(int sig)
|
||||
void force_sig_fault(int sig, int code, abi_ulong addr)
|
||||
{
|
||||
CPUState *cpu = thread_cpu;
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
target_siginfo_t info = {};
|
||||
|
||||
info.si_signo = sig;
|
||||
info.si_errno = 0;
|
||||
info.si_code = code;
|
||||
info._sifields._sigfault._addr = addr;
|
||||
queue_signal(env, sig, QEMU_SI_FAULT, &info);
|
||||
queue_signal(cpu_env(cpu), sig, QEMU_SI_FAULT, &info);
|
||||
}
|
||||
|
||||
/* Force a SIGSEGV if we couldn't write to memory trying to set
|
||||
|
@ -75,7 +75,7 @@ static int zlib_send_setup(MultiFDSendParams *p, Error **errp)
|
||||
err_free_zbuff:
|
||||
g_free(z->zbuff);
|
||||
err_deflate_end:
|
||||
deflateEnd(&z->zs);
|
||||
deflateEnd(zs);
|
||||
err_free_z:
|
||||
g_free(z);
|
||||
error_setg(errp, "multifd %u: %s", p->id, err_msg);
|
||||
|
@ -481,9 +481,9 @@ static bool migrate_incoming_started(void)
|
||||
*/
|
||||
bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
MigrationIncomingState *mis = migration_incoming_get_current();
|
||||
|
||||
ERRP_GUARD();
|
||||
#ifndef CONFIG_LIVE_BLOCK_MIGRATION
|
||||
if (new_caps[MIGRATION_CAPABILITY_BLOCK]) {
|
||||
error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i) "
|
||||
@ -1105,6 +1105,8 @@ void migrate_params_init(MigrationParameters *params)
|
||||
*/
|
||||
bool migrate_params_check(MigrationParameters *params, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
|
||||
if (params->has_compress_level &&
|
||||
(params->compress_level > 9)) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
|
||||
|
@ -283,10 +283,10 @@ static bool request_ufd_features(int ufd, uint64_t features)
|
||||
static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis,
|
||||
Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
uint64_t asked_features = 0;
|
||||
static uint64_t supported_features;
|
||||
|
||||
ERRP_GUARD();
|
||||
/*
|
||||
* it's not possible to
|
||||
* request UFFD_API twice per one fd
|
||||
@ -371,6 +371,7 @@ static int test_ramblock_postcopiable(RAMBlock *rb, Error **errp)
|
||||
*/
|
||||
bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
long pagesize = qemu_real_host_page_size();
|
||||
int ufd = -1;
|
||||
bool ret = false; /* Error unless we change it */
|
||||
@ -380,7 +381,6 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, Error **errp)
|
||||
uint64_t feature_mask;
|
||||
RAMBlock *block;
|
||||
|
||||
ERRP_GUARD();
|
||||
if (qemu_target_page_size() > pagesize) {
|
||||
error_setg(errp, "Target page size bigger than host page size");
|
||||
goto out;
|
||||
|
@ -1556,14 +1556,13 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = {
|
||||
static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,
|
||||
int cvq_index, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
uint64_t backend_features;
|
||||
int64_t cvq_group;
|
||||
uint8_t status = VIRTIO_CONFIG_S_ACKNOWLEDGE |
|
||||
VIRTIO_CONFIG_S_DRIVER;
|
||||
int r;
|
||||
|
||||
ERRP_GUARD();
|
||||
|
||||
r = ioctl(device_fd, VHOST_GET_BACKEND_FEATURES, &backend_features);
|
||||
if (unlikely(r < 0)) {
|
||||
error_setg_errno(errp, errno, "Cannot get vdpa backend_features");
|
||||
@ -1750,6 +1749,7 @@ static int vhost_vdpa_get_max_queue_pairs(int fd, uint64_t features,
|
||||
int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
|
||||
NetClientState *peer, Error **errp)
|
||||
{
|
||||
ERRP_GUARD();
|
||||
const NetdevVhostVDPAOptions *opts;
|
||||
uint64_t features;
|
||||
int vdpa_device_fd;
|
||||
|
@ -135,40 +135,27 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
|
||||
|
||||
static void ev4_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
env->implver = IMPLVER_2106x;
|
||||
cpu_env(CPU(obj))->implver = IMPLVER_2106x;
|
||||
}
|
||||
|
||||
static void ev5_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
env->implver = IMPLVER_21164;
|
||||
cpu_env(CPU(obj))->implver = IMPLVER_21164;
|
||||
}
|
||||
|
||||
static void ev56_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
env->amask |= AMASK_BWX;
|
||||
cpu_env(CPU(obj))->amask |= AMASK_BWX;
|
||||
}
|
||||
|
||||
static void pca56_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
env->amask |= AMASK_MVI;
|
||||
cpu_env(CPU(obj))->amask |= AMASK_MVI;
|
||||
}
|
||||
|
||||
static void ev6_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(CPU(obj));
|
||||
|
||||
env->implver = IMPLVER_21264;
|
||||
env->amask = AMASK_BWX | AMASK_FIX | AMASK_MVI | AMASK_TRAP;
|
||||
@ -176,16 +163,12 @@ static void ev6_cpu_initfn(Object *obj)
|
||||
|
||||
static void ev67_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
env->amask |= AMASK_CIX | AMASK_PREFETCH;
|
||||
cpu_env(CPU(obj))->amask |= AMASK_CIX | AMASK_PREFETCH;
|
||||
}
|
||||
|
||||
static void alpha_cpu_initfn(Object *obj)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(obj);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(CPU(obj));
|
||||
|
||||
env->lock_addr = -1;
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
uint64_t val;
|
||||
CPU_DoubleU d;
|
||||
|
||||
@ -59,8 +58,7 @@ int alpha_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int alpha_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
target_ulong tmp = ldtul_p(mem_buf);
|
||||
CPU_DoubleU d;
|
||||
|
||||
|
@ -286,11 +286,10 @@ static int get_physical_address(CPUAlphaState *env, target_ulong addr,
|
||||
|
||||
hwaddr alpha_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
target_ulong phys;
|
||||
int prot, fail;
|
||||
|
||||
fail = get_physical_address(&cpu->env, addr, 0, 0, &phys, &prot);
|
||||
fail = get_physical_address(cpu_env(cs), addr, 0, 0, &phys, &prot);
|
||||
return (fail >= 0 ? -1 : phys);
|
||||
}
|
||||
|
||||
@ -298,8 +297,7 @@ bool alpha_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
||||
MMUAccessType access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
target_ulong phys;
|
||||
int prot, fail;
|
||||
|
||||
@ -325,8 +323,7 @@ bool alpha_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
||||
|
||||
void alpha_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
int i = cs->exception_index;
|
||||
|
||||
if (qemu_loglevel_mask(CPU_LOG_INT)) {
|
||||
@ -435,8 +432,7 @@ void alpha_cpu_do_interrupt(CPUState *cs)
|
||||
|
||||
bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
int idx = -1;
|
||||
|
||||
/* We never take interrupts while in PALmode. */
|
||||
@ -487,8 +483,7 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
"a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
|
||||
"t10", "t11", "ra", "t12", "at", "gp", "sp"
|
||||
};
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
int i;
|
||||
|
||||
qemu_fprintf(f, "PC " TARGET_FMT_lx " PS %02x\n",
|
||||
|
@ -42,18 +42,14 @@ static void do_unaligned_access(CPUAlphaState *env, vaddr addr, uintptr_t retadd
|
||||
void alpha_cpu_record_sigbus(CPUState *cs, vaddr addr,
|
||||
MMUAccessType access_type, uintptr_t retaddr)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
|
||||
do_unaligned_access(env, addr, retaddr);
|
||||
do_unaligned_access(cpu_env(cs), addr, retaddr);
|
||||
}
|
||||
#else
|
||||
void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
||||
MMUAccessType access_type,
|
||||
int mmu_idx, uintptr_t retaddr)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
|
||||
do_unaligned_access(env, addr, retaddr);
|
||||
cs->exception_index = EXCP_UNALIGN;
|
||||
@ -67,8 +63,7 @@ void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||
int mmu_idx, MemTxAttrs attrs,
|
||||
MemTxResult response, uintptr_t retaddr)
|
||||
{
|
||||
AlphaCPU *cpu = ALPHA_CPU(cs);
|
||||
CPUAlphaState *env = &cpu->env;
|
||||
CPUAlphaState *env = cpu_env(cs);
|
||||
|
||||
env->trap_arg0 = addr;
|
||||
env->trap_arg1 = access_type == MMU_DATA_STORE ? 1 : 0;
|
||||
|
@ -2903,8 +2903,8 @@ static void alpha_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||
static void alpha_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||
{
|
||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||
CPUAlphaState *env = cpu_env(cpu);
|
||||
uint32_t insn = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
||||
uint32_t insn = translator_ldl(cpu_env(cpu), &ctx->base,
|
||||
ctx->base.pc_next);
|
||||
|
||||
ctx->base.pc_next += 4;
|
||||
ctx->base.is_jmp = translate_one(ctx, insn);
|
||||
|
@ -214,9 +214,9 @@ static void cp_reg_check_reset(gpointer key, gpointer value, gpointer opaque)
|
||||
|
||||
static void arm_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *s = CPU(obj);
|
||||
ARMCPU *cpu = ARM_CPU(s);
|
||||
ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu);
|
||||
CPUState *cs = CPU(obj);
|
||||
ARMCPU *cpu = ARM_CPU(cs);
|
||||
ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj);
|
||||
CPUARMState *env = &cpu->env;
|
||||
|
||||
if (acc->parent_phases.hold) {
|
||||
@ -233,7 +233,7 @@ static void arm_cpu_reset_hold(Object *obj)
|
||||
env->vfp.xregs[ARM_VFP_MVFR1] = cpu->isar.mvfr1;
|
||||
env->vfp.xregs[ARM_VFP_MVFR2] = cpu->isar.mvfr2;
|
||||
|
||||
cpu->power_state = s->start_powered_off ? PSCI_OFF : PSCI_ON;
|
||||
cpu->power_state = cs->start_powered_off ? PSCI_OFF : PSCI_ON;
|
||||
|
||||
if (arm_feature(env, ARM_FEATURE_IWMMXT)) {
|
||||
env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q';
|
||||
@ -438,7 +438,7 @@ static void arm_cpu_reset_hold(Object *obj)
|
||||
|
||||
/* Load the initial SP and PC from offset 0 and 4 in the vector table */
|
||||
vecbase = env->v7m.vecbase[env->v7m.secure];
|
||||
rom = rom_ptr_for_as(s->as, vecbase, 8);
|
||||
rom = rom_ptr_for_as(cs->as, vecbase, 8);
|
||||
if (rom) {
|
||||
/* Address zero is covered by ROM which hasn't yet been
|
||||
* copied into physical memory.
|
||||
@ -451,8 +451,8 @@ static void arm_cpu_reset_hold(Object *obj)
|
||||
* it got copied into memory. In the latter case, rom_ptr
|
||||
* will return a NULL pointer and we should use ldl_phys instead.
|
||||
*/
|
||||
initial_msp = ldl_phys(s->as, vecbase);
|
||||
initial_pc = ldl_phys(s->as, vecbase + 4);
|
||||
initial_msp = ldl_phys(cs->as, vecbase);
|
||||
initial_pc = ldl_phys(cs->as, vecbase + 4);
|
||||
}
|
||||
|
||||
qemu_log_mask(CPU_LOG_INT,
|
||||
@ -2095,7 +2095,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
* We rely on no XScale CPU having VFP so we can use the same bits in the
|
||||
* TB flags field for VECSTRIDE and XSCALE_CPAR.
|
||||
*/
|
||||
assert(arm_feature(&cpu->env, ARM_FEATURE_AARCH64) ||
|
||||
assert(arm_feature(env, ARM_FEATURE_AARCH64) ||
|
||||
!cpu_isar_feature(aa32_vfp_simd, cpu) ||
|
||||
!arm_feature(env, ARM_FEATURE_XSCALE));
|
||||
|
||||
@ -2145,7 +2145,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
if (cpu->cfgend) {
|
||||
if (arm_feature(&cpu->env, ARM_FEATURE_V7)) {
|
||||
if (arm_feature(env, ARM_FEATURE_V7)) {
|
||||
cpu->reset_sctlr |= SCTLR_EE;
|
||||
} else {
|
||||
cpu->reset_sctlr |= SCTLR_B;
|
||||
|
@ -1888,7 +1888,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
||||
cpu->psci_version = QEMU_PSCI_VERSION_0_2;
|
||||
cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
|
||||
}
|
||||
if (!arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
|
||||
if (!arm_feature(env, ARM_FEATURE_AARCH64)) {
|
||||
cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_EL1_32BIT;
|
||||
}
|
||||
if (!kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) {
|
||||
|
@ -773,7 +773,7 @@ static int cpu_pre_load(void *opaque)
|
||||
env->irq_line_state = UINT32_MAX;
|
||||
|
||||
if (!kvm_enabled()) {
|
||||
pmu_op_start(&cpu->env);
|
||||
pmu_op_start(env);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -871,11 +871,11 @@ static int cpu_post_load(void *opaque, int version_id)
|
||||
}
|
||||
|
||||
if (!kvm_enabled()) {
|
||||
pmu_op_finish(&cpu->env);
|
||||
pmu_op_finish(env);
|
||||
}
|
||||
|
||||
if (tcg_enabled()) {
|
||||
arm_rebuild_hflags(&cpu->env);
|
||||
arm_rebuild_hflags(env);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -43,11 +43,8 @@ static vaddr avr_cpu_get_pc(CPUState *cs)
|
||||
|
||||
static bool avr_cpu_has_work(CPUState *cs)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
|
||||
return (cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_RESET))
|
||||
&& cpu_interrupts_enabled(env);
|
||||
&& cpu_interrupts_enabled(cpu_env(cs));
|
||||
}
|
||||
|
||||
static int avr_cpu_mmu_index(CPUState *cs, bool ifetch)
|
||||
@ -58,28 +55,22 @@ static int avr_cpu_mmu_index(CPUState *cs, bool ifetch)
|
||||
static void avr_cpu_synchronize_from_tb(CPUState *cs,
|
||||
const TranslationBlock *tb)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
|
||||
tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL));
|
||||
env->pc_w = tb->pc / 2; /* internally PC points to words */
|
||||
cpu_env(cs)->pc_w = tb->pc / 2; /* internally PC points to words */
|
||||
}
|
||||
|
||||
static void avr_restore_state_to_opc(CPUState *cs,
|
||||
const TranslationBlock *tb,
|
||||
const uint64_t *data)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
|
||||
env->pc_w = data[0];
|
||||
cpu_env(cs)->pc_w = data[0];
|
||||
}
|
||||
|
||||
static void avr_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *cs = CPU(obj);
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
AVRCPUClass *mcc = AVR_CPU_GET_CLASS(cpu);
|
||||
AVRCPUClass *mcc = AVR_CPU_GET_CLASS(obj);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
|
||||
if (mcc->parent_phases.hold) {
|
||||
@ -170,8 +161,7 @@ static ObjectClass *avr_cpu_class_by_name(const char *cpu_model)
|
||||
|
||||
static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
int i;
|
||||
|
||||
qemu_fprintf(f, "\n");
|
||||
@ -281,8 +271,7 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
|
||||
*/
|
||||
static void avr_avr5_initfn(Object *obj)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(obj);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(CPU(obj));
|
||||
|
||||
set_avr_feature(env, AVR_FEATURE_LPM);
|
||||
set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
|
||||
@ -310,8 +299,7 @@ static void avr_avr5_initfn(Object *obj)
|
||||
*/
|
||||
static void avr_avr51_initfn(Object *obj)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(obj);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(CPU(obj));
|
||||
|
||||
set_avr_feature(env, AVR_FEATURE_LPM);
|
||||
set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
|
||||
@ -340,8 +328,7 @@ static void avr_avr51_initfn(Object *obj)
|
||||
*/
|
||||
static void avr_avr6_initfn(Object *obj)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(obj);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(CPU(obj));
|
||||
|
||||
set_avr_feature(env, AVR_FEATURE_LPM);
|
||||
set_avr_feature(env, AVR_FEATURE_IJMP_ICALL);
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
int avr_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
|
||||
/* R */
|
||||
if (n < 32) {
|
||||
@ -53,8 +52,7 @@ int avr_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int avr_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
|
||||
/* R */
|
||||
if (n < 32) {
|
||||
|
@ -30,8 +30,7 @@
|
||||
|
||||
bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
|
||||
/*
|
||||
* We cannot separate a skip from the next instruction,
|
||||
@ -69,8 +68,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
|
||||
void avr_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
|
||||
uint32_t ret = env->pc_w;
|
||||
int vector = 0;
|
||||
@ -144,9 +142,7 @@ bool avr_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
if (probe) {
|
||||
page_size = 1;
|
||||
} else {
|
||||
AVRCPU *cpu = AVR_CPU(cs);
|
||||
CPUAVRState *env = &cpu->env;
|
||||
env->fullacc = 1;
|
||||
cpu_env(cs)->fullacc = 1;
|
||||
cpu_loop_exit_restore(cs, retaddr);
|
||||
}
|
||||
}
|
||||
|
@ -2657,11 +2657,10 @@ static bool canonicalize_skip(DisasContext *ctx)
|
||||
static void avr_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
|
||||
{
|
||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||
CPUAVRState *env = cpu_env(cs);
|
||||
uint32_t tb_flags = ctx->base.tb->flags;
|
||||
|
||||
ctx->cs = cs;
|
||||
ctx->env = env;
|
||||
ctx->env = cpu_env(cs);
|
||||
ctx->npc = ctx->base.pc_first / 2;
|
||||
|
||||
ctx->skip_cond = TCG_COND_NEVER;
|
||||
|
@ -63,10 +63,9 @@ static int cris_cpu_mmu_index(CPUState *cs, bool ifetch)
|
||||
|
||||
static void cris_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *s = CPU(obj);
|
||||
CRISCPU *cpu = CRIS_CPU(s);
|
||||
CRISCPUClass *ccc = CRIS_CPU_GET_CLASS(cpu);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUState *cs = CPU(obj);
|
||||
CRISCPUClass *ccc = CRIS_CPU_GET_CLASS(obj);
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
uint32_t vr;
|
||||
|
||||
if (ccc->parent_phases.hold) {
|
||||
@ -147,10 +146,7 @@ static void cris_cpu_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
static void cris_disas_set_info(CPUState *cpu, disassemble_info *info)
|
||||
{
|
||||
CRISCPU *cc = CRIS_CPU(cpu);
|
||||
CPUCRISState *env = &cc->env;
|
||||
|
||||
if (env->pregs[PR_VR] != 32) {
|
||||
if (cpu_env(cpu)->pregs[PR_VR] != 32) {
|
||||
info->mach = bfd_mach_cris_v0_v10;
|
||||
info->print_insn = print_insn_crisv10;
|
||||
} else {
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
int crisv10_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
|
||||
if (n < 15) {
|
||||
return gdb_get_reg32(mem_buf, env->regs[n]);
|
||||
@ -55,8 +54,7 @@ int crisv10_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int cris_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
uint8_t srs;
|
||||
|
||||
srs = env->pregs[PR_SRS];
|
||||
@ -90,8 +88,7 @@ int cris_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int cris_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
uint32_t tmp;
|
||||
|
||||
if (n > 49) {
|
||||
|
@ -53,8 +53,7 @@ bool cris_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
MMUAccessType access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
struct cris_mmu_result res;
|
||||
int prot, miss;
|
||||
target_ulong phy;
|
||||
@ -97,8 +96,7 @@ bool cris_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
|
||||
void crisv10_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
int ex_vec = -1;
|
||||
|
||||
D_LOG("exception index=%d interrupt_req=%d\n",
|
||||
@ -159,8 +157,7 @@ void crisv10_cpu_do_interrupt(CPUState *cs)
|
||||
|
||||
void cris_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
int ex_vec = -1;
|
||||
|
||||
D_LOG("exception index=%d interrupt_req=%d\n",
|
||||
@ -262,8 +259,7 @@ hwaddr cris_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||
bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cs);
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
bool ret = false;
|
||||
|
||||
if (interrupt_request & CPU_INTERRUPT_HARD
|
||||
|
@ -3002,7 +3002,6 @@ static void cris_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
|
||||
static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||
{
|
||||
DisasContext *dc = container_of(dcbase, DisasContext, base);
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
unsigned int insn_len;
|
||||
|
||||
/* Pretty disas. */
|
||||
@ -3010,7 +3009,7 @@ static void cris_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||
|
||||
dc->clear_x = 1;
|
||||
|
||||
insn_len = dc->decoder(env, dc);
|
||||
insn_len = dc->decoder(cpu_env(cs), dc);
|
||||
dc->ppc = dc->pc;
|
||||
dc->pc += insn_len;
|
||||
dc->base.pc_next += insn_len;
|
||||
@ -3176,8 +3175,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int *max_insns,
|
||||
|
||||
void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
CRISCPU *cpu = CRIS_CPU(cs);
|
||||
CPUCRISState *env = &cpu->env;
|
||||
CPUCRISState *env = cpu_env(cs);
|
||||
const char * const *regnames;
|
||||
const char * const *pregnames;
|
||||
int i;
|
||||
|
@ -236,10 +236,7 @@ static void hexagon_dump(CPUHexagonState *env, FILE *f, int flags)
|
||||
|
||||
static void hexagon_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
|
||||
hexagon_dump(env, f, flags);
|
||||
hexagon_dump(cpu_env(cs), f, flags);
|
||||
}
|
||||
|
||||
void hexagon_debug(CPUHexagonState *env)
|
||||
@ -249,25 +246,19 @@ void hexagon_debug(CPUHexagonState *env)
|
||||
|
||||
static void hexagon_cpu_set_pc(CPUState *cs, vaddr value)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
env->gpr[HEX_REG_PC] = value;
|
||||
cpu_env(cs)->gpr[HEX_REG_PC] = value;
|
||||
}
|
||||
|
||||
static vaddr hexagon_cpu_get_pc(CPUState *cs)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
return env->gpr[HEX_REG_PC];
|
||||
return cpu_env(cs)->gpr[HEX_REG_PC];
|
||||
}
|
||||
|
||||
static void hexagon_cpu_synchronize_from_tb(CPUState *cs,
|
||||
const TranslationBlock *tb)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL));
|
||||
env->gpr[HEX_REG_PC] = tb->pc;
|
||||
cpu_env(cs)->gpr[HEX_REG_PC] = tb->pc;
|
||||
}
|
||||
|
||||
static bool hexagon_cpu_has_work(CPUState *cs)
|
||||
@ -279,18 +270,14 @@ static void hexagon_restore_state_to_opc(CPUState *cs,
|
||||
const TranslationBlock *tb,
|
||||
const uint64_t *data)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
|
||||
env->gpr[HEX_REG_PC] = data[0];
|
||||
cpu_env(cs)->gpr[HEX_REG_PC] = data[0];
|
||||
}
|
||||
|
||||
static void hexagon_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *cs = CPU(obj);
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
HexagonCPUClass *mcc = HEXAGON_CPU_GET_CLASS(cpu);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
HexagonCPUClass *mcc = HEXAGON_CPU_GET_CLASS(obj);
|
||||
CPUHexagonState *env = cpu_env(cs);
|
||||
|
||||
if (mcc->parent_phases.hold) {
|
||||
mcc->parent_phases.hold(obj);
|
||||
|
@ -22,8 +22,7 @@
|
||||
|
||||
int hexagon_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
CPUHexagonState *env = cpu_env(cs);
|
||||
|
||||
if (n == HEX_REG_P3_0_ALIASED) {
|
||||
uint32_t p3_0 = 0;
|
||||
@ -42,8 +41,7 @@ int hexagon_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int hexagon_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
HexagonCPU *cpu = HEXAGON_CPU(cs);
|
||||
CPUHexagonState *env = &cpu->env;
|
||||
CPUHexagonState *env = cpu_env(cs);
|
||||
|
||||
if (n == HEX_REG_P3_0_ALIASED) {
|
||||
uint32_t p3_0 = ldtul_p(mem_buf);
|
||||
|
@ -538,7 +538,6 @@ void HELPER(iitlbt_pa20)(CPUHPPAState *env, target_ulong r1, target_ulong r2)
|
||||
/* Purge (Insn/Data) TLB. */
|
||||
static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
|
||||
{
|
||||
CPUHPPAState *env = cpu_env(cpu);
|
||||
vaddr start = data.target_ptr;
|
||||
vaddr end;
|
||||
|
||||
@ -552,7 +551,7 @@ static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
|
||||
end = (vaddr)TARGET_PAGE_SIZE << (2 * end);
|
||||
end = start + end - 1;
|
||||
|
||||
hppa_flush_tlb_range(env, start, end);
|
||||
hppa_flush_tlb_range(cpu_env(cpu), start, end);
|
||||
}
|
||||
|
||||
/* This is local to the current cpu. */
|
||||
|
@ -3811,8 +3811,7 @@ static bool trans_b_gate(DisasContext *ctx, arg_b_gate *a)
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
if (ctx->tb_flags & PSW_C) {
|
||||
CPUHPPAState *env = cpu_env(ctx->cs);
|
||||
int type = hppa_artype_for_page(env, ctx->base.pc_next);
|
||||
int type = hppa_artype_for_page(cpu_env(ctx->cs), ctx->base.pc_next);
|
||||
/* If we could not find a TLB entry, then we need to generate an
|
||||
ITLB miss exception so the kernel will provide it.
|
||||
The resulting TLB fill operation will invalidate this TB and
|
||||
|
@ -6695,9 +6695,9 @@ static void x86_cpu_set_sgxlepubkeyhash(CPUX86State *env)
|
||||
|
||||
static void x86_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *s = CPU(obj);
|
||||
X86CPU *cpu = X86_CPU(s);
|
||||
X86CPUClass *xcc = X86_CPU_GET_CLASS(cpu);
|
||||
CPUState *cs = CPU(obj);
|
||||
X86CPU *cpu = X86_CPU(cs);
|
||||
X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
target_ulong cr4;
|
||||
uint64_t xcr0;
|
||||
@ -6785,8 +6785,8 @@ static void x86_cpu_reset_hold(Object *obj)
|
||||
memset(env->dr, 0, sizeof(env->dr));
|
||||
env->dr[6] = DR6_FIXED_1;
|
||||
env->dr[7] = DR7_FIXED_1;
|
||||
cpu_breakpoint_remove_all(s, BP_CPU);
|
||||
cpu_watchpoint_remove_all(s, BP_CPU);
|
||||
cpu_breakpoint_remove_all(cs, BP_CPU);
|
||||
cpu_watchpoint_remove_all(cs, BP_CPU);
|
||||
|
||||
cr4 = 0;
|
||||
xcr0 = XSTATE_FP_MASK;
|
||||
@ -6837,9 +6837,9 @@ static void x86_cpu_reset_hold(Object *obj)
|
||||
env->triple_fault_pending = false;
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
/* We hard-wire the BSP to the first CPU. */
|
||||
apic_designate_bsp(cpu->apic_state, s->cpu_index == 0);
|
||||
apic_designate_bsp(cpu->apic_state, cs->cpu_index == 0);
|
||||
|
||||
s->halted = !cpu_is_bsp(cpu);
|
||||
cs->halted = !cpu_is_bsp(cpu);
|
||||
|
||||
if (kvm_enabled()) {
|
||||
kvm_arch_reset_vcpu(cpu);
|
||||
|
@ -46,7 +46,7 @@
|
||||
return ar;
|
||||
}*/
|
||||
|
||||
bool x86_read_segment_descriptor(struct CPUState *cpu,
|
||||
bool x86_read_segment_descriptor(CPUState *cpu,
|
||||
struct x86_segment_descriptor *desc,
|
||||
x68_segment_selector sel)
|
||||
{
|
||||
@ -76,7 +76,7 @@ bool x86_read_segment_descriptor(struct CPUState *cpu,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool x86_write_segment_descriptor(struct CPUState *cpu,
|
||||
bool x86_write_segment_descriptor(CPUState *cpu,
|
||||
struct x86_segment_descriptor *desc,
|
||||
x68_segment_selector sel)
|
||||
{
|
||||
@ -99,7 +99,7 @@ bool x86_write_segment_descriptor(struct CPUState *cpu,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool x86_read_call_gate(struct CPUState *cpu, struct x86_call_gate *idt_desc,
|
||||
bool x86_read_call_gate(CPUState *cpu, struct x86_call_gate *idt_desc,
|
||||
int gate)
|
||||
{
|
||||
target_ulong base = rvmcs(cpu->accel->fd, VMCS_GUEST_IDTR_BASE);
|
||||
@ -115,30 +115,30 @@ bool x86_read_call_gate(struct CPUState *cpu, struct x86_call_gate *idt_desc,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool x86_is_protected(struct CPUState *cpu)
|
||||
bool x86_is_protected(CPUState *cpu)
|
||||
{
|
||||
uint64_t cr0 = rvmcs(cpu->accel->fd, VMCS_GUEST_CR0);
|
||||
return cr0 & CR0_PE_MASK;
|
||||
}
|
||||
|
||||
bool x86_is_real(struct CPUState *cpu)
|
||||
bool x86_is_real(CPUState *cpu)
|
||||
{
|
||||
return !x86_is_protected(cpu);
|
||||
}
|
||||
|
||||
bool x86_is_v8086(struct CPUState *cpu)
|
||||
bool x86_is_v8086(CPUState *cpu)
|
||||
{
|
||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||
CPUX86State *env = &x86_cpu->env;
|
||||
return x86_is_protected(cpu) && (env->eflags & VM_MASK);
|
||||
}
|
||||
|
||||
bool x86_is_long_mode(struct CPUState *cpu)
|
||||
bool x86_is_long_mode(CPUState *cpu)
|
||||
{
|
||||
return rvmcs(cpu->accel->fd, VMCS_GUEST_IA32_EFER) & MSR_EFER_LMA;
|
||||
}
|
||||
|
||||
bool x86_is_long64_mode(struct CPUState *cpu)
|
||||
bool x86_is_long64_mode(CPUState *cpu)
|
||||
{
|
||||
struct vmx_segment desc;
|
||||
vmx_read_segment_descriptor(cpu, &desc, R_CS);
|
||||
@ -146,24 +146,24 @@ bool x86_is_long64_mode(struct CPUState *cpu)
|
||||
return x86_is_long_mode(cpu) && ((desc.ar >> 13) & 1);
|
||||
}
|
||||
|
||||
bool x86_is_paging_mode(struct CPUState *cpu)
|
||||
bool x86_is_paging_mode(CPUState *cpu)
|
||||
{
|
||||
uint64_t cr0 = rvmcs(cpu->accel->fd, VMCS_GUEST_CR0);
|
||||
return cr0 & CR0_PG_MASK;
|
||||
}
|
||||
|
||||
bool x86_is_pae_enabled(struct CPUState *cpu)
|
||||
bool x86_is_pae_enabled(CPUState *cpu)
|
||||
{
|
||||
uint64_t cr4 = rvmcs(cpu->accel->fd, VMCS_GUEST_CR4);
|
||||
return cr4 & CR4_PAE_MASK;
|
||||
}
|
||||
|
||||
target_ulong linear_addr(struct CPUState *cpu, target_ulong addr, X86Seg seg)
|
||||
target_ulong linear_addr(CPUState *cpu, target_ulong addr, X86Seg seg)
|
||||
{
|
||||
return vmx_read_segment_base(cpu, seg) + addr;
|
||||
}
|
||||
|
||||
target_ulong linear_addr_size(struct CPUState *cpu, target_ulong addr, int size,
|
||||
target_ulong linear_addr_size(CPUState *cpu, target_ulong addr, int size,
|
||||
X86Seg seg)
|
||||
{
|
||||
switch (size) {
|
||||
@ -179,7 +179,7 @@ target_ulong linear_addr_size(struct CPUState *cpu, target_ulong addr, int size,
|
||||
return linear_addr(cpu, addr, seg);
|
||||
}
|
||||
|
||||
target_ulong linear_rip(struct CPUState *cpu, target_ulong rip)
|
||||
target_ulong linear_rip(CPUState *cpu, target_ulong rip)
|
||||
{
|
||||
return linear_addr(cpu, rip, R_CS);
|
||||
}
|
||||
|
@ -248,30 +248,30 @@ typedef struct x68_segment_selector {
|
||||
#define BH(cpu) RH(cpu, R_EBX)
|
||||
|
||||
/* deal with GDT/LDT descriptors in memory */
|
||||
bool x86_read_segment_descriptor(struct CPUState *cpu,
|
||||
bool x86_read_segment_descriptor(CPUState *cpu,
|
||||
struct x86_segment_descriptor *desc,
|
||||
x68_segment_selector sel);
|
||||
bool x86_write_segment_descriptor(struct CPUState *cpu,
|
||||
bool x86_write_segment_descriptor(CPUState *cpu,
|
||||
struct x86_segment_descriptor *desc,
|
||||
x68_segment_selector sel);
|
||||
|
||||
bool x86_read_call_gate(struct CPUState *cpu, struct x86_call_gate *idt_desc,
|
||||
bool x86_read_call_gate(CPUState *cpu, struct x86_call_gate *idt_desc,
|
||||
int gate);
|
||||
|
||||
/* helpers */
|
||||
bool x86_is_protected(struct CPUState *cpu);
|
||||
bool x86_is_real(struct CPUState *cpu);
|
||||
bool x86_is_v8086(struct CPUState *cpu);
|
||||
bool x86_is_long_mode(struct CPUState *cpu);
|
||||
bool x86_is_long64_mode(struct CPUState *cpu);
|
||||
bool x86_is_paging_mode(struct CPUState *cpu);
|
||||
bool x86_is_pae_enabled(struct CPUState *cpu);
|
||||
bool x86_is_protected(CPUState *cpu);
|
||||
bool x86_is_real(CPUState *cpu);
|
||||
bool x86_is_v8086(CPUState *cpu);
|
||||
bool x86_is_long_mode(CPUState *cpu);
|
||||
bool x86_is_long64_mode(CPUState *cpu);
|
||||
bool x86_is_paging_mode(CPUState *cpu);
|
||||
bool x86_is_pae_enabled(CPUState *cpu);
|
||||
|
||||
enum X86Seg;
|
||||
target_ulong linear_addr(struct CPUState *cpu, target_ulong addr, enum X86Seg seg);
|
||||
target_ulong linear_addr_size(struct CPUState *cpu, target_ulong addr, int size,
|
||||
target_ulong linear_addr(CPUState *cpu, target_ulong addr, enum X86Seg seg);
|
||||
target_ulong linear_addr_size(CPUState *cpu, target_ulong addr, int size,
|
||||
enum X86Seg seg);
|
||||
target_ulong linear_rip(struct CPUState *cpu, target_ulong rip);
|
||||
target_ulong linear_rip(CPUState *cpu, target_ulong rip);
|
||||
|
||||
static inline uint64_t rdtscp(void)
|
||||
{
|
||||
|
@ -67,12 +67,12 @@ x68_segment_selector vmx_read_segment_selector(CPUState *cpu, X86Seg seg)
|
||||
return sel;
|
||||
}
|
||||
|
||||
void vmx_write_segment_selector(struct CPUState *cpu, x68_segment_selector selector, X86Seg seg)
|
||||
void vmx_write_segment_selector(CPUState *cpu, x68_segment_selector selector, X86Seg seg)
|
||||
{
|
||||
wvmcs(cpu->accel->fd, vmx_segment_fields[seg].selector, selector.sel);
|
||||
}
|
||||
|
||||
void vmx_read_segment_descriptor(struct CPUState *cpu, struct vmx_segment *desc, X86Seg seg)
|
||||
void vmx_read_segment_descriptor(CPUState *cpu, struct vmx_segment *desc, X86Seg seg)
|
||||
{
|
||||
desc->sel = rvmcs(cpu->accel->fd, vmx_segment_fields[seg].selector);
|
||||
desc->base = rvmcs(cpu->accel->fd, vmx_segment_fields[seg].base);
|
||||
@ -90,7 +90,9 @@ void vmx_write_segment_descriptor(CPUState *cpu, struct vmx_segment *desc, X86Se
|
||||
wvmcs(cpu->accel->fd, sf->ar_bytes, desc->ar);
|
||||
}
|
||||
|
||||
void x86_segment_descriptor_to_vmx(struct CPUState *cpu, x68_segment_selector selector, struct x86_segment_descriptor *desc, struct vmx_segment *vmx_desc)
|
||||
void x86_segment_descriptor_to_vmx(CPUState *cpu, x68_segment_selector selector,
|
||||
struct x86_segment_descriptor *desc,
|
||||
struct vmx_segment *vmx_desc)
|
||||
{
|
||||
vmx_desc->sel = selector.sel;
|
||||
vmx_desc->base = x86_segment_base(desc);
|
||||
@ -107,7 +109,8 @@ void x86_segment_descriptor_to_vmx(struct CPUState *cpu, x68_segment_selector se
|
||||
desc->type;
|
||||
}
|
||||
|
||||
void vmx_segment_to_x86_descriptor(struct CPUState *cpu, struct vmx_segment *vmx_desc, struct x86_segment_descriptor *desc)
|
||||
void vmx_segment_to_x86_descriptor(CPUState *cpu, struct vmx_segment *vmx_desc,
|
||||
struct x86_segment_descriptor *desc)
|
||||
{
|
||||
x86_set_segment_limit(desc, vmx_desc->limit);
|
||||
x86_set_segment_base(desc, vmx_desc->base);
|
||||
|
@ -29,29 +29,29 @@ typedef struct vmx_segment {
|
||||
} vmx_segment;
|
||||
|
||||
/* deal with vmstate descriptors */
|
||||
void vmx_read_segment_descriptor(struct CPUState *cpu,
|
||||
void vmx_read_segment_descriptor(CPUState *cpu,
|
||||
struct vmx_segment *desc, enum X86Seg seg);
|
||||
void vmx_write_segment_descriptor(CPUState *cpu, struct vmx_segment *desc,
|
||||
enum X86Seg seg);
|
||||
|
||||
x68_segment_selector vmx_read_segment_selector(struct CPUState *cpu,
|
||||
x68_segment_selector vmx_read_segment_selector(CPUState *cpu,
|
||||
enum X86Seg seg);
|
||||
void vmx_write_segment_selector(struct CPUState *cpu,
|
||||
void vmx_write_segment_selector(CPUState *cpu,
|
||||
x68_segment_selector selector,
|
||||
enum X86Seg seg);
|
||||
|
||||
uint64_t vmx_read_segment_base(struct CPUState *cpu, enum X86Seg seg);
|
||||
void vmx_write_segment_base(struct CPUState *cpu, enum X86Seg seg,
|
||||
uint64_t vmx_read_segment_base(CPUState *cpu, enum X86Seg seg);
|
||||
void vmx_write_segment_base(CPUState *cpu, enum X86Seg seg,
|
||||
uint64_t base);
|
||||
|
||||
void x86_segment_descriptor_to_vmx(struct CPUState *cpu,
|
||||
void x86_segment_descriptor_to_vmx(CPUState *cpu,
|
||||
x68_segment_selector selector,
|
||||
struct x86_segment_descriptor *desc,
|
||||
struct vmx_segment *vmx_desc);
|
||||
|
||||
uint32_t vmx_read_segment_limit(CPUState *cpu, enum X86Seg seg);
|
||||
uint32_t vmx_read_segment_ar(CPUState *cpu, enum X86Seg seg);
|
||||
void vmx_segment_to_x86_descriptor(struct CPUState *cpu,
|
||||
void vmx_segment_to_x86_descriptor(CPUState *cpu,
|
||||
struct vmx_segment *vmx_desc,
|
||||
struct x86_segment_descriptor *desc);
|
||||
|
||||
|
@ -26,8 +26,8 @@
|
||||
void init_emu(void);
|
||||
bool exec_instruction(CPUX86State *env, struct x86_decode *ins);
|
||||
|
||||
void load_regs(struct CPUState *cpu);
|
||||
void store_regs(struct CPUState *cpu);
|
||||
void load_regs(CPUState *cpu);
|
||||
void store_regs(CPUState *cpu);
|
||||
|
||||
void simulate_rdmsr(CPUX86State *env);
|
||||
void simulate_wrmsr(CPUX86State *env);
|
||||
|
@ -49,7 +49,7 @@ struct gpt_translation {
|
||||
bool exec_access;
|
||||
};
|
||||
|
||||
static int gpt_top_level(struct CPUState *cpu, bool pae)
|
||||
static int gpt_top_level(CPUState *cpu, bool pae)
|
||||
{
|
||||
if (!pae) {
|
||||
return 2;
|
||||
@ -73,7 +73,7 @@ static inline int pte_size(bool pae)
|
||||
}
|
||||
|
||||
|
||||
static bool get_pt_entry(struct CPUState *cpu, struct gpt_translation *pt,
|
||||
static bool get_pt_entry(CPUState *cpu, struct gpt_translation *pt,
|
||||
int level, bool pae)
|
||||
{
|
||||
int index;
|
||||
@ -95,7 +95,7 @@ static bool get_pt_entry(struct CPUState *cpu, struct gpt_translation *pt,
|
||||
}
|
||||
|
||||
/* test page table entry */
|
||||
static bool test_pt_entry(struct CPUState *cpu, struct gpt_translation *pt,
|
||||
static bool test_pt_entry(CPUState *cpu, struct gpt_translation *pt,
|
||||
int level, bool *is_large, bool pae)
|
||||
{
|
||||
uint64_t pte = pt->pte[level];
|
||||
@ -166,7 +166,7 @@ static inline uint64_t large_page_gpa(struct gpt_translation *pt, bool pae)
|
||||
|
||||
|
||||
|
||||
static bool walk_gpt(struct CPUState *cpu, target_ulong addr, int err_code,
|
||||
static bool walk_gpt(CPUState *cpu, target_ulong addr, int err_code,
|
||||
struct gpt_translation *pt, bool pae)
|
||||
{
|
||||
int top_level, level;
|
||||
@ -205,7 +205,7 @@ static bool walk_gpt(struct CPUState *cpu, target_ulong addr, int err_code,
|
||||
}
|
||||
|
||||
|
||||
bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa)
|
||||
bool mmu_gva_to_gpa(CPUState *cpu, target_ulong gva, uint64_t *gpa)
|
||||
{
|
||||
bool res;
|
||||
struct gpt_translation pt;
|
||||
@ -225,7 +225,7 @@ bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa)
|
||||
return false;
|
||||
}
|
||||
|
||||
void vmx_write_mem(struct CPUState *cpu, target_ulong gva, void *data, int bytes)
|
||||
void vmx_write_mem(CPUState *cpu, target_ulong gva, void *data, int bytes)
|
||||
{
|
||||
uint64_t gpa;
|
||||
|
||||
@ -246,7 +246,7 @@ void vmx_write_mem(struct CPUState *cpu, target_ulong gva, void *data, int bytes
|
||||
}
|
||||
}
|
||||
|
||||
void vmx_read_mem(struct CPUState *cpu, void *data, target_ulong gva, int bytes)
|
||||
void vmx_read_mem(CPUState *cpu, void *data, target_ulong gva, int bytes)
|
||||
{
|
||||
uint64_t gpa;
|
||||
|
||||
|
@ -36,9 +36,9 @@
|
||||
#define MMU_PAGE_US (1 << 2)
|
||||
#define MMU_PAGE_NX (1 << 3)
|
||||
|
||||
bool mmu_gva_to_gpa(struct CPUState *cpu, target_ulong gva, uint64_t *gpa);
|
||||
bool mmu_gva_to_gpa(CPUState *cpu, target_ulong gva, uint64_t *gpa);
|
||||
|
||||
void vmx_write_mem(struct CPUState *cpu, target_ulong gva, void *data, int bytes);
|
||||
void vmx_read_mem(struct CPUState *cpu, void *data, target_ulong gva, int bytes);
|
||||
void vmx_write_mem(CPUState *cpu, target_ulong gva, void *data, int bytes);
|
||||
void vmx_read_mem(CPUState *cpu, void *data, target_ulong gva, int bytes);
|
||||
|
||||
#endif /* X86_MMU_H */
|
||||
|
@ -408,7 +408,7 @@ bool hvf_inject_interrupts(CPUState *cs)
|
||||
if (!(env->hflags & HF_INHIBIT_IRQ_MASK) &&
|
||||
(cs->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||
(env->eflags & IF_MASK) && !(info & VMCS_INTR_VALID)) {
|
||||
int line = cpu_get_pic_interrupt(&x86cpu->env);
|
||||
int line = cpu_get_pic_interrupt(env);
|
||||
cs->interrupt_request &= ~CPU_INTERRUPT_HARD;
|
||||
if (line >= 0) {
|
||||
wvmcs(cs->accel->fd, VMCS_ENTRY_INTR_INFO, line |
|
||||
|
@ -340,7 +340,6 @@ nvmm_get_registers(CPUState *cpu)
|
||||
static bool
|
||||
nvmm_can_take_int(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
AccelCPUState *qcpu = cpu->accel;
|
||||
struct nvmm_vcpu *vcpu = &qcpu->vcpu;
|
||||
struct nvmm_machine *mach = get_nvmm_mach();
|
||||
@ -349,7 +348,7 @@ nvmm_can_take_int(CPUState *cpu)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (qcpu->int_shadow || !(env->eflags & IF_MASK)) {
|
||||
if (qcpu->int_shadow || !(cpu_env(cpu)->eflags & IF_MASK)) {
|
||||
struct nvmm_x64_state *state = vcpu->state;
|
||||
|
||||
/* Exit on interrupt window. */
|
||||
@ -645,13 +644,12 @@ static int
|
||||
nvmm_handle_halted(struct nvmm_machine *mach, CPUState *cpu,
|
||||
struct nvmm_vcpu_exit *exit)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
int ret = 0;
|
||||
|
||||
bql_lock();
|
||||
|
||||
if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||
(env->eflags & IF_MASK)) &&
|
||||
(cpu_env(cpu)->eflags & IF_MASK)) &&
|
||||
!(cpu->interrupt_request & CPU_INTERRUPT_NMI)) {
|
||||
cpu->exception_index = EXCP_HLT;
|
||||
cpu->halted = true;
|
||||
|
@ -300,7 +300,6 @@ static SegmentCache whpx_seg_h2q(const WHV_X64_SEGMENT_REGISTER *hs)
|
||||
/* X64 Extended Control Registers */
|
||||
static void whpx_set_xcrs(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
HRESULT hr;
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
WHV_REGISTER_VALUE xcr0;
|
||||
@ -311,7 +310,7 @@ static void whpx_set_xcrs(CPUState *cpu)
|
||||
}
|
||||
|
||||
/* Only xcr0 is supported by the hypervisor currently */
|
||||
xcr0.Reg64 = env->xcr0;
|
||||
xcr0.Reg64 = cpu_env(cpu)->xcr0;
|
||||
hr = whp_dispatch.WHvSetVirtualProcessorRegisters(
|
||||
whpx->partition, cpu->cpu_index, &xcr0_name, 1, &xcr0);
|
||||
if (FAILED(hr)) {
|
||||
@ -321,7 +320,6 @@ static void whpx_set_xcrs(CPUState *cpu)
|
||||
|
||||
static int whpx_set_tsc(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||
WHV_REGISTER_VALUE tsc_val;
|
||||
HRESULT hr;
|
||||
@ -345,7 +343,7 @@ static int whpx_set_tsc(CPUState *cpu)
|
||||
}
|
||||
}
|
||||
|
||||
tsc_val.Reg64 = env->tsc;
|
||||
tsc_val.Reg64 = cpu_env(cpu)->tsc;
|
||||
hr = whp_dispatch.WHvSetVirtualProcessorRegisters(
|
||||
whpx->partition, cpu->cpu_index, &tsc_reg, 1, &tsc_val);
|
||||
if (FAILED(hr)) {
|
||||
@ -556,7 +554,6 @@ static void whpx_set_registers(CPUState *cpu, int level)
|
||||
|
||||
static int whpx_get_tsc(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
WHV_REGISTER_NAME tsc_reg = WHvX64RegisterTsc;
|
||||
WHV_REGISTER_VALUE tsc_val;
|
||||
HRESULT hr;
|
||||
@ -569,14 +566,13 @@ static int whpx_get_tsc(CPUState *cpu)
|
||||
return -1;
|
||||
}
|
||||
|
||||
env->tsc = tsc_val.Reg64;
|
||||
cpu_env(cpu)->tsc = tsc_val.Reg64;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* X64 Extended Control Registers */
|
||||
static void whpx_get_xcrs(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
HRESULT hr;
|
||||
struct whpx_state *whpx = &whpx_global;
|
||||
WHV_REGISTER_VALUE xcr0;
|
||||
@ -594,7 +590,7 @@ static void whpx_get_xcrs(CPUState *cpu)
|
||||
return;
|
||||
}
|
||||
|
||||
env->xcr0 = xcr0.Reg64;
|
||||
cpu_env(cpu)->xcr0 = xcr0.Reg64;
|
||||
}
|
||||
|
||||
static void whpx_get_registers(CPUState *cpu)
|
||||
@ -1400,8 +1396,7 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
||||
{
|
||||
if (cpu->vcpu_dirty) {
|
||||
/* The CPU registers have been modified by other parts of QEMU. */
|
||||
CPUArchState *env = cpu_env(cpu);
|
||||
return env->eip;
|
||||
return cpu_env(cpu)->eip;
|
||||
} else if (exit_context_valid) {
|
||||
/*
|
||||
* The CPU registers have not been modified by neither other parts
|
||||
@ -1439,12 +1434,11 @@ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
|
||||
|
||||
static int whpx_handle_halt(CPUState *cpu)
|
||||
{
|
||||
CPUX86State *env = cpu_env(cpu);
|
||||
int ret = 0;
|
||||
|
||||
bql_lock();
|
||||
if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||
(env->eflags & IF_MASK)) &&
|
||||
(cpu_env(cpu)->eflags & IF_MASK)) &&
|
||||
!(cpu->interrupt_request & CPU_INTERRUPT_NMI)) {
|
||||
cpu->exception_index = EXCP_HLT;
|
||||
cpu->halted = true;
|
||||
|
@ -91,18 +91,12 @@ void G_NORETURN do_raise_exception(CPULoongArchState *env,
|
||||
|
||||
static void loongarch_cpu_set_pc(CPUState *cs, vaddr value)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
|
||||
set_pc(env, value);
|
||||
set_pc(cpu_env(cs), value);
|
||||
}
|
||||
|
||||
static vaddr loongarch_cpu_get_pc(CPUState *cs)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
|
||||
return env->pc;
|
||||
return cpu_env(cs)->pc;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
@ -157,8 +151,7 @@ static inline bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
static void loongarch_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
bool update_badinstr = 1;
|
||||
int cause = -1;
|
||||
const char *name;
|
||||
@ -308,8 +301,7 @@ static void loongarch_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||
MemTxResult response,
|
||||
uintptr_t retaddr)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
if (access_type == MMU_INST_FETCH) {
|
||||
do_raise_exception(env, EXCCODE_ADEF, retaddr);
|
||||
@ -321,8 +313,7 @@ static void loongarch_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
|
||||
static bool loongarch_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
{
|
||||
if (interrupt_request & CPU_INTERRUPT_HARD) {
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
if (cpu_loongarch_hw_interrupts_enabled(env) &&
|
||||
cpu_loongarch_hw_interrupts_pending(env)) {
|
||||
@ -339,21 +330,15 @@ static bool loongarch_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
static void loongarch_cpu_synchronize_from_tb(CPUState *cs,
|
||||
const TranslationBlock *tb)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
|
||||
tcg_debug_assert(!(cs->tcg_cflags & CF_PCREL));
|
||||
set_pc(env, tb->pc);
|
||||
set_pc(cpu_env(cs), tb->pc);
|
||||
}
|
||||
|
||||
static void loongarch_restore_state_to_opc(CPUState *cs,
|
||||
const TranslationBlock *tb,
|
||||
const uint64_t *data)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
|
||||
set_pc(env, data[0]);
|
||||
set_pc(cpu_env(cs), data[0]);
|
||||
}
|
||||
#endif /* CONFIG_TCG */
|
||||
|
||||
@ -362,12 +347,10 @@ static bool loongarch_cpu_has_work(CPUState *cs)
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
return true;
|
||||
#else
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
bool has_work = false;
|
||||
|
||||
if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||
cpu_loongarch_hw_interrupts_pending(env)) {
|
||||
cpu_loongarch_hw_interrupts_pending(cpu_env(cs))) {
|
||||
has_work = true;
|
||||
}
|
||||
|
||||
@ -509,9 +492,8 @@ static void loongarch_max_initfn(Object *obj)
|
||||
static void loongarch_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *cs = CPU(obj);
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
LoongArchCPUClass *lacc = LOONGARCH_CPU_GET_CLASS(cpu);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
LoongArchCPUClass *lacc = LOONGARCH_CPU_GET_CLASS(obj);
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
if (lacc->parent_phases.hold) {
|
||||
lacc->parent_phases.hold(obj);
|
||||
@ -694,8 +676,7 @@ static ObjectClass *loongarch_cpu_class_by_name(const char *cpu_model)
|
||||
|
||||
void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
int i;
|
||||
|
||||
qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
|
||||
|
@ -218,8 +218,7 @@ int get_physical_address(CPULoongArchState *env, hwaddr *physical,
|
||||
|
||||
hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
hwaddr phys_addr;
|
||||
int prot;
|
||||
|
||||
|
@ -33,8 +33,7 @@ void write_fcc(CPULoongArchState *env, uint64_t val)
|
||||
|
||||
int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
uint64_t val;
|
||||
|
||||
if (0 <= n && n < 32) {
|
||||
@ -60,8 +59,7 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
target_ulong tmp;
|
||||
int read_length;
|
||||
int length = 0;
|
||||
|
@ -37,8 +37,7 @@ static int kvm_loongarch_get_regs_core(CPUState *cs)
|
||||
int ret = 0;
|
||||
int i;
|
||||
struct kvm_regs regs;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
/* Get the current register set as KVM seems it */
|
||||
ret = kvm_vcpu_ioctl(cs, KVM_GET_REGS, ®s);
|
||||
@ -61,8 +60,7 @@ static int kvm_loongarch_put_regs_core(CPUState *cs)
|
||||
int ret = 0;
|
||||
int i;
|
||||
struct kvm_regs regs;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
/* Set the registers based on QEMU's view of things */
|
||||
for (i = 0; i < 32; i++) {
|
||||
@ -81,8 +79,7 @@ static int kvm_loongarch_put_regs_core(CPUState *cs)
|
||||
static int kvm_loongarch_get_csr(CPUState *cs)
|
||||
{
|
||||
int ret = 0;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
ret |= kvm_get_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_CRMD),
|
||||
&env->CSR_CRMD);
|
||||
@ -252,8 +249,7 @@ static int kvm_loongarch_get_csr(CPUState *cs)
|
||||
static int kvm_loongarch_put_csr(CPUState *cs, int level)
|
||||
{
|
||||
int ret = 0;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
ret |= kvm_set_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_CRMD),
|
||||
&env->CSR_CRMD);
|
||||
@ -429,9 +425,7 @@ static int kvm_loongarch_get_regs_fp(CPUState *cs)
|
||||
{
|
||||
int ret, i;
|
||||
struct kvm_fpu fpu;
|
||||
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
ret = kvm_vcpu_ioctl(cs, KVM_GET_FPU, &fpu);
|
||||
if (ret < 0) {
|
||||
@ -455,9 +449,7 @@ static int kvm_loongarch_put_regs_fp(CPUState *cs)
|
||||
{
|
||||
int ret, i;
|
||||
struct kvm_fpu fpu;
|
||||
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
fpu.fcsr = env->fcsr0;
|
||||
fpu.fcc = 0;
|
||||
@ -486,8 +478,7 @@ static int kvm_loongarch_get_mpstate(CPUState *cs)
|
||||
{
|
||||
int ret = 0;
|
||||
struct kvm_mp_state mp_state;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
if (cap_has_mp_state) {
|
||||
ret = kvm_vcpu_ioctl(cs, KVM_GET_MP_STATE, &mp_state);
|
||||
@ -504,12 +495,8 @@ static int kvm_loongarch_get_mpstate(CPUState *cs)
|
||||
static int kvm_loongarch_put_mpstate(CPUState *cs)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
|
||||
struct kvm_mp_state mp_state = {
|
||||
.mp_state = env->mp_state
|
||||
.mp_state = cpu_env(cs)->mp_state
|
||||
};
|
||||
|
||||
if (cap_has_mp_state) {
|
||||
@ -526,8 +513,7 @@ static int kvm_loongarch_get_cpucfg(CPUState *cs)
|
||||
{
|
||||
int i, ret = 0;
|
||||
uint64_t val;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
for (i = 0; i < 21; i++) {
|
||||
ret = kvm_get_one_reg(cs, KVM_IOC_CPUCFG(i), &val);
|
||||
@ -548,8 +534,7 @@ static int kvm_check_cpucfg2(CPUState *cs)
|
||||
.attr = 2,
|
||||
.addr = (uint64_t)&val,
|
||||
};
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
|
||||
ret = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, &attr);
|
||||
|
||||
@ -574,8 +559,7 @@ static int kvm_check_cpucfg2(CPUState *cs)
|
||||
static int kvm_loongarch_put_cpucfg(CPUState *cs)
|
||||
{
|
||||
int i, ret = 0;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
uint64_t val;
|
||||
|
||||
for (i = 0; i < 21; i++) {
|
||||
@ -757,8 +741,7 @@ bool kvm_arch_cpu_check_are_resettable(void)
|
||||
int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
|
||||
{
|
||||
int ret = 0;
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
MemTxAttrs attrs = {};
|
||||
|
||||
attrs.requester_id = env_cpu(env)->cpu_index;
|
||||
|
@ -449,8 +449,7 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
MMUAccessType access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
LoongArchCPU *cpu = LOONGARCH_CPU(cs);
|
||||
CPULoongArchState *env = &cpu->env;
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
hwaddr physical;
|
||||
int prot;
|
||||
int ret;
|
||||
|
@ -282,10 +282,9 @@ static uint64_t make_address_pc(DisasContext *ctx, uint64_t addr)
|
||||
|
||||
static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
|
||||
{
|
||||
CPULoongArchState *env = cpu_env(cs);
|
||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||
|
||||
ctx->opcode = translator_ldl(env, &ctx->base, ctx->base.pc_next);
|
||||
ctx->opcode = translator_ldl(cpu_env(cs), &ctx->base, ctx->base.pc_next);
|
||||
|
||||
if (!decode(ctx, ctx->opcode)) {
|
||||
qemu_log_mask(LOG_UNIMP, "Error: unknown opcode. "
|
||||
|
@ -73,10 +73,9 @@ static void m68k_unset_feature(CPUM68KState *env, int feature)
|
||||
|
||||
static void m68k_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *s = CPU(obj);
|
||||
M68kCPU *cpu = M68K_CPU(s);
|
||||
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUState *cs = CPU(obj);
|
||||
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(obj);
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
floatx80 nan = floatx80_default_nan(NULL);
|
||||
int i;
|
||||
|
||||
@ -122,8 +121,7 @@ static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model)
|
||||
|
||||
static void m5206_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
|
||||
m68k_set_feature(env, M68K_FEATURE_MOVEFROMSR_PRIV);
|
||||
@ -132,8 +130,7 @@ static void m5206_cpu_initfn(Object *obj)
|
||||
/* Base feature set, including isns. for m68k family */
|
||||
static void m68000_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68k_set_feature(env, M68K_FEATURE_M68K);
|
||||
m68k_set_feature(env, M68K_FEATURE_USP);
|
||||
@ -147,8 +144,7 @@ static void m68000_cpu_initfn(Object *obj)
|
||||
*/
|
||||
static void m68010_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68000_cpu_initfn(obj);
|
||||
m68k_set_feature(env, M68K_FEATURE_M68010);
|
||||
@ -168,8 +164,7 @@ static void m68010_cpu_initfn(Object *obj)
|
||||
*/
|
||||
static void m68020_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68010_cpu_initfn(obj);
|
||||
m68k_unset_feature(env, M68K_FEATURE_M68010);
|
||||
@ -199,8 +194,7 @@ static void m68020_cpu_initfn(Object *obj)
|
||||
*/
|
||||
static void m68030_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68020_cpu_initfn(obj);
|
||||
m68k_unset_feature(env, M68K_FEATURE_M68020);
|
||||
@ -226,8 +220,7 @@ static void m68030_cpu_initfn(Object *obj)
|
||||
*/
|
||||
static void m68040_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68030_cpu_initfn(obj);
|
||||
m68k_unset_feature(env, M68K_FEATURE_M68030);
|
||||
@ -247,8 +240,7 @@ static void m68040_cpu_initfn(Object *obj)
|
||||
*/
|
||||
static void m68060_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68040_cpu_initfn(obj);
|
||||
m68k_unset_feature(env, M68K_FEATURE_M68040);
|
||||
@ -261,8 +253,7 @@ static void m68060_cpu_initfn(Object *obj)
|
||||
|
||||
static void m5208_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_APLUSC);
|
||||
@ -274,8 +265,7 @@ static void m5208_cpu_initfn(Object *obj)
|
||||
|
||||
static void cfv4e_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_B);
|
||||
@ -288,8 +278,7 @@ static void cfv4e_cpu_initfn(Object *obj)
|
||||
|
||||
static void any_cpu_initfn(Object *obj)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(obj);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(CPU(obj));
|
||||
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_A);
|
||||
m68k_set_feature(env, M68K_FEATURE_CF_ISA_B);
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
int m68k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
if (n < 8) {
|
||||
/* D0-D7 */
|
||||
@ -50,8 +49,7 @@ int m68k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
|
||||
int m68k_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = ldl_p(mem_buf);
|
||||
|
@ -906,8 +906,7 @@ txfail:
|
||||
|
||||
hwaddr m68k_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
hwaddr phys_addr;
|
||||
int prot;
|
||||
int access_type;
|
||||
@ -955,8 +954,7 @@ bool m68k_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
MMUAccessType qemu_access_type, int mmu_idx,
|
||||
bool probe, uintptr_t retaddr)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
hwaddr physical;
|
||||
int prot;
|
||||
int access_type;
|
||||
@ -984,7 +982,7 @@ bool m68k_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
|
||||
access_type |= ACCESS_SUPER;
|
||||
}
|
||||
|
||||
ret = get_physical_address(&cpu->env, &physical, &prot,
|
||||
ret = get_physical_address(env, &physical, &prot,
|
||||
address, access_type, &page_size);
|
||||
if (likely(ret == 0)) {
|
||||
tlb_set_page(cs, address & TARGET_PAGE_MASK,
|
||||
|
@ -77,8 +77,7 @@ static int host_to_gdb_errno(int err)
|
||||
|
||||
static void m68k_semi_u32_cb(CPUState *cs, uint64_t ret, int err)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
target_ulong args = env->dregs[1];
|
||||
if (put_user_u32(ret, args) ||
|
||||
@ -95,8 +94,7 @@ static void m68k_semi_u32_cb(CPUState *cs, uint64_t ret, int err)
|
||||
|
||||
static void m68k_semi_u64_cb(CPUState *cs, uint64_t ret, int err)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
target_ulong args = env->dregs[1];
|
||||
if (put_user_u32(ret >> 32, args) ||
|
||||
|
@ -441,10 +441,7 @@ static void do_interrupt_all(CPUM68KState *env, int is_hw)
|
||||
|
||||
void m68k_cpu_do_interrupt(CPUState *cs)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
|
||||
do_interrupt_all(env, 0);
|
||||
do_interrupt_all(cpu_env(cs), 0);
|
||||
}
|
||||
|
||||
static inline void do_interrupt_m68k_hardirq(CPUM68KState *env)
|
||||
@ -457,8 +454,7 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
|
||||
int mmu_idx, MemTxAttrs attrs,
|
||||
MemTxResult response, uintptr_t retaddr)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
cpu_restore_state(cs, retaddr);
|
||||
|
||||
@ -511,8 +507,7 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
|
||||
|
||||
bool m68k_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
|
||||
if (interrupt_request & CPU_INTERRUPT_HARD
|
||||
&& ((env->sr & SR_I) >> SR_I_SHIFT) < env->pending_level) {
|
||||
|
@ -6100,8 +6100,7 @@ static double floatx80_to_double(CPUM68KState *env, uint16_t high, uint64_t low)
|
||||
|
||||
void m68k_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
{
|
||||
M68kCPU *cpu = M68K_CPU(cs);
|
||||
CPUM68KState *env = &cpu->env;
|
||||
CPUM68KState *env = cpu_env(cs);
|
||||
int i;
|
||||
uint16_t sr;
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
@ -183,9 +183,9 @@ static void microblaze_cpu_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
static void mb_cpu_reset_hold(Object *obj)
|
||||
{
|
||||
CPUState *s = CPU(obj);
|
||||
MicroBlazeCPU *cpu = MICROBLAZE_CPU(s);
|
||||
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(cpu);
|
||||
CPUState *cs = CPU(obj);
|
||||
MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
|
||||
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(obj);
|
||||
CPUMBState *env = &cpu->env;
|
||||
|
||||
if (mcc->parent_phases.hold) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user