From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=ns1uqNgZ; spf=pass (domain: nuviainc.com, ip: 209.85.128.66, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f66.google.com with SMTP id w2so3933406wmi.1 for ; Thu, 01 Oct 2020 11:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QbYYkBOGxE/FR2rM5Em+u56NqV6tD/oXZSRUIOdliBY=; b=ns1uqNgZrKy32f+wrYUSRYBdVLko2n9T6S6cBhsFztVMpBXffbbjv98B51w81srBGP VJ0KIWQ+/moHXShAycJbItBqgIAfMOkA1ODxnTq88us8ut5+A57xc63CK9mMReHkIzqP 3yWHr4j1NXu0B39EcJspTG4C4MJwG8XNDzeyXn7M3LN7ajtTHuKl4rQ4rf5egoQC/3nl dIUjTk04/5aRjAhkAhT2SeZwDwSvo6hmipaoYDGW1NLHIRnkhh0WSPmJ34/GmEjFeDYq O0sW3VGo5vM+ZLX2Bjshn/1jyxa/nk62zy4KaSV1wHBRZNFi6hlCLKpLMX1fYPMEgAPM 9amw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QbYYkBOGxE/FR2rM5Em+u56NqV6tD/oXZSRUIOdliBY=; b=E23ymi5vwS+OvK/jTGu0bONUb8ueQFFPLkIV00tWvmbVHwoJyMwq2b6u6KIj1jrVzx 0P/iX/705+sIANuaL6RvbxhJkIv3BJXXCMMAzdJpv+BauICCKGKD+u9d4GpyykMyPKva 8BER3ei21MIJqcFyBXC0BPOhVNlSIGFWE4X7LeK9ETebsfRmgUzAmlc+klsR+XEhBztn JSrASbB186wM4w1sZ1153TPIqZqZ5WqQgoBIVsogTjNkjDnAUqLX0UeO1EGwOwV5hMxx tQm9qCClV5s7T11w3kJfLIhtPqQl8YdnVmyXx+M2+RKwb2wQAMKOFl7klNrnDz1x2ZFZ jIIA== X-Gm-Message-State: AOAM53226QTBRQF1iih/iVS/y+84umj5yN5jdNa4hqYwyPXDIWcqBUj3 z64b/fJj9+wzAV5RD9fKfjVQ6QbjoCgHdnc+AkMyXngx8RP6J7ZEyC+O0Osq720zaMJS5e3piuT mz2d2WS5PWmGH/zu3m8dW/o1Hu2KKSYRID6BJSNdYLJcgwTlvxN+0hZmEykU1cLuxD9NV 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) Return-Path: 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: [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> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201001183712.1738-1-leif@nuviainc.com> References: <20201001183712.1738-1-leif@nuviainc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 diff --git a/MdePkg/Library/BaseLib/Arm/SetJumpLongJump.asm b/MdePkg/Library/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 -- 2.20.1