From patchwork Sun Dec 8 12:22:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1205615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47W59N1Mygz9sPf for ; Sun, 8 Dec 2019 23:24:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aognJS/+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47W59L4RmJzDqF6 for ; Sun, 8 Dec 2019 23:24:22 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::644; helo=mail-pl1-x644.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aognJS/+"; dkim-atps=neutral Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47W58B2qC3zDqDb for ; Sun, 8 Dec 2019 23:23:21 +1100 (AEDT) Received: by mail-pl1-x644.google.com with SMTP id q16so4607458plr.10 for ; Sun, 08 Dec 2019 04:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ABHnyc9cGiUchiY4LlVwkTd97Le2d9Q8dXvPTCHUoFc=; b=aognJS/+EAsbrXg6OkkoWwQBbGULfAnlNKq7BItaUeatiEeYHqqpDagXJ/1g8GoXJP VjbP06FJcp72DCKB950OekTkIDFSCQdKp1qBUMegv5ErKYVYca2ygwDeNNAZ1UB9vYbZ Z7RzNt68qgyY4ud+6dDucwQmymQggoSLfxqE4ubjshz33g7hvdy2KRBhMGe/ll5F++gE PlkWx71K9tfadzl5BSljIijo6DuAOqsk5dY6jk1aCr3AnHk8XSHPwcNidUo1OW9CsZ1n VJyhYC6qwF9/NzZppTbtMXym5W3V4GkZKxitQy1GhEe6OiVRkxB0FqXkSvsGT9FffPwx 1Scw== 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=ABHnyc9cGiUchiY4LlVwkTd97Le2d9Q8dXvPTCHUoFc=; b=kc2u2p6jNCdvg7pzThUEbNxkIazljNDFUxLWtN1jSKNihdW30+LMNab3+9rxyzg3Vc B4FJFEfPdNtpobZ3iLp4JW/m5jQkk0SCDXOjy+O3ppt5VITOjtw4kGgiKEpMRVTrbLDV XSO3CKfOd9RFtHNLjfTVoGl3XPQeo1p36oFhY+GSO71yf8PiT0LKse6UKMZ+GN6pY2E1 gUI8zo0qpPr4vX3OAa68erHNm+6KlUfpHdyAu7skfiebkHbFJyIJbxHAauSVSw58AYNU BOXuAu2M6HWEiuE5B1YgwoXotT7dgKX/dNdo6kgSZ1GMW3yI8azLpM8N4fHzrBC63PmP w9pA== X-Gm-Message-State: APjAAAVjmW2r3745zQ312fYhQWjXUwRJrAwsa5tdPGEuEPdV3hwxe216 15/JpRQU7Mv/V357TRB8hWDayQun X-Google-Smtp-Source: APXvYqzzQoRuuYMzyzBCIgaSPnwvCrMMik68AB3lbcJN2z+SyGLVLQPSw1CQdZSsNdO14OwZ9qDVhA== X-Received: by 2002:a17:902:fe8b:: with SMTP id x11mr16074458plm.83.1575807798840; Sun, 08 Dec 2019 04:23:18 -0800 (PST) Received: from bobo.local0.net ([202.21.15.182]) by smtp.gmail.com with ESMTPSA id i9sm23741866pfk.24.2019.12.08.04.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2019 04:23:18 -0800 (PST) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Sun, 8 Dec 2019 22:22:42 +1000 Message-Id: <20191208122312.12837-2-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191208122312.12837-1-npiggin@gmail.com> References: <20191208122312.12837-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v10 01/31] asm/cvc_entry.S: r2 save fix X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The TOC save area for the current stack frame should be used to save r2, not the caller's frame. Acked-by: Stewart Smith Signed-off-by: Nicholas Piggin --- asm/cvc_entry.S | 9 +++++++-- include/stack.h | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/asm/cvc_entry.S b/asm/cvc_entry.S index 1296e88fe..3e8b3fdad 100644 --- a/asm/cvc_entry.S +++ b/asm/cvc_entry.S @@ -24,6 +24,11 @@ #.include "kernel/ppcconsts.S" +# Updated hostboot location is src/securerom/rom_entry.S. +# This also has a fix for TOC save frame pointer. + +#include + .section .text .global __cvc_verify_v1 @@ -33,10 +38,10 @@ __cvc_verify_v1: __cvc_sha512_v1: call_rom_entry: - std %r2, 40(%r1) mflr %r0 std %r0, 16(%r1) stdu %r1, -128(%r1) + std %r2, STACK_TOC_OFFSET(%r1) li %r2, 0 mtctr %r3 mr %r3, %r4 @@ -45,8 +50,8 @@ call_rom_entry: mr %r6, %r7 mr %r7, %r8 bctrl + ld %r2, STACK_TOC_OFFSET(%r1) addi %r1, %r1, 128 - ld %r2, 40(%r1) ld %r0, 16(%r1) mtlr %r0 blr diff --git a/include/stack.h b/include/stack.h index 3ad52d64c..09d22adb6 100644 --- a/include/stack.h +++ b/include/stack.h @@ -11,6 +11,8 @@ #define STACK_ENTRY_RESET 0x0100 /* System reset */ #define STACK_ENTRY_SOFTPATCH 0x1500 /* Soft patch (denorm emulation) */ +#define STACK_TOC_OFFSET 40 + /* Safety/ABI gap at top of stack */ #define STACK_TOP_GAP 0x100