From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=tFvBNlHM; spf=pass (domain: nuviainc.com, ip: 209.85.128.49, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f49.google.com with SMTP id t17so4203483wmi.4 for ; Thu, 01 Oct 2020 11:37:22 -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=MJv6m9UNW/j32FBiH8zPrdSM1QKFPmK/WqBJvJuOxts=; b=tFvBNlHM/X3XzK5daSWZP7m0/hmlROpJerlImcQyPWocy0W2qDlHEmGjIuGd7iHCja qq3duDtIFVresQOF9LcI7Sc2ptHnNT6tojW+pJeB+/Bk4lUUceTxSu0Mqu9t/OTDJWGH lzrb4sXzJlBllJTh0hdD87M83sjwpgN5KSiS2+1/wbhY15ERKGdtp+kWf3+hK6WgAyFy 2pdfH+33PnW7MYRT69aHhd7YKzpaUoKgHn3lVpMxroOOH84R/tjSf2Rk4r7aWlAaStRa dKsAwHAzeHtpjLBPjgnAeOdnKC1vCLpOJWu59M4UlUY/lOUUogLIL1DZhfa86BS/X00a PqUw== 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=MJv6m9UNW/j32FBiH8zPrdSM1QKFPmK/WqBJvJuOxts=; b=lQwTwhFIJXFDMWPWdg5gj6xWDedbJ7i+xolIA9+gsF9T3hOuwrXZwqLaNCB+TGkZtY 8niLw0spzKCTy1gOK0ihslmgA/u9eCyrJbhBI/REYg/dA6+TQOKDWFE0F6zkziRKWGG5 fJhVBYj/xMRQPuem/LRrZbx43hKPrbWwBYJiY+OYO7v6LKQ5tfYJs4re4M/OqQl5OEc1 GtLO2xkP+oaqtWtsC3ZNM5/9BAxpzql/a8ThS6eBtPO11PgrJAGvKjsn5JNarsWifwGe imvaZ/aR+phZPNlLqMmmMmFv5Pdd3ZrIquFv0+oEjxrkOXYgkwyeeykbEvEIG8wq7RKP 4WIQ== X-Gm-Message-State: AOAM53274jRt0LtkvPrXA77vMayJsaObYZSM86zzpGE6owu51XWdRMsV srwI4GyMtMelX5+dNiYHfyKGcCBlRS+d6koWBeEnezdMneEamt1ZbRfEcIFeVNrRTa4d3HI5YgQ KT0yiNyXL1uemntQDGVZQpM16vNQ5Fwhdo4CoSxb6C67Cu/ICmnuw5eci4/aszmwLq2fw 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) 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.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: [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> 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 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/Library/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/Library/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/Library/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 -- 2.20.1