From nobody Thu May 16 15:59:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1635480391108126.96970521258515; Thu, 28 Oct 2021 21:06:31 -0700 (PDT) Received: from localhost ([::1]:56840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgJ9x-0001ux-RK for importer@patchew.org; Fri, 29 Oct 2021 00:06:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgJ6v-0008DJ-RJ for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:03:21 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:52636) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1mgJ6t-0004H1-Eu for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:03:21 -0400 Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Oct 2021 21:03:09 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg01-sd.qualcomm.com with ESMTP; 28 Oct 2021 21:03:08 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 74BCF1418; Thu, 28 Oct 2021 23:03:08 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635480199; x=1667016199; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yAtAucQgzhdHYeDxTbOd5bZQ+VwClS+SaFL9/ilRU9k=; b=W8w95BeYyBYz4z8ZRK3HN02/409qCmSM43gqcgUb1FebLkq+EU3xQTwh WwV/gWPmJt4uey/so+Q4dOvdbCweMG56P68/Iu69MaMz8znkX4yR/tRBp IJyADX70is2i1fffs6KuRSKylKvsHL+bwJNDPdQCYGLQj1hdzDVax9fSR A=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PULL 1/2] Hexagon (target/hexagon) more tcg_constant_* Date: Thu, 28 Oct 2021 23:02:57 -0500 Message-Id: <1635480178-26461-2-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1635480178-26461-1-git-send-email-tsimpson@quicinc.com> References: <1635480178-26461-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.39; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-02.qualcomm.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, tsimpson@quicinc.com, richard.henderson@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1635480392178100003 Content-Type: text/plain; charset="utf-8" Change additional tcg_const_tl to tcg_constant_tl Note that gen_pred_cancal had slot_mask initialized with tcg_const_tl. However, it is not constant throughout, so we initialize it with tcg_temp_new and replace the first use with the constant value. Inspired-by: Richard Henderson Inspired-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 9 +++------ target/hexagon/macros.h | 7 +++---- target/hexagon/translate.c | 3 +-- target/hexagon/gen_tcg_funcs.py | 11 ++--------- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 0361564..c6f0879 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -66,11 +66,10 @@ } while (0) #define GET_EA_pci \ do { \ - TCGv tcgv_siV =3D tcg_const_tl(siV); \ + TCGv tcgv_siV =3D tcg_constant_tl(siV); \ tcg_gen_mov_tl(EA, RxV); \ gen_helper_fcircadd(RxV, RxV, tcgv_siV, MuV, \ hex_gpr[HEX_REG_CS0 + MuN]); \ - tcg_temp_free(tcgv_siV); \ } while (0) #define GET_EA_pcr(SHIFT) \ do { \ @@ -557,7 +556,7 @@ #define fGEN_TCG_A4_addp_c(SHORTCODE) \ do { \ TCGv_i64 carry =3D tcg_temp_new_i64(); \ - TCGv_i64 zero =3D tcg_const_i64(0); \ + TCGv_i64 zero =3D tcg_constant_i64(0); \ tcg_gen_extu_i32_i64(carry, PxV); \ tcg_gen_andi_i64(carry, carry, 1); \ tcg_gen_add2_i64(RddV, carry, RssV, zero, carry, zero); \ @@ -565,14 +564,13 @@ tcg_gen_extrl_i64_i32(PxV, carry); \ gen_8bitsof(PxV, PxV); \ tcg_temp_free_i64(carry); \ - tcg_temp_free_i64(zero); \ } while (0) =20 /* r5:4 =3D sub(r1:0, r3:2, p1):carry */ #define fGEN_TCG_A4_subp_c(SHORTCODE) \ do { \ TCGv_i64 carry =3D tcg_temp_new_i64(); \ - TCGv_i64 zero =3D tcg_const_i64(0); \ + TCGv_i64 zero =3D tcg_constant_i64(0); \ TCGv_i64 not_RttV =3D tcg_temp_new_i64(); \ tcg_gen_extu_i32_i64(carry, PxV); \ tcg_gen_andi_i64(carry, carry, 1); \ @@ -582,7 +580,6 @@ tcg_gen_extrl_i64_i32(PxV, carry); \ gen_8bitsof(PxV, PxV); \ tcg_temp_free_i64(carry); \ - tcg_temp_free_i64(zero); \ tcg_temp_free_i64(not_RttV); \ } while (0) =20 diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 44e9b85..5c19cde 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -187,10 +187,10 @@ #ifdef QEMU_GENERATE static inline void gen_pred_cancel(TCGv pred, int slot_num) { - TCGv slot_mask =3D tcg_const_tl(1 << slot_num); + TCGv slot_mask =3D tcg_temp_new(); TCGv tmp =3D tcg_temp_new(); TCGv zero =3D tcg_constant_tl(0); - tcg_gen_or_tl(slot_mask, hex_slot_cancelled, slot_mask); + tcg_gen_ori_tl(slot_mask, hex_slot_cancelled, 1 << slot_num); tcg_gen_andi_tl(tmp, pred, 1); tcg_gen_movcond_tl(TCG_COND_EQ, hex_slot_cancelled, tmp, zero, slot_mask, hex_slot_cancelled); @@ -498,10 +498,9 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val= , int shift) #define fPM_M(REG, MVAL) tcg_gen_add_tl(REG, REG, MVAL) #define fPM_CIRI(REG, IMM, MVAL) \ do { \ - TCGv tcgv_siV =3D tcg_const_tl(siV); \ + TCGv tcgv_siV =3D tcg_constant_tl(siV); \ gen_helper_fcircadd(REG, REG, tcgv_siV, MuV, \ hex_gpr[HEX_REG_CS0 + MuN]); \ - tcg_temp_free(tcgv_siV); \ } while (0) #else #define fEA_IMM(IMM) do { EA =3D (IMM); } while (0) diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 159931e..724b4fc 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -487,9 +487,8 @@ static void gen_commit_packet(DisasContext *ctx, Packet= *pkt) * process_store_log will execute the slot 1 store first, * so we only have to probe the store in slot 0 */ - TCGv mem_idx =3D tcg_const_tl(ctx->mem_idx); + TCGv mem_idx =3D tcg_constant_tl(ctx->mem_idx); gen_helper_probe_pkt_scalar_store_s0(cpu_env, mem_idx); - tcg_temp_free(mem_idx); } =20 process_store_log(ctx, pkt); diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index ca8a801..e3d59dd 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -279,15 +279,12 @@ def gen_helper_call_opn(f, tag, regtype, regid, toss,= numregs, i): print("Bad register parse: ",regtype,regid,toss,numregs) =20 def gen_helper_decl_imm(f,immlett): - f.write(" TCGv tcgv_%s =3D tcg_const_tl(%s);\n" % \ + f.write(" TCGv tcgv_%s =3D tcg_constant_tl(%s);\n" % \ (hex_common.imm_name(immlett), hex_common.imm_name(immlett))) =20 def gen_helper_call_imm(f,immlett): f.write(", tcgv_%s" % hex_common.imm_name(immlett)) =20 -def gen_helper_free_imm(f,immlett): - f.write(" tcg_temp_free(tcgv_%s);\n" % hex_common.imm_name(immlett)) - def genptr_dst_write_pair(f, tag, regtype, regid): if ('A_CONDEXEC' in hex_common.attribdict[tag]): f.write(" gen_log_predicated_reg_write_pair(%s%sN, %s%sV, insn-= >slot);\n" % \ @@ -401,7 +398,7 @@ def gen_tcg_func(f, tag, regs, imms): for immlett,bits,immshift in imms: gen_helper_decl_imm(f,immlett) if hex_common.need_part1(tag): - f.write(" TCGv part1 =3D tcg_const_tl(insn->part1);\n") + f.write(" TCGv part1 =3D tcg_constant_tl(insn->part1);\n") if hex_common.need_slot(tag): f.write(" TCGv slot =3D tcg_constant_tl(insn->slot);\n") f.write(" gen_helper_%s(" % (tag)) @@ -424,10 +421,6 @@ def gen_tcg_func(f, tag, regs, imms): if hex_common.need_slot(tag): f.write(", slot") if hex_common.need_part1(tag): f.write(", part1" ) f.write(");\n") - if hex_common.need_part1(tag): - f.write(" tcg_temp_free(part1);\n") - for immlett,bits,immshift in imms: - gen_helper_free_imm(f,immlett) =20 ## Write all the outputs for regtype,regid,toss,numregs in regs: --=20 2.7.4 From nobody Thu May 16 15:59:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1635480430458719.3490942780843; Thu, 28 Oct 2021 21:07:10 -0700 (PDT) Received: from localhost ([::1]:57944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgJAb-0002kp-Bp for importer@patchew.org; Fri, 29 Oct 2021 00:07:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgJ6r-00089V-H8 for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:03:18 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:56608) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1mgJ6m-0004H2-W7 for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:03:16 -0400 Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-01.qualcomm.com with ESMTP; 28 Oct 2021 21:03:09 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 28 Oct 2021 21:03:08 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id 7780B1B42; Thu, 28 Oct 2021 23:03:08 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635480193; x=1667016193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VM1H5/Trj+Vc2Ff9aAS6OkMxsEzLM+8TTGcJInlMidc=; b=jRjT4e6Ur/6cADb3UNfwC/yDYfRbBYxfuAiliSoXRNtBGvbAdRfwC30H C3wvjoCbMVKuctp+2UFmLwzPuQPJcKEzqftm0MaUlF1HJirOEqeKS/n9m Dlh7Dh0gQrpNeAG2++PKX8ZhGst3oI75MXyBX52eCG+qxZu5YQXU7/8Uz U=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PULL 2/2] Hexagon (target/hexagon) put writes to USR into temp until commit Date: Thu, 28 Oct 2021 23:02:58 -0500 Message-Id: <1635480178-26461-3-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1635480178-26461-1-git-send-email-tsimpson@quicinc.com> References: <1635480178-26461-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.38; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-01.qualcomm.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, tsimpson@quicinc.com, richard.henderson@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1635480432328100001 Change SET_USR_FIELD to write to hex_new_value[HEX_REG_USR] instead of hex_gpr[HEX_REG_USR]. Then, we need code to mark the instructions that can set implicitly set USR - Macros added to hex_common.py - A_FPOP added in translate.c Test case added in tests/tcg/hexagon/overflow.c Reviewed-by: Richard Henderson Signed-off-by: Taylor Simpson --- target/hexagon/macros.h | 2 +- target/hexagon/attribs_def.h.inc | 1 + target/hexagon/translate.c | 9 +++- tests/tcg/hexagon/overflow.c | 107 ++++++++++++++++++++++++++++++++++= ++++ target/hexagon/hex_common.py | 2 + tests/tcg/hexagon/Makefile.target | 1 + 6 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/hexagon/overflow.c diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 5c19cde..13e957b 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -62,7 +62,7 @@ reg_field_info[FIELD].offset) =20 #define SET_USR_FIELD(FIELD, VAL) \ - fINSERT_BITS(env->gpr[HEX_REG_USR], reg_field_info[FIELD].width, \ + fINSERT_BITS(env->new_value[HEX_REG_USR], reg_field_info[FIELD].width,= \ reg_field_info[FIELD].offset, (VAL)) #endif =20 diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index 3815509..e44a7ea 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -64,6 +64,7 @@ DEF_ATTRIB(IMPLICIT_WRITES_P1, "Writes Predicate 1", "", = "UREG.P1") DEF_ATTRIB(IMPLICIT_WRITES_P2, "Writes Predicate 1", "", "UREG.P2") DEF_ATTRIB(IMPLICIT_WRITES_P3, "May write Predicate 3", "", "UREG.P3") DEF_ATTRIB(IMPLICIT_READS_PC, "Reads the PC register", "", "") +DEF_ATTRIB(IMPLICIT_WRITES_USR, "May write USR", "", "") DEF_ATTRIB(WRITES_PRED_REG, "Writes a predicate register", "", "") =20 DEF_ATTRIB(CRSLOT23, "Can execute in slot 2 or slot 3 (CR)", "", "") diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 724b4fc..e10ef36 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -204,7 +204,12 @@ static void mark_implicit_reg_write(DisasContext *ctx,= Insn *insn, int attrib, int rnum) { if (GET_ATTRIB(insn->opcode, attrib)) { - bool is_predicated =3D GET_ATTRIB(insn->opcode, A_CONDEXEC); + /* + * USR is used to set overflow and FP exceptions, + * so treat it as conditional + */ + bool is_predicated =3D GET_ATTRIB(insn->opcode, A_CONDEXEC) || + rnum =3D=3D HEX_REG_USR; if (is_predicated && !is_preloaded(ctx, rnum)) { tcg_gen_mov_tl(hex_new_value[rnum], hex_gpr[rnum]); } @@ -230,6 +235,8 @@ static void mark_implicit_reg_writes(DisasContext *ctx,= Insn *insn) mark_implicit_reg_write(ctx, insn, A_IMPLICIT_WRITES_SA0, HEX_REG_SA0); mark_implicit_reg_write(ctx, insn, A_IMPLICIT_WRITES_LC1, HEX_REG_LC1); mark_implicit_reg_write(ctx, insn, A_IMPLICIT_WRITES_SA1, HEX_REG_SA1); + mark_implicit_reg_write(ctx, insn, A_IMPLICIT_WRITES_USR, HEX_REG_USR); + mark_implicit_reg_write(ctx, insn, A_FPOP, HEX_REG_USR); } =20 static void mark_implicit_pred_writes(DisasContext *ctx, Insn *insn) diff --git a/tests/tcg/hexagon/overflow.c b/tests/tcg/hexagon/overflow.c new file mode 100644 index 0000000..196fcf7 --- /dev/null +++ b/tests/tcg/hexagon/overflow.c @@ -0,0 +1,107 @@ +/* + * Copyright(c) 2021 Qualcomm Innovation Center, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include +#include +#include +#include +#include +#include + + +int err; + +static void __check(const char *filename, int line, int x, int expect) +{ + if (x !=3D expect) { + printf("ERROR %s:%d - %d !=3D %d\n", + filename, line, x, expect); + err++; + } +} + +#define check(x, expect) __check(__FILE__, __LINE__, (x), (expect)) + +static int satub(int src, int *p, int *ovf_result) +{ + int result; + int usr; + + /* + * This instruction can set bit 0 (OVF/overflow) in usr + * Clear the bit first, then return that bit to the caller + * + * We also store the src into *p in the same packet, so we + * can ensure the overflow doesn't get set when an exception + * is generated. + */ + asm volatile("r2 =3D usr\n\t" + "r2 =3D clrbit(r2, #0)\n\t" /* clear overflow bit = */ + "usr =3D r2\n\t" + "{\n\t" + " %0 =3D satub(%2)\n\t" + " memw(%3) =3D %2\n\t" + "}\n\t" + "%1 =3D usr\n\t" + : "=3Dr"(result), "=3Dr"(usr) + : "r"(src), "r"(p) + : "r2", "usr", "memory"); + *ovf_result =3D (usr & 1); + return result; +} + +int read_usr_overflow(void) +{ + int result; + asm volatile("%0 =3D usr\n\t" : "=3Dr"(result)); + return result & 1; +} + + +jmp_buf jmp_env; +int usr_overflow; + +static void sig_segv(int sig, siginfo_t *info, void *puc) +{ + usr_overflow =3D read_usr_overflow(); + longjmp(jmp_env, 1); +} + +int main() +{ + struct sigaction act; + int ovf; + + /* SIGSEGV test */ + act.sa_sigaction =3D sig_segv; + sigemptyset(&act.sa_mask); + act.sa_flags =3D SA_SIGINFO; + sigaction(SIGSEGV, &act, NULL); + if (setjmp(jmp_env) =3D=3D 0) { + satub(300, 0, &ovf); + } + + act.sa_handler =3D SIG_DFL; + sigemptyset(&act.sa_mask); + act.sa_flags =3D 0; + + check(usr_overflow, 0); + + puts(err ? "FAIL" : "PASS"); + return err ? EXIT_FAILURE : EXIT_SUCCESS; +} diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index b3b5340..a84b003 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -73,6 +73,8 @@ def calculate_attribs(): add_qemu_macro_attrib('fWRITE_P1', 'A_WRITES_PRED_REG') add_qemu_macro_attrib('fWRITE_P2', 'A_WRITES_PRED_REG') add_qemu_macro_attrib('fWRITE_P3', 'A_WRITES_PRED_REG') + add_qemu_macro_attrib('fSET_OVERFLOW', 'A_IMPLICIT_WRITES_USR') + add_qemu_macro_attrib('fSET_LPCFG', 'A_IMPLICIT_WRITES_USR') =20 # Recurse down macros, find attributes from sub-macros macroValues =3D list(macros.values()) diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index c1e1650..8b07a28 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -40,5 +40,6 @@ HEX_TESTS +=3D load_unpack HEX_TESTS +=3D load_align HEX_TESTS +=3D atomics HEX_TESTS +=3D fpstuff +HEX_TESTS +=3D overflow =20 TESTS +=3D $(HEX_TESTS) --=20 2.7.4