cpu.c (aa96ab7c9df59c615ca82b49c9062819e0a1c287) cpu.c (199c42a6a16ba32b5684e679df949cf29024b0cf)
1/*
2 * QEMU S/390 CPU
3 *
4 * Copyright (c) 2009 Ulrich Hecht
5 * Copyright (c) 2011 Alexander Graf
6 * Copyright (c) 2012 SUSE LINUX Products GmbH
7 * Copyright (c) 2012 IBM Corp.
8 *

--- 27 unchanged lines hidden (view full) ---

36#include "sysemu/tcg.h"
37#ifndef CONFIG_USER_ONLY
38#include "sysemu/reset.h"
39#endif
40
41#define CR0_RESET 0xE0UL
42#define CR14_RESET 0xC2000000UL;
43
1/*
2 * QEMU S/390 CPU
3 *
4 * Copyright (c) 2009 Ulrich Hecht
5 * Copyright (c) 2011 Alexander Graf
6 * Copyright (c) 2012 SUSE LINUX Products GmbH
7 * Copyright (c) 2012 IBM Corp.
8 *

--- 27 unchanged lines hidden (view full) ---

36#include "sysemu/tcg.h"
37#ifndef CONFIG_USER_ONLY
38#include "sysemu/reset.h"
39#endif
40
41#define CR0_RESET 0xE0UL
42#define CR14_RESET 0xC2000000UL;
43
44#ifndef CONFIG_USER_ONLY
45static bool is_early_exception_psw(uint64_t mask, uint64_t addr)
46{
47 if (mask & PSW_MASK_RESERVED) {
48 return true;
49 }
50
51 switch (mask & (PSW_MASK_32 | PSW_MASK_64)) {
52 case 0:
53 return addr & ~0xffffffULL;
54 case PSW_MASK_32:
55 return addr & ~0x7fffffffULL;
56 case PSW_MASK_32 | PSW_MASK_64:
57 return false;
58 default: /* PSW_MASK_64 */
59 return true;
60 }
61}
62#endif
63
44void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
45{
46#ifndef CONFIG_USER_ONLY
47 uint64_t old_mask = env->psw.mask;
48#endif
49
50 env->psw.addr = addr;
51 env->psw.mask = mask;
52
53 /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
54 if (!tcg_enabled()) {
55 return;
56 }
57 env->cc_op = (mask >> 44) & 3;
58
59#ifndef CONFIG_USER_ONLY
64void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
65{
66#ifndef CONFIG_USER_ONLY
67 uint64_t old_mask = env->psw.mask;
68#endif
69
70 env->psw.addr = addr;
71 env->psw.mask = mask;
72
73 /* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */
74 if (!tcg_enabled()) {
75 return;
76 }
77 env->cc_op = (mask >> 44) & 3;
78
79#ifndef CONFIG_USER_ONLY
80 if (is_early_exception_psw(mask, addr)) {
81 env->int_pgm_ilen = 0;
82 trigger_pgm_exception(env, PGM_SPECIFICATION);
83 return;
84 }
85
60 if ((old_mask ^ mask) & PSW_MASK_PER) {
61 s390_cpu_recompute_watchpoints(env_cpu(env));
62 }
63
64 if (mask & PSW_MASK_WAIT) {
65 s390_handle_wait(env_archcpu(env));
66 }
67#endif

--- 282 unchanged lines hidden ---
86 if ((old_mask ^ mask) & PSW_MASK_PER) {
87 s390_cpu_recompute_watchpoints(env_cpu(env));
88 }
89
90 if (mask & PSW_MASK_WAIT) {
91 s390_handle_wait(env_archcpu(env));
92 }
93#endif

--- 282 unchanged lines hidden ---