From nobody Wed Nov 5 00:15:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500950326200744.4996599936753; Mon, 24 Jul 2017 19:38:46 -0700 (PDT) Received: from localhost ([::1]:58087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpkC-0005nI-8d for importer@patchew.org; Mon, 24 Jul 2017 22:38:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpiK-0004eQ-4J for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZpiI-0005mF-BR for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:48 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:32866) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZpiI-0005m8-6Q for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:46 -0400 Received: by mail-qk0-x242.google.com with SMTP id d145so9052683qkc.0 for ; Mon, 24 Jul 2017 19:36:46 -0700 (PDT) Received: from bigtime.com ([71.217.194.233]) by smtp.gmail.com with ESMTPSA id l64sm8847707qkf.95.2017.07.24.19.36.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 19:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=O7sKrdiufgVYqHdIc7uFVtnzawsiJC+wt/B9jv+eW+4=; b=TwkxQoHhSWfZVmKB8SOpwzQ6q2PV6h+Gs1fN9W6adRQyUiOls8mfsz5NgfqMZFaTvc gVGZJvcpGnAgfhUqarkLigvKnUgMG9WD+cvsXgSqADQsfBuuwo21+3//pPviOJpKn3lr zd+/HDDrNz79/gY/oNaYVHBaWX8Xt5l54TxsodDfDwBoMeH4fuyYbFB5Gj+nQCpFxmaf 09T4vmDSkqZHdk2gLjYlRM9PqZhD1h4vvqlgXzfey1zWsvOI+LCuEMSPMpmLCU0LQBB/ +IhHo9WHk7ThhqlwcfuHSYp/GqDdjdclNz7QWphG8d3+Jc0o75ruX8y5BsGHmy8r9y3N ucYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=O7sKrdiufgVYqHdIc7uFVtnzawsiJC+wt/B9jv+eW+4=; b=D0PQaicWVG/yuLKGjAcuh8S7uLl0ls9iuKnUc0ejVZ+jfkTJHOGzKluulqJ8hpKp5+ +7iIsG2H3rp1MBdr05VRwe92yoxBayr+T/RltwqpkH79t6XipEFWwET4+4xZgYzhO817 PRzyRZ3UwPfVAZ4GMWrZcq+Ac12lK19t5bo/MhxzpJ7ahX43adwyVkgunIlUwZce+VCy 3VbstjrDgwVmtUMV9pcYt4NNF2u2hQW1SafZoySL8P8irCry5MmV9UPlrw4oTKQSTiwx bZtT5TMutxQOY5oZq61nkYI+Lvs9pM0Ug2ZDhGXrOW9St8GHyhlqGoz3eQdlIkVLwdrO OhfQ== X-Gm-Message-State: AIVw111hDL0h+jOHWhIo1q1KsYgsbVG6VqFIIWSMoEOzzeXVYUOnhgmA S3ogkn1APqsF15VWL7A= X-Received: by 10.55.15.164 with SMTP id 36mr21769376qkp.242.1500950205341; Mon, 24 Jul 2017 19:36:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 19:36:08 -0700 Message-Id: <20170725023611.9169-2-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725023611.9169-1-rth@twiddle.net> References: <20170725023611.9169-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 1/4] target/s390x: Add ilen to unwind data X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use ILEN_UNWIND to signal that we have in fact that cpu_restore_state will have been called by the time we arrive in do_program_interrupt. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/cpu.h | 9 ++++++--- target/s390x/helper.c | 7 +++++-- target/s390x/misc_helper.c | 5 ++++- target/s390x/translate.c | 9 ++++++++- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 7732d01784..c294e6012d 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -43,7 +43,7 @@ #include "fpu/softfloat.h" =20 #define NB_MMU_MODES 3 -#define TARGET_INSN_START_EXTRA_WORDS 1 +#define TARGET_INSN_START_EXTRA_WORDS 2 =20 #define MMU_MODE0_SUFFIX _primary #define MMU_MODE1_SUFFIX _secondary @@ -475,7 +475,7 @@ static inline bool get_per_in_range(CPUS390XState *env,= uint64_t addr) } =20 #ifndef CONFIG_USER_ONLY -void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ile= n); +void trigger_pgm_exception(CPUS390XState *env, uint32_t code, int ilen); #endif =20 S390CPU *cpu_s390x_init(const char *cpu_model); @@ -1143,8 +1143,11 @@ uint32_t set_cc_nz_f128(float128 v); int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3); void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3); #endif -/* automatically detect the instruction length */ +/* Instruction length has been set by unwind info. */ +#define ILEN_UNWIND 0 +/* Automatically detect the instruction length */ #define ILEN_AUTO 0xff + void program_interrupt(CPUS390XState *env, uint32_t code, int ilen); void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, uintptr_t retaddr); diff --git a/target/s390x/helper.c b/target/s390x/helper.c index aef09e1234..6d67d6b5a1 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -166,13 +166,16 @@ int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr add= ress, #else /* !CONFIG_USER_ONLY */ =20 /* Ensure to exit the TB after this call! */ -void trigger_pgm_exception(CPUS390XState *env, uint32_t code, uint32_t ile= n) +void trigger_pgm_exception(CPUS390XState *env, uint32_t code, int ilen) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); =20 cs->exception_index =3D EXCP_PGM; env->int_pgm_code =3D code; - env->int_pgm_ilen =3D ilen; + /* If ILEN_UNWIND, int_pgm_ilen already has the correct value. */ + if (ilen !=3D ILEN_UNWIND) { + env->int_pgm_ilen =3D ilen; + } } =20 int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index b5081019c5..452b2bd902 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -95,7 +95,10 @@ void program_interrupt(CPUS390XState *env, uint32_t code= , int ilen) CPUState *cs =3D CPU(cpu); =20 env->int_pgm_code =3D code; - env->int_pgm_ilen =3D ilen; + /* If ILEN_UNWIND, int_pgm_ilen already has the correct value. */ + if (ilen !=3D ILEN_UNWIND) { + env->int_pgm_ilen =3D ilen; + } cs->exception_index =3D EXCP_PGM; cpu_loop_exit(cs); } diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 48b71f9604..9b0c35efa2 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -61,6 +61,8 @@ struct DisasContext { uint64_t pc, next_pc; uint32_t ilen; enum cc_op cc_op; + /* TCG op index of the current insn_start. */ + int insn_start_idx; bool singlestep_enabled; }; =20 @@ -5656,6 +5658,7 @@ static const DisasInsn *extract_insn(CPUS390XState *e= nv, DisasContext *s, } s->next_pc =3D s->pc + ilen; s->ilen =3D ilen; + tcg_set_insn_param(s->insn_start_idx, 2, ilen); =20 /* We can't actually determine the insn format until we've looked up the full insn opcode. Which we can't do without locating the @@ -5890,7 +5893,10 @@ void gen_intermediate_code(CPUState *cs, struct Tran= slationBlock *tb) gen_tb_start(tb); =20 do { - tcg_gen_insn_start(dc.pc, dc.cc_op); + /* ??? Alternately, delay emitting insn_start until after we + have computed the insn length in extract_insn. */ + dc.insn_start_idx =3D tcg_op_buf_count(); + tcg_gen_insn_start(dc.pc, dc.cc_op, 0); num_insns++; =20 if (unlikely(cpu_breakpoint_test(cs, dc.pc, BP_ANY))) { @@ -5984,4 +5990,5 @@ void restore_state_to_opc(CPUS390XState *env, Transla= tionBlock *tb, if ((cc_op !=3D CC_OP_DYNAMIC) && (cc_op !=3D CC_OP_STATIC)) { env->cc_op =3D cc_op; } + env->int_pgm_ilen =3D data[2]; } --=20 2.13.3 From nobody Wed Nov 5 00:15:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500950341129398.52999104688695; Mon, 24 Jul 2017 19:39:01 -0700 (PDT) Received: from localhost ([::1]:58088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpkR-0005zs-Mo for importer@patchew.org; Mon, 24 Jul 2017 22:38:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpiL-0004fH-9G for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZpiJ-0005mj-JH for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:49 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:36672) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZpiJ-0005ma-EO for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:47 -0400 Received: by mail-qk0-x243.google.com with SMTP id d136so11595206qkg.3 for ; Mon, 24 Jul 2017 19:36:47 -0700 (PDT) Received: from bigtime.com ([71.217.194.233]) by smtp.gmail.com with ESMTPSA id l64sm8847707qkf.95.2017.07.24.19.36.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 19:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rJIlmUyqQ0hSSdhajyXktNQx14qAbiVHhrCbKh5xOgY=; b=ref8Yi8s1JyH6/C6mwKPLACYeyn9kaQEczFvbBqRj7G01jYJ9arMGgqwNeQj5sVebU lPxZ7f7ew0Lp7CxgK6g7v5k6ljIdehDWv3HINJxbsKocSFA4QDmlKv14iRW1RXziq7SI ADYsdbJpW8z1BwLTBt+gv9u/SMI+f7QymlpSMEhNxIh90S+Ps9QmOYr2o3IhAjBjItHh 9qMWzKuCVyyat7iG+0COlv4XDWg5oI8FvOxFGp9mycwNcJyJgKCeCl/N6xTM3PN4kPR3 H4SJhPT5L4bflbE9nsDFrA7OKLBgz49hhhGFgUd0wKEwYkD/u0YMjSFOkeiy/USuvvCU 54Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rJIlmUyqQ0hSSdhajyXktNQx14qAbiVHhrCbKh5xOgY=; b=X1T1plLs5vREdItDr5+0KXVdCYifXWWEYOk9t7SxvsRj9VBAATuYOw+YBMmv0xMH1F wrZ6aHE6oRwo21C4dJ/edQykbMxKpilszu7fxpEtqvUjKBTD3XWbyAMezQ6Ntl+jjHjf 8Q3S+w2vUtBDseWaYy2FYjb83Kt6koi8tz2nUbgA/GMchVAHcIeL0o28YF4cGWwp5wtH JqemuzogamqOe1Ka4x0dgw0GQ4ovcB4g/ribfQ8dceoaiTreo+5lldZdpFNDbqSiINLF YCkpcTgGFTUBfQ8wWskud0tjMQZ0LRHctqKCwt1pk4pxnxUIN8+Ms1lq9m16yxOOc6er 5sEw== X-Gm-Message-State: AIVw113zywlMFdgILmPkpVfXSoPlQk5ZdFdLGrg6yGuwvm6Ohm8gkXbO 5Skr5GQ57Vn9ynza/sQ= X-Received: by 10.55.55.7 with SMTP id e7mr22071490qka.294.1500950206561; Mon, 24 Jul 2017 19:36:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 19:36:09 -0700 Message-Id: <20170725023611.9169-3-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725023611.9169-1-rth@twiddle.net> References: <20170725023611.9169-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH 2/4] target/s390x: Use ILEN_UNWIND in trivial cases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All of these uses also have an immediately visible call to cpu_restore_state. Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/helper.c | 7 +++---- target/s390x/mem_helper.c | 26 +++++++++++++------------- target/s390x/misc_helper.c | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 6d67d6b5a1..c83772bec3 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -763,9 +763,8 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr = addr, S390CPU *cpu =3D S390_CPU(cs); CPUS390XState *env =3D &cpu->env; =20 - if (retaddr) { - cpu_restore_state(cs, retaddr); - } - program_interrupt(env, PGM_SPECIFICATION, ILEN_AUTO); + g_assert(retaddr !=3D 0); + cpu_restore_state(cs, retaddr); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } #endif /* CONFIG_USER_ONLY */ diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index cdc78aa3d4..026189aefd 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -75,7 +75,7 @@ static inline void check_alignment(CPUS390XState *env, ui= nt64_t v, if (v % wordsize) { CPUState *cs =3D CPU(s390_env_get_cpu(env)); cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } } =20 @@ -548,7 +548,7 @@ void HELPER(srst)(CPUS390XState *env, uint32_t r1, uint= 32_t r2) /* Bits 32-55 must contain all 0. */ if (env->regs[0] & 0xffffff00u) { cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } =20 str =3D get_address(env, r2); @@ -586,7 +586,7 @@ void HELPER(srstu)(CPUS390XState *env, uint32_t r1, uin= t32_t r2) /* Bits 32-47 of R0 must be zero. */ if (env->regs[0] & 0xffff0000u) { cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } =20 str =3D get_address(env, r2); @@ -1589,7 +1589,7 @@ uint32_t HELPER(csst)(CPUS390XState *env, uint32_t r3= , uint64_t a1, uint64_t a2) =20 spec_exception: cpu_restore_state(ENV_GET_CPU(env), ra); - program_interrupt(env, PGM_SPECIFICATION, 6); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); g_assert_not_reached(); } =20 @@ -1697,14 +1697,14 @@ uint32_t HELPER(testblock)(CPUS390XState *env, uint= 64_t real_addr) if (!address_space_access_valid(&address_space_memory, abs_addr, TARGET_PAGE_SIZE, true)) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_ADDRESSING, 4); + program_interrupt(env, PGM_ADDRESSING, ILEN_UNWIND); return 1; } =20 /* Check low-address protection */ if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_PROTECTION, 4); + program_interrupt(env, PGM_PROTECTION, ILEN_UNWIND); return 1; } =20 @@ -1859,7 +1859,7 @@ void HELPER(idte)(CPUS390XState *env, uint64_t r1, ui= nt64_t r2, uint32_t m4) =20 if (r2 & 0xff000) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIFICATION, 4); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } =20 if (!(r2 & 0x800)) { @@ -2015,7 +2015,7 @@ uint64_t HELPER(lra)(CPUS390XState *env, uint64_t add= r) /* XXX incomplete - has more corner cases */ if (!(env->psw.mask & PSW_MASK_64) && (addr >> 32)) { cpu_restore_state(cs, GETPC()); - program_interrupt(env, PGM_SPECIAL_OP, 2); + program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND); } =20 old_exc =3D cs->exception_index; @@ -2174,7 +2174,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t d= est, uint64_t src, =20 if (!(env->psw.mask & PSW_MASK_DAT)) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND); } =20 /* OAC (operand access control) for the first operand -> dest */ @@ -2206,16 +2206,16 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t= dest, uint64_t src, =20 if (dest_a && dest_as =3D=3D AS_HOME && (env->psw.mask & PSW_MASK_PSTA= TE)) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND); } if (!(env->cregs[0] & CR0_SECONDARY) && (dest_as =3D=3D AS_SECONDARY || src_as =3D=3D AS_SECONDARY)) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_SPECIAL_OP, 6); + program_interrupt(env, PGM_SPECIAL_OP, ILEN_UNWIND); } if (!psw_key_valid(env, dest_key) || !psw_key_valid(env, src_key)) { cpu_restore_state(cs, ra); - program_interrupt(env, PGM_PRIVILEGED, 6); + program_interrupt(env, PGM_PRIVILEGED, ILEN_UNWIND); } =20 len =3D wrap_length(env, len); @@ -2230,7 +2230,7 @@ uint32_t HELPER(mvcos)(CPUS390XState *env, uint64_t d= est, uint64_t src, qemu_log_mask(LOG_UNIMP, "%s: AR-mode and PSTATE support missing\n= ", __func__); cpu_restore_state(cs, ra); - program_interrupt(env, PGM_ADDRESSING, 6); + program_interrupt(env, PGM_ADDRESSING, ILEN_UNWIND); } =20 /* FIXME: a) LAP diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 452b2bd902..376dbd68c2 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -57,7 +57,7 @@ void QEMU_NORETURN runtime_exception(CPUS390XState *env, = int excp, =20 cs->exception_index =3D EXCP_PGM; env->int_pgm_code =3D excp; - env->int_pgm_ilen =3D ILEN_AUTO; + env->int_pgm_ilen =3D ILEN_UNWIND; =20 /* Use the (ultimate) callers address to find the insn that trapped. = */ cpu_restore_state(cs, retaddr); --=20 2.13.3 From nobody Wed Nov 5 00:15:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150095044497037.55276025144849; Mon, 24 Jul 2017 19:40:44 -0700 (PDT) Received: from localhost ([::1]:58101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpm7-0007cj-Os for importer@patchew.org; Mon, 24 Jul 2017 22:40:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpiL-0004fL-C5 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZpiK-0005nE-KZ for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:49 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:34749) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZpiK-0005n6-GS for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:48 -0400 Received: by mail-qk0-x242.google.com with SMTP id q66so11589683qki.1 for ; Mon, 24 Jul 2017 19:36:48 -0700 (PDT) Received: from bigtime.com ([71.217.194.233]) by smtp.gmail.com with ESMTPSA id l64sm8847707qkf.95.2017.07.24.19.36.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 19:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G4yP/x/pEvhcaVU4TLAta5dxFLG3PODHR/ckYtQ1dg0=; b=MK0EE6tCQozLxFiasPB7CygoYsBU/YI+w6ZvcHFbpzUyhCT9UGZ4HUAzAXA0RusEIk CQvD59CU1IV5LMyY4aRCZBjSD1E/jlfGO8car66ZR0mPLWAtcvoc0g6+LWWiZzJsuF3l Jep8yiqi5xstkVleU8wPMtDisYvOVkLMw1BtCyk8HB8pLiDe5R+5kcCe3jxEGRV1owsA RcSbeWxfaWbW/KkcY5IlhQ0bRBzoQvz8VMDjFwDkjZ8lbJK3kqCMd1+hf+OMqojlA83u MTgVcPJXxPhW1JSKZW9ELz180zWnG3kRX4iVBB5znndj7vUgoiYUNlc2X5xvT2Yrihm5 pUfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=G4yP/x/pEvhcaVU4TLAta5dxFLG3PODHR/ckYtQ1dg0=; b=UkCwHkvg8sZ6p0+/CaP98Y3+sG+B0Dp8vgMwimsakzJf54qy/YL+k4AGGlt5lE2Tok ouva8J3NYlBNivWrkuHZiAxW057d0mxkCQ9IPV4OE19ylKa3/K4NBlvxxSR6yguRA/dh 2eLJtiei/ZSMpNgR9mh+6u7z81b+cqbUnJFf2yjm53/c9GXjTtMbyt+GAiRFQvfjNWol elazT3cTDTXoOETReRK9F3qB3KJal5/DhmrDB3XLBrqm8dnQWAOhXA2MxvnYi3F1H7at CBNKgaEpzNLcEcQi3eo5mmzdY6LeM+e3lAo5hQ+uuR144WYxmN63iBC10R/cPN33e4PB 8Njg== X-Gm-Message-State: AIVw1130GnShybZ2PgTOxZVpSoznnnckeCcXybaQ79hQR+O/nbSTDjG5 G0xjhew5GkvHFbpa08c= X-Received: by 10.55.21.28 with SMTP id f28mr13606588qkh.220.1500950207793; Mon, 24 Jul 2017 19:36:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 19:36:10 -0700 Message-Id: <20170725023611.9169-4-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725023611.9169-1-rth@twiddle.net> References: <20170725023611.9169-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 3/4] target/s390x: Use unwind info in STSI X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: David Hildenbrand --- target/s390x/misc_helper.c | 3 ++- target/s390x/translate.c | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 376dbd68c2..ab8551f605 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -388,7 +388,8 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, if ((r0 & STSI_LEVEL_MASK) <=3D STSI_LEVEL_3 && ((r0 & STSI_R0_RESERVED_MASK) || (r1 & STSI_R1_RESERVED_MASK))) { /* valid function code, invalid reserved bits */ - program_interrupt(env, PGM_SPECIFICATION, 2); + cpu_restore_state(ENV_GET_CPU(env), GETPC()); + program_interrupt(env, PGM_SPECIFICATION, ILEN_UNWIND); } =20 sel1 =3D r0 & STSI_R0_SEL1_MASK; diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 9b0c35efa2..57f09154be 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3988,7 +3988,6 @@ static ExitStatus op_stpt(DisasContext *s, DisasOps *= o) static ExitStatus op_stsi(DisasContext *s, DisasOps *o) { check_privileged(s); - potential_page_fault(s); gen_helper_stsi(cc_op, cpu_env, o->in2, regs[0], regs[1]); set_cc_static(s); return NO_EXIT; --=20 2.13.3 From nobody Wed Nov 5 00:15:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500950454637186.10545856333772; Mon, 24 Jul 2017 19:40:54 -0700 (PDT) Received: from localhost ([::1]:58102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpmH-0007ja-Dd for importer@patchew.org; Mon, 24 Jul 2017 22:40:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZpiM-0004gv-Uf for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZpiL-0005nt-U8 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:50 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:35269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZpiL-0005nk-Pv for qemu-devel@nongnu.org; Mon, 24 Jul 2017 22:36:49 -0400 Received: by mail-qk0-x242.google.com with SMTP id k2so4148534qkf.2 for ; Mon, 24 Jul 2017 19:36:49 -0700 (PDT) Received: from bigtime.com ([71.217.194.233]) by smtp.gmail.com with ESMTPSA id l64sm8847707qkf.95.2017.07.24.19.36.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jul 2017 19:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=n5+D+MAsPGJhIi480kV6kptRXtkyE9qdIw3pzFGv+II=; b=Iew22QAYIP33hJiMGfFKlpYbWfgN+fRFayXO/42539IMteBOAMY4vIYOBV5dnLGhI6 +nuz1QQFs29rQOmv0pSucRjZpy3FdiF6coSJgnAICV4WaouYeSqpv1ejx1gzWSXXbIZi ngttmaSHEpGO91ds5cNBeLfLzXur2kyqMTrqrD8RrYh0tMLqWLPzPzmV7Xuo4eotYMFc zCs4K3iXZePzGKf0kUV6LGt3FR/7KthKbP6EwYJ7dgZ3NldkOVKAWVJzbstNLFOMqpnP RUqoUOG7GHP9d8S+8VbXLOmXGuMm+e4WrfYa3IrPXQK3LZX8scZ+BfBQ4AJcR44Xr+fY SA+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=n5+D+MAsPGJhIi480kV6kptRXtkyE9qdIw3pzFGv+II=; b=MFnSgHGc76O39XrO5ZhdJtXkmG8Z0zwzaKEMeXnHCWmfaOHy0eXknFDSHXUTdNNTYB kOWzfE+QG6QjN+Wr+TR/U23Fdo/TkN/fN7mbq2xrTMKR+gZrN22Is+WD8QS1okLzdJ1R plNxhBIOhvgsWtZPHjFykLqkCzCXQjyQOirgZQF4K/e7kluqW1zO8H7OjIfO2loumlj+ WUsyOyZ8lQkvN7CreCpS21wgxXna4riQggbIYmiPFCBpo4V8a3fnT0l0j+KwaI9VNrll a7gB+xzwWpTTQwhC9rnzAqlaol5hJkG22U22Nswjvht20BZiZKMBxVP+5H2exRQWVvs6 siow== X-Gm-Message-State: AIVw113sCCFEc4bMXY4l7xtF6XDtAkdJr6kjy0vkHB0Q5G9vPYresiSN jsmAwM4U8AyEXOJdAbM= X-Received: by 10.55.187.134 with SMTP id l128mr21922528qkf.90.1500950209097; Mon, 24 Jul 2017 19:36:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Jul 2017 19:36:11 -0700 Message-Id: <20170725023611.9169-5-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170725023611.9169-1-rth@twiddle.net> References: <20170725023611.9169-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 4/4] target/s390x: Use ilen from unwind in tlb_fill X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/s390x/mem_helper.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c index 026189aefd..1141f1362b 100644 --- a/target/s390x/mem_helper.c +++ b/target/s390x/mem_helper.c @@ -43,7 +43,18 @@ void tlb_fill(CPUState *cs, target_ulong addr, MMUAccess= Type access_type, { int ret =3D s390_cpu_handle_mmu_fault(cs, addr, access_type, mmu_idx); if (unlikely(ret !=3D 0)) { - cpu_loop_exit_restore(cs, retaddr); + cpu_restore_state(cs, retaddr); + + /* Note that handle_mmu_fault sets ilen to either 2 (for code) + or AUTO (for data). We can resolve AUTO now, as if it was + set to UNWIND -- that will have been done via assignment + in cpu_restore_state. Otherwise re-examine access_type. */ + if (access_type =3D=3D MMU_INST_FETCH) { + CPUS390XState *env =3D cs->env_ptr; + env->int_pgm_ilen =3D 2; + } + + cpu_loop_exit(cs); } } =20 --=20 2.13.3