From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BFFCF7803CC for ; Tue, 26 Sep 2023 17:15:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ISKXZR1ahuGkk4gkPNZRP/wMjh/7uLQgkOZ1gw6Gwik=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1695748543; v=1; b=OtU1MWg040T63v252GQyqB8oPqULTvdV7Sb/FMYvS46AHUbAFqeKGMfmMfqTs5LEzV1ROkVM 6j1J+bVJn6+JwqbR3O686PZddk8o7jSAob5Wi4A/xnhsPbZomXucBVIs1Yod4RymEXSc25xzVS2 S7yayBRCOuF7hN72j1rfWvVw= X-Received: by 127.0.0.2 with SMTP id 4HBFYY7687511xzfa11v8Gf7; Tue, 26 Sep 2023 10:15:43 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web10.25336.1695748542929930538 for ; Tue, 26 Sep 2023 10:15:42 -0700 X-Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38QD4fZL019379; Tue, 26 Sep 2023 17:15:40 GMT X-Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tbw9bh6k1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Sep 2023 17:15:39 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38QHFdlD002292 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Sep 2023 17:15:39 GMT X-Received: from qc-i7.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Tue, 26 Sep 2023 10:15:37 -0700 From: "Leif Lindholm" To: CC: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrei Warkentin , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v2 4/5] MdePkg/BaseLib: correct register sizes in AArch64 SetJump/LongJump Date: Tue, 26 Sep 2023 18:15:22 +0100 Message-ID: <20230926171523.368706-5-quic_llindhol@quicinc.com> In-Reply-To: <20230926171523.368706-1-quic_llindhol@quicinc.com> References: <20230926171523.368706-1-quic_llindhol@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-GUID: -1_tl99B9uxy_vBVXK2Wh-YPvE-Y8MSW X-Proofpoint-ORIG-GUID: -1_tl99B9uxy_vBVXK2Wh-YPvE-Y8MSW Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: v9aQnMJD2Ybm4iiN9cY801mDx7686176AA= Content-Transfer-Encoding: 8bit Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=OtU1MWg0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Both in SetJump and in InternalLongJump, 32-bit w register views were used for the UINTN return value. In SetJump, this did not cause errors; it was only counterintuitive. But in InternalLongJump, it meant the top 32 bits of Value were stripped off. Change all of these to use the 64-bit x register views. Signed-off-by: Leif Lindholm Reanimated-by: Andrei Warkentin Cc: Ard Biesheuvel Cc: Sami Mujawar --- MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S | 8 ++++---- MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S index de79ad3a0a3e..3e58119b25d2 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S @@ -61,7 +61,7 @@ ASM_PFX(SetJump): FPR_LAYOUT #undef REG_PAIR #undef REG_ONE - mov w0, #0 + mov x0, #0 ret #/** @@ -91,9 +91,9 @@ ASM_PFX(InternalLongJump): #undef REG_PAIR #undef REG_ONE mov sp, x16 - cmp w1, #0 - mov w0, #1 - csel w0, w1, w0, ne + cmp x1, #0 + mov x0, #1 + csel x0, x1, x0, ne ret ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm index c2774eece311..6ec8f35f2c9f 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm @@ -59,7 +59,7 @@ SetJump FPR_LAYOUT #undef REG_PAIR #undef REG_ONE - mov w0, #0 + mov x0, #0 ret ;/** @@ -88,10 +88,10 @@ InternalLongJump #undef REG_PAIR #undef REG_ONE mov sp, x16 - cmp w1, #0 - mov w0, #1 + cmp x1, #0 + mov x0, #1 beq exit - mov w0, w1 + mov x0, x1 exit // use br not ret, as ret is guaranteed to mispredict br x30 -- 2.30.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109077): https://edk2.groups.io/g/devel/message/109077 Mute This Topic: https://groups.io/mt/101600808/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-