mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target/s390x: Implement Early Exception Recognition
Generate a specification exception if a reserved bit is set in the PSW mask or if the PSW address is out of bounds dictated by the addressing mode. Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> Message-Id: <20230315020408.384766-3-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
377dc84e2d
commit
199c42a6a1
4 changed files with 45 additions and 1 deletions
|
@ -41,6 +41,26 @@
|
|||
#define CR0_RESET 0xE0UL
|
||||
#define CR14_RESET 0xC2000000UL;
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
static bool is_early_exception_psw(uint64_t mask, uint64_t addr)
|
||||
{
|
||||
if (mask & PSW_MASK_RESERVED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (mask & (PSW_MASK_32 | PSW_MASK_64)) {
|
||||
case 0:
|
||||
return addr & ~0xffffffULL;
|
||||
case PSW_MASK_32:
|
||||
return addr & ~0x7fffffffULL;
|
||||
case PSW_MASK_32 | PSW_MASK_64:
|
||||
return false;
|
||||
default: /* PSW_MASK_64 */
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
@ -57,6 +77,12 @@ void s390_cpu_set_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
|
|||
env->cc_op = (mask >> 44) & 3;
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
if (is_early_exception_psw(mask, addr)) {
|
||||
env->int_pgm_ilen = 0;
|
||||
trigger_pgm_exception(env, PGM_SPECIFICATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((old_mask ^ mask) & PSW_MASK_PER) {
|
||||
s390_cpu_recompute_watchpoints(env_cpu(env));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue