From nobody Thu May 9 02:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65816+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65816+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1601577445; cv=none; d=zohomail.com; s=zohoarc; b=nix3FBv+FoN34W8L45sy6E315WwRtHXK4Ni5PRsQn2wO+fu+xy7tC3GYpFDA+4mTXogHV2n9VlLJk+T+BDciSpka8i7yJhHMBEkIAjIvnRlaH3N1/DPzPkIsFoh3jCalNLYLmbacsiXrRdC5Expyzb0hBWgBlSbrHt7mmE3lyIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577445; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=S0eOH+FDDyg1d4Ckig1PeJzrDHhRuIsKsToODg+X8dg=; b=X5fYr3zooN8xrZdj+4Se6EcIstMy6VxZt/pgVZPvk++eVJszsh1vPBVqvcgtoNeauTA2HUmyf3w4nizpPWzz1lUpT3MsfcJ4Q35kyyp0ZAFkmoie63yv6S3ovcnr1UaccMs+XA/1zapiF05BJJlnX3SzkyF3g7N84iYp9O4jfY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65816+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601577445870106.39751246472133; Thu, 1 Oct 2020 11:37:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id liIQYY1788612xcKI5fR403O; Thu, 01 Oct 2020 11:37:25 -0700 X-Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.groups.io with SMTP id smtpd.web11.1022.1601577444719175368 for ; Thu, 01 Oct 2020 11:37:25 -0700 X-Received: by mail-wm1-f68.google.com with SMTP id s13so3923967wmh.4 for ; Thu, 01 Oct 2020 11:37:24 -0700 (PDT) X-Gm-Message-State: Nk5THe52aFKuexgsXrjgOub5x1787277AA= X-Google-Smtp-Source: ABdhPJy7rTMqtvHH1flegm7nzmwM4Kl/x7Hhyld1v4SbT+tHkZwxlfk/9DBaEXPHZbUAQ8QyZa3J0Q== X-Received: by 2002:a1c:2d86:: with SMTP id t128mr1399886wmt.189.1601577439786; Thu, 01 Oct 2020 11:37:19 -0700 (PDT) X-Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id a3sm964671wmb.46.2020.10.01.11.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:37:19 -0700 (PDT) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 1/5] MdePkg/BaseLib: fix comments in ARM* SetJump/LongJump implementations Date: Thu, 1 Oct 2020 19:37:08 +0100 Message-Id: <20201001183712.1738-2-leif@nuviainc.com> In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,leif@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601577445; bh=4jZX2YRBogovPeBvNexGpThgyYAzVgrUXudcmjj/r3g=; h=Cc:Date:From:Reply-To:Subject:To; b=p/wUUNwRTbzd5QCG3siJFV4KtrKYx31yBOcJI6XjUJHguKDQLaxo4ODRQyLfZ5HE5ha eItLmBfQVfrjlE5lpTFnUXYM276mPGAqtuqVAB53+2AYM78qWhgghcuHJZXdqakDVV1ns wx4P2dE5gRFYQRcSmgCUaUjt8dud802LKrI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Drop redundant comment about IPF (clearly copied across from now deleted code). Also change "Instead is resumes execution" -> "Instead it resumes execution" Signed-off-by: Leif Lindholm --- MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S | 3 +-- MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 3 +-- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 3 +-- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S b/MdePkg/Libr= ary/BaseLib/AArch64/SetJumpLongJump.S index 72cea259e913..989736cee74c 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S @@ -33,7 +33,6 @@ GCC_ASM_EXPORT(InternalLongJump) # value to be returned by SetJump(). # # If JumpBuffer is NULL, then ASSERT(). -# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then = ASSERT(). # # @param JumpBuffer A pointer to CPU context buffer. # @@ -61,7 +60,7 @@ ASM_PFX(SetJump): # # Restores the CPU context from the buffer specified by JumpBuffer. # This function never returns to the caller. -# Instead is resumes execution based on the state of JumpBuffer. +# Instead it resumes execution based on the state of JumpBuffer. # # @param JumpBuffer A pointer to CPU context buffer. # @param Value The value to return when the SetJump() context is= restored. diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Li= brary/BaseLib/AArch64/SetJumpLongJump.asm index 20dd0f1b850f..8922128e8c62 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm @@ -32,7 +32,6 @@ ; value to be returned by SetJump(). ; ; If JumpBuffer is NULL, then ASSERT(). -; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then = ASSERT(). ; ; @param JumpBuffer A pointer to CPU context buffer. ; @@ -60,7 +59,7 @@ SetJump ; ; Restores the CPU context from the buffer specified by JumpBuffer. ; This function never returns to the caller. -; Instead is resumes execution based on the state of JumpBuffer. +; Instead it resumes execution based on the state of JumpBuffer. ; ; @param JumpBuffer A pointer to CPU context buffer. ; @param Value The value to return when the SetJump() context is= restored. diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/= BaseLib/Arm/SetJumpLongJump.S index 82d94faf61e9..e4c1946a28ff 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S @@ -19,7 +19,6 @@ GCC_ASM_EXPORT(InternalLongJump) # value to be returned by SetJump(). # # If JumpBuffer is NULL, then ASSERT(). -# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then = ASSERT(). # # @param JumpBuffer A pointer to CPU context buffer. # @@ -42,7 +41,7 @@ ASM_PFX(SetJump): # # Restores the CPU context from the buffer specified by JumpBuffer. # This function never returns to the caller. -# Instead is resumes execution based on the state of JumpBuffer. +# Instead it resumes execution based on the state of JumpBuffer. # # @param JumpBuffer A pointer to CPU context buffer. # @param Value The value to return when the SetJump() context is= restored. diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Librar= y/BaseLib/Arm/SetJumpLongJump.asm index 936f722be60f..e1eff758f7ab 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm @@ -19,7 +19,6 @@ ; value to be returned by SetJump(). ; ; If JumpBuffer is NULL, then ASSERT(). -; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then = ASSERT(). ; ; @param JumpBuffer A pointer to CPU context buffer. ; @@ -42,7 +41,7 @@ SetJump ; ; Restores the CPU context from the buffer specified by JumpBuffer. ; This function never returns to the caller. -; Instead is resumes execution based on the state of JumpBuffer. +; Instead it resumes execution based on the state of JumpBuffer. ; ; @param JumpBuffer A pointer to CPU context buffer. ; @param Value The value to return when the SetJump() context is= restored. --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65816): https://edk2.groups.io/g/devel/message/65816 Mute This Topic: https://groups.io/mt/77247143/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 9 02:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65813+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65813+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1601577443; cv=none; d=zohomail.com; s=zohoarc; b=ejRLeiM/y9fsgALHS7HISdIRsPX+7ou2LXF1g6/qP6dzGotXLPLuzKadSd7e4rOsbvN6rlotXZNRje81wEjakVTP/ZR765lj5hAvQUYJG3f8RqcsToRN6e2VBQVFvV9KAg6kPzhSy3b6fFX0WSg1ExMxa8vV9rbO1BdiRTYi060= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577443; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+qAps3Fnj0FHwiM+Hdyj7R+adWadUD/KsTNiH5irpQk=; b=m+WWVZFrFYmYwJh1IDeTIAT8TgAnCEwScxD2YmiSUba3NicMk7JAqpe+YcY52gn2isNyjIisjPu4cmxZ4XdvMx67EEh5rszhq95IA3sW8SJppRpVKc1Us/klgetYQoaKXEesU6utObd8eFG4ehWX9Lf56nN/pXnygbQzRHyrkjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65813+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601577443739632.3603513689452; Thu, 1 Oct 2020 11:37:23 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gfFvYY1788612xGHOlYXsq4c; Thu, 01 Oct 2020 11:37:23 -0700 X-Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by mx.groups.io with SMTP id smtpd.web10.1031.1601577442458089088 for ; Thu, 01 Oct 2020 11:37:22 -0700 X-Received: by mail-wm1-f49.google.com with SMTP id t17so4203483wmi.4 for ; Thu, 01 Oct 2020 11:37:22 -0700 (PDT) X-Gm-Message-State: jpIicOys5pW9l7SjsYjLq3Osx1787277AA= X-Google-Smtp-Source: ABdhPJzaHbcXboVpdqaBm6i2MlMzQ63pksW12yaujg/xeOs7J7jWlaY6CxKCiRvzUFnR4lUjRE+uTw== X-Received: by 2002:a1c:5602:: with SMTP id k2mr1372819wmb.25.1601577440638; Thu, 01 Oct 2020 11:37:20 -0700 (PDT) X-Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id a3sm964671wmb.46.2020.10.01.11.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:37:20 -0700 (PDT) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 2/5] MdePkg/BaseLib: add ASSERT in ARM* SetJump implementations Date: Thu, 1 Oct 2020 19:37:09 +0100 Message-Id: <20201001183712.1738-3-leif@nuviainc.com> In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,leif@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601577443; bh=PXWP2K7wdIUCx59B7xEkzbg6cMLWLs7O17qvFccBRc0=; h=Cc:Date:From:Reply-To:Subject:To; b=jtUoP1cBRFlHxRIKyFmZ/kmYvePAYXptDRM1it2+TVUhlmukOv7+lwI1FdQH64rAHIy p6OD8auwkSEBbBPxTwSwsAMWdJDHMDZcQe/8Z58+Ef7HcZ0kUrrHQvxehGEWRcTMkx20v h+l/5gVNgx/PDbItqXJVQ2fmITTdYjXTLTo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The SetJump comment header states that: If JumpBuffer is NULL, then ASSERT(). However, this was not currently done. Add a call to InternalAssertJumpBuffer. Signed-off-by: Leif Lindholm --- MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S | 3 +++ MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm | 3 +++ MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 3 +++ MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 3 +++ 4 files changed, 12 insertions(+) diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S b/MdePkg/Libr= ary/BaseLib/AArch64/SetJumpLongJump.S index 989736cee74c..34765a676430 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S @@ -45,6 +45,9 @@ GCC_ASM_EXPORT(InternalLongJump) # ); # ASM_PFX(SetJump): + stp x30, x0, [sp, #-16]! + bl InternalAssertJumpBuffer + ldp x30, x0, [sp], #16 mov x16, sp // use IP0 so save SP #define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] #define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Li= brary/BaseLib/AArch64/SetJumpLongJump.asm index 8922128e8c62..f2729a8bb03e 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm @@ -44,6 +44,9 @@ ; ); ; SetJump + stp x30, x0, [sp, #-16]! + bl InternalAssertJumpBuffer + ldp x30, x0, [sp], #16 mov x16, sp // use IP0 so save SP #define REG_PAIR(REG1, REG2, OFFS) stp REG1, REG2, [x0, OFFS] #define REG_ONE(REG1, OFFS) str REG1, [x0, OFFS] diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/= BaseLib/Arm/SetJumpLongJump.S index e4c1946a28ff..54b11ad2197c 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S @@ -31,6 +31,9 @@ GCC_ASM_EXPORT(InternalLongJump) # ); # ASM_PFX(SetJump): + push {r0, lr} + bl InternalAssertJumpBuffer + pop {r0, lr} mov r3, r13 stmia r0, {r3-r12,r14} eor r0, r0, r0 diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Librar= y/BaseLib/Arm/SetJumpLongJump.asm index e1eff758f7ab..6d47033975f2 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm @@ -31,6 +31,9 @@ ; ) ; SetJump + PUSH {R0, LR} + BL InternalAssertJumpBuffer + POP {R0, LR} MOV R3, R13 STM R0, {R3-R12,R14} EOR R0, R0 --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65813): https://edk2.groups.io/g/devel/message/65813 Mute This Topic: https://groups.io/mt/77247140/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 9 02:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65814+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65814+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1601577444; cv=none; d=zohomail.com; s=zohoarc; b=QJ3OO5N5MGZS9Rv5P23iguqiHjfLG94VmVE2gJcs/5vxaIBWHy2YTvgm0hCIMq5shRUjmz7+yhhqMVb3oSSoWZCVsgEB20QRqcP1bk14c6uKzjPxwA2onntzoyN0HpnIOf+vhXDzocx66H7qrS9N7uD/d1rzrvHEPAASDZ5MK30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577444; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9tPO5SHQa120x1QlczaSGZ3gF2eMLpv33lOHbW5QpBg=; b=cYQRGuYc6hi9l9JgxXZN99uT+vbGcck/4Z0FI/hB/mALJiZTGfOifG4lOrgNSmOx2dxQMAoPyGymhQJk4Cn9YZlrHAaen0cP3CqYofRcOOVRBnFp4yn17X46wdN+B7ypkkaOBd6VfuyUAW+18hC6r3dhpFTP4jWx8VUCIeaZpfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65814+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601577444313380.66851355849815; Thu, 1 Oct 2020 11:37:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uZvfYY1788612xOOuQcUm6c8; Thu, 01 Oct 2020 11:37:23 -0700 X-Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web12.1030.1601577443184171754 for ; Thu, 01 Oct 2020 11:37:23 -0700 X-Received: by mail-wm1-f48.google.com with SMTP id s13so3923897wmh.4 for ; Thu, 01 Oct 2020 11:37:22 -0700 (PDT) X-Gm-Message-State: jtCGHxu3XBMu5yoENPKVN1TFx1787277AA= X-Google-Smtp-Source: ABdhPJxzL62SMvP9j/umB3efaGhpmMPEwN7NYqQ3bnkCZhhOEmW0mDBzpuukqpm20uJUrNeCnHn9jA== X-Received: by 2002:a7b:c111:: with SMTP id w17mr1296903wmi.109.1601577441420; Thu, 01 Oct 2020 11:37:21 -0700 (PDT) X-Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id a3sm964671wmb.46.2020.10.01.11.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:37:21 -0700 (PDT) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 3/5] MdePkg/BaseLib: use normal register init in ARM SetJump implementations Date: Thu, 1 Oct 2020 19:37:10 +0100 Message-Id: <20201001183712.1738-4-leif@nuviainc.com> In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,leif@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601577443; bh=AcfGwCa4NlvOWAvo/ucg0/bFvSqcwktRBsvi3N8e4HA=; h=Cc:Date:From:Reply-To:Subject:To; b=vFDAVBuudf1+2/EI3TscB511jML1aUeYfCENb2Gs9HPmkWHos5egRhevXM9lwSH34oH eU+bzR5JiVBuNklsrIMHokSPH9jSznxcUImLgfxThUoFUNlQg7ByZyilqMHCzWme8Ki2M 45sU3oDYIcLsiEsdsm9GAUCUGKP/xmrDP0U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" There may be architectures on which there are benefits to eor r0, r0(, r0) but ARM was never one of them. Change to more readable mov r0, #0 instead. Signed-off-by: Leif Lindholm Reviewed-by: Philippe Mathieu-Daude --- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 2 +- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/= BaseLib/Arm/SetJumpLongJump.S index 54b11ad2197c..407df5f41ac5 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S @@ -36,7 +36,7 @@ ASM_PFX(SetJump): pop {r0, lr} mov r3, r13 stmia r0, {r3-r12,r14} - eor r0, r0, r0 + mov r0, #0 bx lr =20 #/** diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Librar= y/BaseLib/Arm/SetJumpLongJump.asm index 6d47033975f2..3a45f045460a 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm @@ -36,7 +36,7 @@ SetJump POP {R0, LR} MOV R3, R13 STM R0, {R3-R12,R14} - EOR R0, R0 + MOV RO, #0 BX LR =20 ;/** --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65814): https://edk2.groups.io/g/devel/message/65814 Mute This Topic: https://groups.io/mt/77247141/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 9 02:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65815+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65815+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1601577445; cv=none; d=zohomail.com; s=zohoarc; b=U5a4wN4dp1DxB6XnctrkWTSEF6pHMGrtJ14XZFI0ab+71O8n5NFyd2FYGzCGlRU7JrNxoSp/yisoVTXEYo4dqxaC8HLALIseEE/EVEG8CHzcuRkNDWjUBEzadd/PFbmdo7VG6Dk3hhCJYurKPeJgAG7FOAOh+EpRycTRW3GkKic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577445; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=R/WTFigHKSRFOhVnCplb0lF0trB4ou/zhkKntcFyRRQ=; b=g3Mtoi6xMht/79/M0tZguIuMBL8scIoKCArDB3QpE9oQCdx4pwd4mtyGGzNolMrLIEN/IDQSiY3yKLyZj/hGdkZNgf68r+X5HHkITXLdWnTVgkB6F4gGVG8wMjD8ikTBBK+xZdrSbjFAGfQ9vsTrRJefHnujB5u5VS88Oswv5ec= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65815+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601577445294278.23486292513337; Thu, 1 Oct 2020 11:37:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Dy3mYY1788612x0Pn6ZB4O5X; Thu, 01 Oct 2020 11:37:24 -0700 X-Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.groups.io with SMTP id smtpd.web12.1032.1601577444218447026 for ; Thu, 01 Oct 2020 11:37:24 -0700 X-Received: by mail-wm1-f47.google.com with SMTP id t17so4203554wmi.4 for ; Thu, 01 Oct 2020 11:37:23 -0700 (PDT) X-Gm-Message-State: Zuym2uQkX1vbucZEncKQMHRIx1787277AA= X-Google-Smtp-Source: ABdhPJyb6O7rm/m5PAjywiAPsnqSd+SMptw0SOyQZm+Uq6KG/QAha/ChEm4ouYKiwKRpM4/Wq5W+bQ== X-Received: by 2002:a1c:5685:: with SMTP id k127mr1394560wmb.135.1601577442293; Thu, 01 Oct 2020 11:37:22 -0700 (PDT) X-Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id a3sm964671wmb.46.2020.10.01.11.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:37:21 -0700 (PDT) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 4/5] MdePkg/BaseLib: correct register sizes in AArch64 SetJump/LongJump Date: Thu, 1 Oct 2020 19:37:11 +0100 Message-Id: <20201001183712.1738-5-leif@nuviainc.com> In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,leif@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601577444; bh=7rjn2Dps9mC0031ZeBlRdyJnUmUKAonPLKGXGnp8ORM=; h=Cc:Date:From:Reply-To:Subject:To; b=sc4bkuXB04IHTCBLGpUodLB2d4ywNcpnt0tF2xyu16Pm2D1mBn7dJ+P8EEfTO/Wog6+ g0M95OSSxWKoko7xx6uQXrAXhdFgKTOjNVMhan3gABjRGi+U3sntB/jvb12nX4tXaZ7Ad uER3tRq4IWW4MpH6KldvGoZIKlhw9Z/11vc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daude --- 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/Libr= ary/BaseLib/AArch64/SetJumpLongJump.S index 34765a676430..b3d37b216542 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.S @@ -55,7 +55,7 @@ ASM_PFX(SetJump): FPR_LAYOUT #undef REG_PAIR #undef REG_ONE - mov w0, #0 + mov x0, #0 ret =20 #/** @@ -84,9 +84,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 // use br not ret, as ret is guaranteed to mispredict br x30 =20 diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Li= brary/BaseLib/AArch64/SetJumpLongJump.asm index f2729a8bb03e..ba4d2389c0cb 100644 --- a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm @@ -54,7 +54,7 @@ SetJump FPR_LAYOUT #undef REG_PAIR #undef REG_ONE - mov w0, #0 + mov x0, #0 ret =20 ;/** @@ -83,10 +83,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 --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65815): https://edk2.groups.io/g/devel/message/65815 Mute This Topic: https://groups.io/mt/77247142/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 9 02:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65817+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65817+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1601577448; cv=none; d=zohomail.com; s=zohoarc; b=kCGDxuElIBHbDympIREqM3l8O6MBgKAuIqdmtlpcatCV+t6eUjSkmW75V4lvH5LzZDQJx73CYwqbCXL7diaZBESsWWwcLfOBM4Gkjd9bs1dE4lLpWhYpLVI7iumH24dDiJOGEQd8yO3LbnPo1uQMYH11WW/BwdjW+/Jbn/Kwy5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601577448; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Px7NqNUBPhLSwlkmm5diHzSnQT/8asx+IwbuifFh6CY=; b=nAlzeppYV79BUaLhqa/1GBcdK/9H4NHN/N2QVde9YO3vy0xmFwxHiiqsUd0dc0XjO+kyDDtF7CP/Qb6BsHXsG1cgmUmfG7UDJ5ek8+pm2oOzGPDTLOgUOTeQ/5bvpbTek70dIBsNZl5T8z/ipH3Gyl8JGkcFUuiKX5iz+C1ZO2w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65817+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601577448844647.7436676994662; Thu, 1 Oct 2020 11:37:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Y8wcYY1788612xrDMzZHLMb7; Thu, 01 Oct 2020 11:37:26 -0700 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web11.1023.1601577445034815565 for ; Thu, 01 Oct 2020 11:37:25 -0700 X-Received: by mail-wm1-f66.google.com with SMTP id w2so3933406wmi.1 for ; Thu, 01 Oct 2020 11:37:24 -0700 (PDT) X-Gm-Message-State: HG1AwicYPdLkqCVN61PTDw7cx1787277AA= X-Google-Smtp-Source: ABdhPJyMxXKs3XL5hOOwcMB+K3MASQIN/KPrZir9d1M2o5SRQuoJanYVT7h3+RZTnNofCwGUfqso3g== X-Received: by 2002:a1c:4909:: with SMTP id w9mr1421066wma.133.1601577443183; Thu, 01 Oct 2020 11:37:23 -0700 (PDT) X-Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id a3sm964671wmb.46.2020.10.01.11.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 11:37:22 -0700 (PDT) From: "Leif Lindholm" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 5/5] MdePkg/BaseLib: ensure ARM LongJump never returns 0 Date: Thu, 1 Oct 2020 19:37:12 +0100 Message-Id: <20201001183712.1738-6-leif@nuviainc.com> In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,leif@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601577446; bh=4ku34u3WJ0An5UwLprQCcrXJeTtqf1zLq04VF0Aa0do=; h=Cc:Date:From:Reply-To:Subject:To; b=rCWzEdD/7fYWZBv4w3+DDUoNPmO42uYIBzlImYyFCv/4Be709FY/IeK7f7EcpPN93B2 OlSzrxMSoZhrX/3DWLg84EE2GNDq6OJsG59C2Jl2p15tWma+hNKfeJuk/Ma1I5TkML1PT FfUPRQKe0SFhGbKY4FnGtY/mg/+EqLrnByk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The ARM implementation of of InternalLongJump always returned the value Value - but it is not supposed to ever return 0. Add the test to prevent that, and return 1 if Value is 0 - as is already present in AArch64. Signed-off-by: Leif Lindholm --- MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S | 2 ++ MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S b/MdePkg/Library/= BaseLib/Arm/SetJumpLongJump.S index 407df5f41ac5..d1a31b69cf26 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.S @@ -60,6 +60,8 @@ ASM_PFX(SetJump): ASM_PFX(InternalLongJump): ldmia r0, {r3-r12,r14} mov r13, r3 + cmp r1, #0 + moveq r1, #1 mov r0, r1 bx lr =20 diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Librar= y/BaseLib/Arm/SetJumpLongJump.asm index 3a45f045460a..603143c27050 100644 --- a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm +++ b/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm @@ -60,6 +60,8 @@ SetJump InternalLongJump LDM R0, {R3-R12,R14} MOV R13, R3 + CMP R1, #0 + MOVEQ R1, #1 MOV R0, R1 BX LR =20 --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65817): https://edk2.groups.io/g/devel/message/65817 Mute This Topic: https://groups.io/mt/77247145/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-