From nobody Wed Nov 5 02:54:33 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