From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=2QEPmKq6; spf=pass (domain: nuviainc.com, ip: 209.85.128.47, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f47.google.com with SMTP id t17so4203554wmi.4 for ; Thu, 01 Oct 2020 11:37:23 -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=bqHAaVSG6qaGatJLO/8ZX6m1P4FmD3ODmQw2AlvCJZ8=; b=2QEPmKq6RKjfiT18EOJ80RUxN14ayEdQK4kEKxJDlTCVqfET9E2pk4qpWq17fYwpuM RlIcD+dwh6wSK/3PpUoj9bTNSFSO0z4DpCye9svm+Ffegh5sBXbUcoQJOc9H96/B8HUm H5CQUjw6OsOw33lursvAWSkXyzO8r6lKMMkZl0Y3EEiM81R0MFDziqZTIu/4QnC4LkN4 PEwP2Cm9ARXoPyWjYucbKcl5wqbu0gsN07BuPQIRUKEgxYd6BEq1nTKEcDWRr5fW+jqT pnYMkB73Xsh0NznELDdLx9oQ75QkOfWsgD9QU7nQXmLq1ecDwRR2K6nqayWeoFxyfRaE 3rHg== 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=bqHAaVSG6qaGatJLO/8ZX6m1P4FmD3ODmQw2AlvCJZ8=; b=F3nzvnngsheq5zEpYVh5zjJSyj/XUSJgngCM6YRB3OjiyvH2sF9toxTkHy0kqlzzqS tANCXJORJNErLYVF5vYD7PlUbbJRa2m1+HWMMvzVl+clGYSH6NzUq0Jgnyozn7lffin9 oX4XL2Rn4QcK4xoYrbV3orKrW/UtW2d2Y7U+jw4vP+4rMePn8TAdg0r60mtl2exdwj1/ XaodOpQy/ZrrjX9/f8/sII/8TlAUpjK4ZXiaCXfShhAfcmOC2Q3m19lCJzoHtZ831LN2 RvVeLnh5cp/Ww5B08AXEuXyNyc6zpnOGDVDjyhY6hmT69rMVpJJHDkjUbQOfo6e4yYN/ 4tCg== X-Gm-Message-State: AOAM530c4NV9NVC6NHlKkZJfX3bnqUWEwEB2VQDPiDrEZFamcLz5YHZH kdrIJF/8GvGEHyqmdD84rDMLU/iAtb+a0p/VHEUJK1LbBFd/hF8hD3D40aNEeP/arbwTwgZdDQA nROh4YrP6geqzHc80hAzSDoTvWkK9kBSY+t99fBJ5i2S7tvl3DlCe30FlvsYk8fDFGEN0 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) 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.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: [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> 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 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 --- 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 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 #/** @@ -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 diff --git a/MdePkg/Library/BaseLib/AArch64/SetJumpLongJump.asm b/MdePkg/Library/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 ;/** @@ -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 -- 2.20.1