2009-12-05 19:44:21 +08:00
|
|
|
/*
|
|
|
|
* S/390 helpers
|
|
|
|
*
|
|
|
|
* Copyright (c) 2009 Ulrich Hecht
|
2011-03-23 17:58:07 +08:00
|
|
|
* Copyright (c) 2011 Alexander Graf
|
2009-12-05 19:44:21 +08:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-07 23:48:43 +08:00
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2009-12-05 19:44:21 +08:00
|
|
|
*/
|
|
|
|
|
2016-01-27 02:17:00 +08:00
|
|
|
#include "qemu/osdep.h"
|
include/qemu/osdep.h: Don't include qapi/error.h
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef. Since then, we've moved to include qemu/osdep.h
everywhere. Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h. That's in excess of
100KiB of crap most .c files don't actually need.
Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h. Include qapi/error.h in .c files that need it and don't
get it now. Include qapi-types.h in qom/object.h for uint16List.
Update scripts/clean-includes accordingly. Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h
comment quoted above similarly.
This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third. Unfortunately, the number depending on
qapi-types.h shrinks only a little. More work is needed for that one.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-03-14 16:01:28 +08:00
|
|
|
#include "qapi/error.h"
|
2009-12-05 19:44:21 +08:00
|
|
|
#include "cpu.h"
|
2012-12-18 01:19:49 +08:00
|
|
|
#include "exec/gdbstub.h"
|
2012-12-18 01:20:00 +08:00
|
|
|
#include "qemu/timer.h"
|
2016-03-15 20:18:37 +08:00
|
|
|
#include "exec/exec-all.h"
|
2014-03-29 02:42:10 +08:00
|
|
|
#include "exec/cpu_ldst.h"
|
2015-12-04 19:06:26 +08:00
|
|
|
#include "hw/s390x/ioinst.h"
|
2011-10-07 15:51:50 +08:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2012-12-18 01:20:04 +08:00
|
|
|
#include "sysemu/sysemu.h"
|
2011-10-07 15:51:50 +08:00
|
|
|
#endif
|
2009-12-05 19:44:21 +08:00
|
|
|
|
2011-03-23 17:58:07 +08:00
|
|
|
//#define DEBUG_S390
|
|
|
|
//#define DEBUG_S390_STDOUT
|
|
|
|
|
|
|
|
#ifdef DEBUG_S390
|
|
|
|
#ifdef DEBUG_S390_STDOUT
|
|
|
|
#define DPRINTF(fmt, ...) \
|
|
|
|
do { fprintf(stderr, fmt, ## __VA_ARGS__); \
|
2015-11-13 20:16:27 +08:00
|
|
|
if (qemu_log_separate()) qemu_log(fmt, ##__VA_ARGS__); } while (0)
|
2011-03-23 17:58:07 +08:00
|
|
|
#else
|
|
|
|
#define DPRINTF(fmt, ...) \
|
|
|
|
do { qemu_log(fmt, ## __VA_ARGS__); } while (0)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define DPRINTF(fmt, ...) \
|
|
|
|
do { } while (0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CONFIG_USER_ONLY
|
2012-04-02 19:56:29 +08:00
|
|
|
void s390x_tod_timer(void *opaque)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2012-04-02 20:00:43 +08:00
|
|
|
S390CPU *cpu = opaque;
|
|
|
|
CPUS390XState *env = &cpu->env;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
env->pending_int |= INTERRUPT_TOD;
|
2013-01-18 22:03:43 +08:00
|
|
|
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
2012-04-02 19:56:29 +08:00
|
|
|
void s390x_cpu_timer(void *opaque)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2012-04-02 20:00:43 +08:00
|
|
|
S390CPU *cpu = opaque;
|
|
|
|
CPUS390XState *env = &cpu->env;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
env->pending_int |= INTERRUPT_CPUTIMER;
|
2013-01-18 22:03:43 +08:00
|
|
|
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
#endif
|
2009-12-05 19:44:26 +08:00
|
|
|
|
2016-03-05 01:34:34 +08:00
|
|
|
S390CPU *cpu_s390x_create(const char *cpu_model, Error **errp)
|
2009-12-05 19:44:21 +08:00
|
|
|
{
|
2016-09-05 16:52:16 +08:00
|
|
|
static bool features_parsed;
|
|
|
|
char *name, *features;
|
|
|
|
const char *typename;
|
|
|
|
ObjectClass *oc;
|
|
|
|
CPUClass *cc;
|
|
|
|
|
|
|
|
name = g_strdup(cpu_model);
|
|
|
|
features = strchr(name, ',');
|
|
|
|
if (features) {
|
|
|
|
features[0] = 0;
|
|
|
|
features++;
|
|
|
|
}
|
|
|
|
|
|
|
|
oc = cpu_class_by_name(TYPE_S390_CPU, name);
|
|
|
|
if (!oc) {
|
|
|
|
error_setg(errp, "Unknown CPU definition \'%s\'", name);
|
|
|
|
g_free(name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
typename = object_class_get_name(oc);
|
|
|
|
|
|
|
|
if (!features_parsed) {
|
|
|
|
features_parsed = true;
|
|
|
|
cc = CPU_CLASS(oc);
|
|
|
|
cc->parse_features(typename, features, errp);
|
|
|
|
}
|
|
|
|
g_free(name);
|
|
|
|
|
|
|
|
if (*errp) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return S390_CPU(CPU(object_new(typename)));
|
2016-03-05 01:34:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
S390CPU *s390x_new_cpu(const char *cpu_model, int64_t id, Error **errp)
|
|
|
|
{
|
|
|
|
S390CPU *cpu;
|
|
|
|
Error *err = NULL;
|
|
|
|
|
|
|
|
cpu = cpu_s390x_create(cpu_model, &err);
|
|
|
|
if (err != NULL) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
object_property_set_int(OBJECT(cpu), id, "id", &err);
|
|
|
|
if (err != NULL) {
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
object_property_set_bool(OBJECT(cpu), true, "realized", &err);
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
object_unref(OBJECT(cpu));
|
|
|
|
cpu = NULL;
|
|
|
|
}
|
|
|
|
return cpu;
|
|
|
|
}
|
|
|
|
|
|
|
|
S390CPU *cpu_s390x_init(const char *cpu_model)
|
|
|
|
{
|
|
|
|
Error *err = NULL;
|
|
|
|
S390CPU *cpu;
|
|
|
|
/* Use to track CPU ID for linux-user only */
|
|
|
|
static int64_t next_cpu_id;
|
2013-01-16 11:00:41 +08:00
|
|
|
|
2016-03-05 01:34:34 +08:00
|
|
|
cpu = s390x_new_cpu(cpu_model, next_cpu_id++, &err);
|
|
|
|
if (err) {
|
|
|
|
error_report_err(err);
|
|
|
|
}
|
2012-05-03 10:13:04 +08:00
|
|
|
return cpu;
|
2009-12-05 19:44:21 +08:00
|
|
|
}
|
|
|
|
|
2011-03-23 17:58:07 +08:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
|
2013-02-02 17:57:51 +08:00
|
|
|
void s390_cpu_do_interrupt(CPUState *cs)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = -1;
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
2013-08-26 09:01:33 +08:00
|
|
|
int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
|
|
|
|
int rw, int mmu_idx)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2013-08-26 09:01:33 +08:00
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_PGM;
|
2013-08-26 09:01:33 +08:00
|
|
|
cpu->env.int_pgm_code = PGM_ADDRESSING;
|
2012-09-15 10:31:57 +08:00
|
|
|
/* On real machines this value is dropped into LowMem. Since this
|
|
|
|
is userland, simply put this someplace that cpu_loop can find it. */
|
2013-08-26 09:01:33 +08:00
|
|
|
cpu->env.__excp_addr = address;
|
2011-03-23 17:58:07 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-05-05 21:43:31 +08:00
|
|
|
#else /* !CONFIG_USER_ONLY */
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
/* Ensure to exit the TB after this call! */
|
2015-02-13 01:09:18 +08:00
|
|
|
void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ilen)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2013-08-26 14:31:06 +08:00
|
|
|
CPUState *cs = CPU(s390_env_get_cpu(env));
|
|
|
|
|
|
|
|
cs->exception_index = EXCP_PGM;
|
2011-03-23 17:58:07 +08:00
|
|
|
env->int_pgm_code = code;
|
2012-09-15 10:31:57 +08:00
|
|
|
env->int_pgm_ilen = ilen;
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
2013-08-26 09:01:33 +08:00
|
|
|
int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr,
|
|
|
|
int rw, int mmu_idx)
|
2009-12-05 19:44:26 +08:00
|
|
|
{
|
2013-08-26 09:01:33 +08:00
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
2015-06-04 05:09:54 +08:00
|
|
|
uint64_t asc = cpu_mmu_idx_to_asc(mmu_idx);
|
2011-03-23 17:58:07 +08:00
|
|
|
target_ulong vaddr, raddr;
|
2009-12-05 19:44:26 +08:00
|
|
|
int prot;
|
|
|
|
|
2013-08-26 09:01:33 +08:00
|
|
|
DPRINTF("%s: address 0x%" VADDR_PRIx " rw %d mmu_idx %d\n",
|
2013-01-27 11:32:03 +08:00
|
|
|
__func__, orig_vaddr, rw, mmu_idx);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2012-09-02 15:33:30 +08:00
|
|
|
orig_vaddr &= TARGET_PAGE_MASK;
|
|
|
|
vaddr = orig_vaddr;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
/* 31-Bit mode */
|
|
|
|
if (!(env->psw.mask & PSW_MASK_64)) {
|
|
|
|
vaddr &= 0x7fffffff;
|
|
|
|
}
|
|
|
|
|
2015-02-13 01:09:22 +08:00
|
|
|
if (mmu_translate(env, vaddr, rw, asc, &raddr, &prot, true)) {
|
2011-03-23 17:58:07 +08:00
|
|
|
/* Translation ended in exception */
|
|
|
|
return 1;
|
|
|
|
}
|
2009-12-05 19:44:26 +08:00
|
|
|
|
2011-03-23 17:58:07 +08:00
|
|
|
/* check out of RAM access */
|
2015-11-30 23:49:58 +08:00
|
|
|
if (raddr > ram_size) {
|
2013-01-27 11:32:04 +08:00
|
|
|
DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__,
|
|
|
|
(uint64_t)raddr, (uint64_t)ram_size);
|
2012-09-15 10:31:57 +08:00
|
|
|
trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_LATER);
|
2011-03-23 17:58:07 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2009-12-05 19:44:26 +08:00
|
|
|
|
2014-12-14 00:48:18 +08:00
|
|
|
qemu_log_mask(CPU_LOG_MMU, "%s: set tlb %" PRIx64 " -> %" PRIx64 " (%x)\n",
|
|
|
|
__func__, (uint64_t)vaddr, (uint64_t)raddr, prot);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2013-09-03 19:59:37 +08:00
|
|
|
tlb_set_page(cs, orig_vaddr, raddr, prot,
|
2010-03-17 10:14:28 +08:00
|
|
|
mmu_idx, TARGET_PAGE_SIZE);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2010-03-17 10:14:28 +08:00
|
|
|
return 0;
|
2009-12-05 19:44:26 +08:00
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2013-06-30 00:55:54 +08:00
|
|
|
hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2013-06-30 00:55:54 +08:00
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
2011-03-23 17:58:07 +08:00
|
|
|
target_ulong raddr;
|
2015-02-13 01:09:22 +08:00
|
|
|
int prot;
|
2011-03-23 17:58:07 +08:00
|
|
|
uint64_t asc = env->psw.mask & PSW_MASK_ASC;
|
|
|
|
|
|
|
|
/* 31-Bit mode */
|
|
|
|
if (!(env->psw.mask & PSW_MASK_64)) {
|
|
|
|
vaddr &= 0x7fffffff;
|
|
|
|
}
|
|
|
|
|
2015-12-09 23:36:42 +08:00
|
|
|
if (mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false)) {
|
|
|
|
return -1;
|
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
return raddr;
|
|
|
|
}
|
|
|
|
|
2012-09-03 19:09:10 +08:00
|
|
|
hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr vaddr)
|
|
|
|
{
|
|
|
|
hwaddr phys_addr;
|
|
|
|
target_ulong page;
|
|
|
|
|
|
|
|
page = vaddr & TARGET_PAGE_MASK;
|
|
|
|
phys_addr = cpu_get_phys_page_debug(cs, page);
|
|
|
|
phys_addr += (vaddr & ~TARGET_PAGE_MASK);
|
|
|
|
|
|
|
|
return phys_addr;
|
|
|
|
}
|
|
|
|
|
2012-03-14 08:38:22 +08:00
|
|
|
void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2015-06-13 06:46:00 +08:00
|
|
|
uint64_t old_mask = env->psw.mask;
|
|
|
|
|
2014-09-30 16:57:29 +08:00
|
|
|
env->psw.addr = addr;
|
|
|
|
env->psw.mask = mask;
|
2015-02-24 21:15:29 +08:00
|
|
|
if (tcg_enabled()) {
|
|
|
|
env->cc_op = (mask >> 44) & 3;
|
|
|
|
}
|
2014-09-30 16:57:29 +08:00
|
|
|
|
2015-06-13 06:46:00 +08:00
|
|
|
if ((old_mask ^ mask) & PSW_MASK_PER) {
|
|
|
|
s390_cpu_recompute_watchpoints(CPU(s390_env_get_cpu(env)));
|
|
|
|
}
|
|
|
|
|
2011-03-23 17:58:07 +08:00
|
|
|
if (mask & PSW_MASK_WAIT) {
|
2013-01-30 20:48:25 +08:00
|
|
|
S390CPU *cpu = s390_env_get_cpu(env);
|
2014-09-30 16:57:29 +08:00
|
|
|
if (s390_cpu_halt(cpu) == 0) {
|
2011-10-07 15:51:50 +08:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2017-05-16 05:41:13 +08:00
|
|
|
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
|
2011-10-07 15:51:50 +08:00
|
|
|
#endif
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-14 08:38:22 +08:00
|
|
|
static uint64_t get_psw_mask(CPUS390XState *env)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2015-02-24 21:15:29 +08:00
|
|
|
uint64_t r = env->psw.mask;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2015-02-24 21:15:29 +08:00
|
|
|
if (tcg_enabled()) {
|
|
|
|
env->cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst,
|
|
|
|
env->cc_vr);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2015-02-24 21:15:29 +08:00
|
|
|
r &= ~PSW_MASK_CC;
|
|
|
|
assert(!(env->cc_op & ~3));
|
|
|
|
r |= (uint64_t)env->cc_op << 44;
|
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2013-01-24 10:28:01 +08:00
|
|
|
static LowCore *cpu_map_lowcore(CPUS390XState *env)
|
|
|
|
{
|
2013-09-03 23:38:47 +08:00
|
|
|
S390CPU *cpu = s390_env_get_cpu(env);
|
2013-01-24 10:28:01 +08:00
|
|
|
LowCore *lowcore;
|
|
|
|
hwaddr len = sizeof(LowCore);
|
|
|
|
|
|
|
|
lowcore = cpu_physical_memory_map(env->psa, &len, 1);
|
|
|
|
|
|
|
|
if (len < sizeof(LowCore)) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Could not map lowcore\n");
|
2013-01-24 10:28:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return lowcore;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cpu_unmap_lowcore(LowCore *lowcore)
|
|
|
|
{
|
|
|
|
cpu_physical_memory_unmap(lowcore, sizeof(LowCore), 1, sizeof(LowCore));
|
|
|
|
}
|
|
|
|
|
2015-02-24 21:15:29 +08:00
|
|
|
void do_restart_interrupt(CPUS390XState *env)
|
|
|
|
{
|
|
|
|
uint64_t mask, addr;
|
|
|
|
LowCore *lowcore;
|
|
|
|
|
|
|
|
lowcore = cpu_map_lowcore(env);
|
|
|
|
|
|
|
|
lowcore->restart_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->restart_old_psw.addr = cpu_to_be64(env->psw.addr);
|
|
|
|
mask = be64_to_cpu(lowcore->restart_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->restart_new_psw.addr);
|
|
|
|
|
|
|
|
cpu_unmap_lowcore(lowcore);
|
|
|
|
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
}
|
|
|
|
|
2012-03-14 08:38:22 +08:00
|
|
|
static void do_program_interrupt(CPUS390XState *env)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
|
|
|
uint64_t mask, addr;
|
|
|
|
LowCore *lowcore;
|
2012-09-15 10:31:57 +08:00
|
|
|
int ilen = env->int_pgm_ilen;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2012-09-15 10:31:57 +08:00
|
|
|
switch (ilen) {
|
|
|
|
case ILEN_LATER:
|
|
|
|
ilen = get_ilen(cpu_ldub_code(env, env->psw.addr));
|
2011-03-23 17:58:07 +08:00
|
|
|
break;
|
2012-09-15 10:31:57 +08:00
|
|
|
case ILEN_LATER_INC:
|
|
|
|
ilen = get_ilen(cpu_ldub_code(env, env->psw.addr));
|
|
|
|
env->psw.addr += ilen;
|
2011-03-23 17:58:07 +08:00
|
|
|
break;
|
2012-09-15 10:31:57 +08:00
|
|
|
default:
|
|
|
|
assert(ilen == 2 || ilen == 4 || ilen == 6);
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
2012-09-15 10:31:57 +08:00
|
|
|
qemu_log_mask(CPU_LOG_INT, "%s: code=0x%x ilen=%d\n",
|
|
|
|
__func__, env->int_pgm_code, ilen);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2013-01-24 10:28:01 +08:00
|
|
|
lowcore = cpu_map_lowcore(env);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2015-06-13 06:45:56 +08:00
|
|
|
/* Signal PER events with the exception. */
|
|
|
|
if (env->per_perc_atmid) {
|
|
|
|
env->int_pgm_code |= PGM_PER;
|
|
|
|
lowcore->per_address = cpu_to_be64(env->per_address);
|
|
|
|
lowcore->per_perc_atmid = cpu_to_be16(env->per_perc_atmid);
|
|
|
|
env->per_perc_atmid = 0;
|
|
|
|
}
|
|
|
|
|
2012-09-15 10:31:57 +08:00
|
|
|
lowcore->pgm_ilen = cpu_to_be16(ilen);
|
2011-03-23 17:58:07 +08:00
|
|
|
lowcore->pgm_code = cpu_to_be16(env->int_pgm_code);
|
|
|
|
lowcore->program_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->program_old_psw.addr = cpu_to_be64(env->psw.addr);
|
|
|
|
mask = be64_to_cpu(lowcore->program_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->program_new_psw.addr);
|
2015-06-13 06:46:03 +08:00
|
|
|
lowcore->per_breaking_event_addr = cpu_to_be64(env->gbea);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2013-01-24 10:28:01 +08:00
|
|
|
cpu_unmap_lowcore(lowcore);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2012-09-02 15:33:30 +08:00
|
|
|
DPRINTF("%s: %x %x %" PRIx64 " %" PRIx64 "\n", __func__,
|
2012-09-15 10:31:57 +08:00
|
|
|
env->int_pgm_code, ilen, env->psw.mask,
|
2011-03-23 17:58:07 +08:00
|
|
|
env->psw.addr);
|
|
|
|
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
}
|
|
|
|
|
2015-06-13 06:45:56 +08:00
|
|
|
static void do_svc_interrupt(CPUS390XState *env)
|
|
|
|
{
|
|
|
|
uint64_t mask, addr;
|
|
|
|
LowCore *lowcore;
|
|
|
|
|
|
|
|
lowcore = cpu_map_lowcore(env);
|
|
|
|
|
|
|
|
lowcore->svc_code = cpu_to_be16(env->int_svc_code);
|
|
|
|
lowcore->svc_ilen = cpu_to_be16(env->int_svc_ilen);
|
|
|
|
lowcore->svc_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->svc_old_psw.addr = cpu_to_be64(env->psw.addr + env->int_svc_ilen);
|
|
|
|
mask = be64_to_cpu(lowcore->svc_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->svc_new_psw.addr);
|
|
|
|
|
|
|
|
cpu_unmap_lowcore(lowcore);
|
|
|
|
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
|
|
|
|
/* When a PER event is pending, the PER exception has to happen
|
|
|
|
immediately after the SERVICE CALL one. */
|
|
|
|
if (env->per_perc_atmid) {
|
|
|
|
env->int_pgm_code = PGM_PER;
|
|
|
|
env->int_pgm_ilen = env->int_svc_ilen;
|
|
|
|
do_program_interrupt(env);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-23 17:58:07 +08:00
|
|
|
#define VIRTIO_SUBCODE_64 0x0D00
|
|
|
|
|
2012-03-14 08:38:22 +08:00
|
|
|
static void do_ext_interrupt(CPUS390XState *env)
|
2011-03-23 17:58:07 +08:00
|
|
|
{
|
2013-09-03 23:38:47 +08:00
|
|
|
S390CPU *cpu = s390_env_get_cpu(env);
|
2011-03-23 17:58:07 +08:00
|
|
|
uint64_t mask, addr;
|
|
|
|
LowCore *lowcore;
|
|
|
|
ExtQueue *q;
|
|
|
|
|
|
|
|
if (!(env->psw.mask & PSW_MASK_EXT)) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Ext int w/o ext mask\n");
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
2014-11-24 10:47:45 +08:00
|
|
|
if (env->ext_index < 0 || env->ext_index >= MAX_EXT_QUEUE) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Ext queue overrun: %d\n", env->ext_index);
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
q = &env->ext_queue[env->ext_index];
|
2013-01-24 10:28:01 +08:00
|
|
|
lowcore = cpu_map_lowcore(env);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
lowcore->ext_int_code = cpu_to_be16(q->code);
|
|
|
|
lowcore->ext_params = cpu_to_be32(q->param);
|
|
|
|
lowcore->ext_params2 = cpu_to_be64(q->param64);
|
|
|
|
lowcore->external_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->external_old_psw.addr = cpu_to_be64(env->psw.addr);
|
|
|
|
lowcore->cpu_addr = cpu_to_be16(env->cpu_num | VIRTIO_SUBCODE_64);
|
|
|
|
mask = be64_to_cpu(lowcore->external_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->external_new_psw.addr);
|
|
|
|
|
2013-01-24 10:28:01 +08:00
|
|
|
cpu_unmap_lowcore(lowcore);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
env->ext_index--;
|
|
|
|
if (env->ext_index == -1) {
|
|
|
|
env->pending_int &= ~INTERRUPT_EXT;
|
|
|
|
}
|
|
|
|
|
2012-09-02 15:33:30 +08:00
|
|
|
DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__,
|
2011-03-23 17:58:07 +08:00
|
|
|
env->psw.mask, env->psw.addr);
|
|
|
|
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
}
|
2011-04-15 23:32:48 +08:00
|
|
|
|
2013-01-24 10:28:04 +08:00
|
|
|
static void do_io_interrupt(CPUS390XState *env)
|
|
|
|
{
|
2013-09-03 23:38:47 +08:00
|
|
|
S390CPU *cpu = s390_env_get_cpu(env);
|
2013-01-24 10:28:04 +08:00
|
|
|
LowCore *lowcore;
|
|
|
|
IOIntQueue *q;
|
|
|
|
uint8_t isc;
|
|
|
|
int disable = 1;
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
if (!(env->psw.mask & PSW_MASK_IO)) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "I/O int w/o I/O mask\n");
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for (isc = 0; isc < ARRAY_SIZE(env->io_index); isc++) {
|
2013-02-07 10:20:51 +08:00
|
|
|
uint64_t isc_bits;
|
|
|
|
|
2013-01-24 10:28:04 +08:00
|
|
|
if (env->io_index[isc] < 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2014-11-24 10:47:45 +08:00
|
|
|
if (env->io_index[isc] >= MAX_IO_QUEUE) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "I/O queue overrun for isc %d: %d\n",
|
2013-01-24 10:28:04 +08:00
|
|
|
isc, env->io_index[isc]);
|
|
|
|
}
|
|
|
|
|
|
|
|
q = &env->io_queue[env->io_index[isc]][isc];
|
2013-02-07 10:20:51 +08:00
|
|
|
isc_bits = ISC_TO_ISC_BITS(IO_INT_WORD_ISC(q->word));
|
|
|
|
if (!(env->cregs[6] & isc_bits)) {
|
2013-01-24 10:28:04 +08:00
|
|
|
disable = 0;
|
|
|
|
continue;
|
|
|
|
}
|
2013-02-07 10:20:50 +08:00
|
|
|
if (!found) {
|
|
|
|
uint64_t mask, addr;
|
2013-01-24 10:28:04 +08:00
|
|
|
|
2013-02-07 10:20:50 +08:00
|
|
|
found = 1;
|
|
|
|
lowcore = cpu_map_lowcore(env);
|
2013-01-24 10:28:04 +08:00
|
|
|
|
2013-02-07 10:20:50 +08:00
|
|
|
lowcore->subchannel_id = cpu_to_be16(q->id);
|
|
|
|
lowcore->subchannel_nr = cpu_to_be16(q->nr);
|
|
|
|
lowcore->io_int_parm = cpu_to_be32(q->parm);
|
|
|
|
lowcore->io_int_word = cpu_to_be32(q->word);
|
|
|
|
lowcore->io_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->io_old_psw.addr = cpu_to_be64(env->psw.addr);
|
|
|
|
mask = be64_to_cpu(lowcore->io_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->io_new_psw.addr);
|
2013-01-24 10:28:04 +08:00
|
|
|
|
2013-02-07 10:20:50 +08:00
|
|
|
cpu_unmap_lowcore(lowcore);
|
|
|
|
|
|
|
|
env->io_index[isc]--;
|
|
|
|
|
|
|
|
DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__,
|
|
|
|
env->psw.mask, env->psw.addr);
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
}
|
2013-02-04 04:33:16 +08:00
|
|
|
if (env->io_index[isc] >= 0) {
|
2013-01-24 10:28:04 +08:00
|
|
|
disable = 0;
|
|
|
|
}
|
2013-02-07 10:20:50 +08:00
|
|
|
continue;
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (disable) {
|
|
|
|
env->pending_int &= ~INTERRUPT_IO;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void do_mchk_interrupt(CPUS390XState *env)
|
|
|
|
{
|
2013-09-03 23:38:47 +08:00
|
|
|
S390CPU *cpu = s390_env_get_cpu(env);
|
2013-01-24 10:28:04 +08:00
|
|
|
uint64_t mask, addr;
|
|
|
|
LowCore *lowcore;
|
|
|
|
MchkQueue *q;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!(env->psw.mask & PSW_MASK_MCHECK)) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Machine check w/o mchk mask\n");
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
|
2014-11-24 10:47:45 +08:00
|
|
|
if (env->mchk_index < 0 || env->mchk_index >= MAX_MCHK_QUEUE) {
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Mchk queue overrun: %d\n", env->mchk_index);
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
q = &env->mchk_queue[env->mchk_index];
|
|
|
|
|
|
|
|
if (q->type != 1) {
|
|
|
|
/* Don't know how to handle this... */
|
2013-09-03 23:38:47 +08:00
|
|
|
cpu_abort(CPU(cpu), "Unknown machine check type %d\n", q->type);
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
if (!(env->cregs[14] & (1 << 28))) {
|
|
|
|
/* CRW machine checks disabled */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lowcore = cpu_map_lowcore(env);
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2015-05-08 02:35:44 +08:00
|
|
|
lowcore->floating_pt_save_area[i] = cpu_to_be64(get_freg(env, i)->ll);
|
2013-01-24 10:28:04 +08:00
|
|
|
lowcore->gpregs_save_area[i] = cpu_to_be64(env->regs[i]);
|
|
|
|
lowcore->access_regs_save_area[i] = cpu_to_be32(env->aregs[i]);
|
|
|
|
lowcore->cregs_save_area[i] = cpu_to_be64(env->cregs[i]);
|
|
|
|
}
|
|
|
|
lowcore->prefixreg_save_area = cpu_to_be32(env->psa);
|
|
|
|
lowcore->fpt_creg_save_area = cpu_to_be32(env->fpc);
|
|
|
|
lowcore->tod_progreg_save_area = cpu_to_be32(env->todpr);
|
|
|
|
lowcore->cpu_timer_save_area[0] = cpu_to_be32(env->cputm >> 32);
|
|
|
|
lowcore->cpu_timer_save_area[1] = cpu_to_be32((uint32_t)env->cputm);
|
|
|
|
lowcore->clock_comp_save_area[0] = cpu_to_be32(env->ckc >> 32);
|
|
|
|
lowcore->clock_comp_save_area[1] = cpu_to_be32((uint32_t)env->ckc);
|
|
|
|
|
|
|
|
lowcore->mcck_interruption_code[0] = cpu_to_be32(0x00400f1d);
|
|
|
|
lowcore->mcck_interruption_code[1] = cpu_to_be32(0x40330000);
|
|
|
|
lowcore->mcck_old_psw.mask = cpu_to_be64(get_psw_mask(env));
|
|
|
|
lowcore->mcck_old_psw.addr = cpu_to_be64(env->psw.addr);
|
|
|
|
mask = be64_to_cpu(lowcore->mcck_new_psw.mask);
|
|
|
|
addr = be64_to_cpu(lowcore->mcck_new_psw.addr);
|
|
|
|
|
|
|
|
cpu_unmap_lowcore(lowcore);
|
|
|
|
|
|
|
|
env->mchk_index--;
|
|
|
|
if (env->mchk_index == -1) {
|
|
|
|
env->pending_int &= ~INTERRUPT_MCHK;
|
|
|
|
}
|
|
|
|
|
|
|
|
DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__,
|
|
|
|
env->psw.mask, env->psw.addr);
|
|
|
|
|
|
|
|
load_psw(env, mask, addr);
|
|
|
|
}
|
|
|
|
|
2013-02-02 17:57:51 +08:00
|
|
|
void s390_cpu_do_interrupt(CPUState *cs)
|
2011-04-15 23:32:48 +08:00
|
|
|
{
|
2013-02-02 17:57:51 +08:00
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
2013-01-30 20:48:24 +08:00
|
|
|
|
2012-09-25 05:55:51 +08:00
|
|
|
qemu_log_mask(CPU_LOG_INT, "%s: %d at pc=%" PRIx64 "\n",
|
2013-08-26 14:31:06 +08:00
|
|
|
__func__, cs->exception_index, env->psw.addr);
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2014-09-30 16:57:29 +08:00
|
|
|
s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
|
2013-01-24 10:28:04 +08:00
|
|
|
/* handle machine checks */
|
|
|
|
if ((env->psw.mask & PSW_MASK_MCHECK) &&
|
2013-08-26 14:31:06 +08:00
|
|
|
(cs->exception_index == -1)) {
|
2013-01-24 10:28:04 +08:00
|
|
|
if (env->pending_int & INTERRUPT_MCHK) {
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_MCHK;
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
/* handle external interrupts */
|
|
|
|
if ((env->psw.mask & PSW_MASK_EXT) &&
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index == -1) {
|
2011-03-23 17:58:07 +08:00
|
|
|
if (env->pending_int & INTERRUPT_EXT) {
|
|
|
|
/* code is already in env */
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_EXT;
|
2011-03-23 17:58:07 +08:00
|
|
|
} else if (env->pending_int & INTERRUPT_TOD) {
|
2013-01-30 20:48:24 +08:00
|
|
|
cpu_inject_ext(cpu, 0x1004, 0, 0);
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_EXT;
|
2011-03-23 17:58:07 +08:00
|
|
|
env->pending_int &= ~INTERRUPT_EXT;
|
|
|
|
env->pending_int &= ~INTERRUPT_TOD;
|
|
|
|
} else if (env->pending_int & INTERRUPT_CPUTIMER) {
|
2013-01-30 20:48:24 +08:00
|
|
|
cpu_inject_ext(cpu, 0x1005, 0, 0);
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_EXT;
|
2011-03-23 17:58:07 +08:00
|
|
|
env->pending_int &= ~INTERRUPT_EXT;
|
|
|
|
env->pending_int &= ~INTERRUPT_TOD;
|
|
|
|
}
|
|
|
|
}
|
2013-01-24 10:28:04 +08:00
|
|
|
/* handle I/O interrupts */
|
|
|
|
if ((env->psw.mask & PSW_MASK_IO) &&
|
2013-08-26 14:31:06 +08:00
|
|
|
(cs->exception_index == -1)) {
|
2013-01-24 10:28:04 +08:00
|
|
|
if (env->pending_int & INTERRUPT_IO) {
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = EXCP_IO;
|
2013-01-24 10:28:04 +08:00
|
|
|
}
|
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2013-08-26 14:31:06 +08:00
|
|
|
switch (cs->exception_index) {
|
2011-03-23 17:58:07 +08:00
|
|
|
case EXCP_PGM:
|
|
|
|
do_program_interrupt(env);
|
|
|
|
break;
|
|
|
|
case EXCP_SVC:
|
|
|
|
do_svc_interrupt(env);
|
|
|
|
break;
|
|
|
|
case EXCP_EXT:
|
|
|
|
do_ext_interrupt(env);
|
|
|
|
break;
|
2013-01-24 10:28:04 +08:00
|
|
|
case EXCP_IO:
|
|
|
|
do_io_interrupt(env);
|
|
|
|
break;
|
|
|
|
case EXCP_MCHK:
|
|
|
|
do_mchk_interrupt(env);
|
|
|
|
break;
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
2013-08-26 14:31:06 +08:00
|
|
|
cs->exception_index = -1;
|
2011-03-23 17:58:07 +08:00
|
|
|
|
|
|
|
if (!env->pending_int) {
|
2013-01-18 01:51:17 +08:00
|
|
|
cs->interrupt_request &= ~CPU_INTERRUPT_HARD;
|
2011-03-23 17:58:07 +08:00
|
|
|
}
|
2011-04-15 23:32:48 +08:00
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
|
2014-09-14 00:45:19 +08:00
|
|
|
bool s390_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
|
|
|
{
|
|
|
|
if (interrupt_request & CPU_INTERRUPT_HARD) {
|
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
|
|
|
|
2017-05-22 00:50:00 +08:00
|
|
|
if (env->ex_value) {
|
|
|
|
/* Execution of the target insn is indivisible from
|
|
|
|
the parent EXECUTE insn. */
|
|
|
|
return false;
|
|
|
|
}
|
2014-09-14 00:45:19 +08:00
|
|
|
if (env->psw.mask & PSW_MASK_EXT) {
|
|
|
|
s390_cpu_do_interrupt(cs);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2015-06-13 06:46:00 +08:00
|
|
|
|
|
|
|
void s390_cpu_recompute_watchpoints(CPUState *cs)
|
|
|
|
{
|
|
|
|
const int wp_flags = BP_CPU | BP_MEM_WRITE | BP_STOP_BEFORE_ACCESS;
|
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
|
|
|
|
|
|
|
/* We are called when the watchpoints have changed. First
|
|
|
|
remove them all. */
|
|
|
|
cpu_watchpoint_remove_all(cs, BP_CPU);
|
|
|
|
|
|
|
|
/* Return if PER is not enabled */
|
|
|
|
if (!(env->psw.mask & PSW_MASK_PER)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return if storage-alteration event is not enabled. */
|
|
|
|
if (!(env->cregs[9] & PER_CR9_EVENT_STORE)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (env->cregs[10] == 0 && env->cregs[11] == -1LL) {
|
|
|
|
/* We can't create a watchoint spanning the whole memory range, so
|
|
|
|
split it in two parts. */
|
|
|
|
cpu_watchpoint_insert(cs, 0, 1ULL << 63, wp_flags, NULL);
|
|
|
|
cpu_watchpoint_insert(cs, 1ULL << 63, 1ULL << 63, wp_flags, NULL);
|
|
|
|
} else if (env->cregs[10] > env->cregs[11]) {
|
|
|
|
/* The address range loops, create two watchpoints. */
|
|
|
|
cpu_watchpoint_insert(cs, env->cregs[10], -env->cregs[10],
|
|
|
|
wp_flags, NULL);
|
|
|
|
cpu_watchpoint_insert(cs, 0, env->cregs[11] + 1, wp_flags, NULL);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* Default case, create a single watchpoint. */
|
|
|
|
cpu_watchpoint_insert(cs, env->cregs[10],
|
|
|
|
env->cregs[11] - env->cregs[10] + 1,
|
|
|
|
wp_flags, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void s390x_cpu_debug_excp_handler(CPUState *cs)
|
|
|
|
{
|
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
|
|
|
CPUWatchpoint *wp_hit = cs->watchpoint_hit;
|
|
|
|
|
|
|
|
if (wp_hit && wp_hit->flags & BP_CPU) {
|
|
|
|
/* FIXME: When the storage-alteration-space control bit is set,
|
|
|
|
the exception should only be triggered if the memory access
|
|
|
|
is done using an address space with the storage-alteration-event
|
|
|
|
bit set. We have no way to detect that with the current
|
|
|
|
watchpoint code. */
|
|
|
|
cs->watchpoint_hit = NULL;
|
|
|
|
|
|
|
|
env->per_address = env->psw.addr;
|
|
|
|
env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env);
|
|
|
|
/* FIXME: We currently no way to detect the address space used
|
|
|
|
to trigger the watchpoint. For now just consider it is the
|
|
|
|
current default ASC. This turn to be true except when MVCP
|
|
|
|
and MVCS instrutions are not used. */
|
|
|
|
env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46;
|
|
|
|
|
|
|
|
/* Remove all watchpoints to re-execute the code. A PER exception
|
|
|
|
will be triggered, it will call load_psw which will recompute
|
|
|
|
the watchpoints. */
|
|
|
|
cpu_watchpoint_remove_all(cs, BP_CPU);
|
2016-05-17 22:18:04 +08:00
|
|
|
cpu_loop_exit_noexc(cs);
|
2015-06-13 06:46:00 +08:00
|
|
|
}
|
|
|
|
}
|
2017-03-02 10:06:18 +08:00
|
|
|
|
|
|
|
/* Unaligned accesses are only diagnosed with MO_ALIGN. At the moment,
|
|
|
|
this is only for the atomic operations, for which we want to raise a
|
|
|
|
specification exception. */
|
|
|
|
void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
|
|
|
|
MMUAccessType access_type,
|
|
|
|
int mmu_idx, uintptr_t retaddr)
|
|
|
|
{
|
|
|
|
S390CPU *cpu = S390_CPU(cs);
|
|
|
|
CPUS390XState *env = &cpu->env;
|
|
|
|
|
|
|
|
if (retaddr) {
|
|
|
|
cpu_restore_state(cs, retaddr);
|
|
|
|
}
|
|
|
|
program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER);
|
|
|
|
}
|
2011-03-23 17:58:07 +08:00
|
|
|
#endif /* CONFIG_USER_ONLY */
|