From patchwork Thu Sep 15 12:10:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1678267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dCPzgOnE; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MSx2B4yjbz1ypd for ; Thu, 15 Sep 2022 22:13:54 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4MSx2B2nTMz3dwJ for ; Thu, 15 Sep 2022 22:13:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dCPzgOnE; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1029; helo=mail-pj1-x1029.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dCPzgOnE; dkim-atps=neutral Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 4MSwzQ0gWhz3blY for ; Thu, 15 Sep 2022 22:11:29 +1000 (AEST) Received: by mail-pj1-x1029.google.com with SMTP id s14-20020a17090a6e4e00b0020057c70943so22174195pjm.1 for ; Thu, 15 Sep 2022 05:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Bn0T7dQKNFXGgG78X/o6CPzfYUz1SqFWsqHr1/u9ZNw=; b=dCPzgOnEkOD5R0hEstwZ/ptyU93RI/BtzdkPEi1dfMiUuzXlyoEebb+YexTlrh3uql PVGe5z2Uc+z76BmB1MMq1B0WYm2xvgpN4g/RmN3+w+n854OMUNvqDXpjmsRuWYhhmuZ2 Akqd4gpCPwi8VR7Yd4e9prpUafkIh2Jx6d5nMA54SYcB+nIKeC8Gl3btTlXpiZHEMHuL IKGjzcl2cvWAP4zA68//NeLGU3zdSUWQwt8s2COBIOLV6q4fOQTEYeTfzxlcw1VpVPG6 hRamBrA/r0IUZgQ+J1yVPzTEY9UHND1rbQdwdFuDwRh3NXv3m9EbjYlm84JYVd8T4uDR 0LWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Bn0T7dQKNFXGgG78X/o6CPzfYUz1SqFWsqHr1/u9ZNw=; b=rc8b8qlRinLKnbTIbUQoyMJF2KaJGktTS28P2lKBq3R+IE4QAlCUmfdlYb7Qix4yzd tbHXfbVBfGSVJQleW/UaGU+zyJVeKDHvx1ccBXGPlcoQNs5HAMK9aBMOc14Aj90DFLJT aYIX875rbyB04Ti2UHvYwcwsoMNIbO5v/ZL1DqaW9dRnQvzXwJYo324AIumiKHTVKPqn 1kVv4RYREvFGHJIWlSWB8S5R6XPxHkFieZWQD/TAIGDODt5vey4fIfgOnBMFrYnq8R3Y aoqjcpkQ4v2kuuOLjADhwfsK5b8EtwU1hOMmB/KEGDTecFnY3ePwO+Hp/9xtdQvWmnhB eouQ== X-Gm-Message-State: ACrzQf0iuKjTr/kFNDfIDfeTESsj+jy0wKJg3L2nxJ0TYepL0lLpEN8/ JNH3E45PZ76EksZbseXLZK6koG/rkao= X-Google-Smtp-Source: AMsMyM79ZWO467nLLkMT1RzjilED250EBoPp5Jq93D+mfjPB7Gcg6b0WuFH10eRiWT6f1FORNeSwvw== X-Received: by 2002:a17:902:db06:b0:178:24e7:639 with SMTP id m6-20020a170902db0600b0017824e70639mr4149649plx.46.1663243886982; Thu, 15 Sep 2022 05:11:26 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([118.210.107.131]) by smtp.gmail.com with ESMTPSA id b6-20020a170902650600b00172a567d910sm12569420plk.289.2022.09.15.05.11.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 05:11:26 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/6] powerpc/64: avoid using r13 in relocate Date: Thu, 15 Sep 2022 22:10:56 +1000 Message-Id: <20220915121058.2288916-5-npiggin@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220915121058.2288916-1-npiggin@gmail.com> References: <20220915121058.2288916-1-npiggin@gmail.com> MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" relocate() uses r13 in early boot before it is used for the paca. Use a different register for this so r13 is kept unchanged until it is set to the paca pointer. Avoid r14 as well while we're here, there's no reason not to use the volatile registers which is a bit less surprising, and r14 could be used as another fixed reg one day. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/reloc_64.S | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S index 232e4549defe..efd52f2e7033 100644 --- a/arch/powerpc/kernel/reloc_64.S +++ b/arch/powerpc/kernel/reloc_64.S @@ -27,8 +27,8 @@ _GLOBAL(relocate) add r9,r9,r12 /* r9 has runtime addr of .rela.dyn section */ ld r10,(p_st - 0b)(r12) add r10,r10,r12 /* r10 has runtime addr of _stext */ - ld r13,(p_sym - 0b)(r12) - add r13,r13,r12 /* r13 has runtime addr of .dynsym */ + ld r4,(p_sym - 0b)(r12) + add r4,r4,r12 /* r4 has runtime addr of .dynsym */ /* * Scan the dynamic section for the RELA, RELASZ and RELAENT entries. @@ -84,16 +84,16 @@ _GLOBAL(relocate) ld r0,16(r9) /* reloc->r_addend */ b .Lstore .Luaddr64: - srdi r14,r0,32 /* ELF64_R_SYM(reloc->r_info) */ + srdi r5,r0,32 /* ELF64_R_SYM(reloc->r_info) */ clrldi r0,r0,32 cmpdi r0,R_PPC64_UADDR64 bne .Lnext ld r6,0(r9) ld r0,16(r9) - mulli r14,r14,24 /* 24 == sizeof(elf64_sym) */ - add r14,r14,r13 /* elf64_sym[ELF64_R_SYM] */ - ld r14,8(r14) - add r0,r0,r14 + mulli r5,r5,24 /* 24 == sizeof(elf64_sym) */ + add r5,r5,r4 /* elf64_sym[ELF64_R_SYM] */ + ld r5,8(r5) + add r0,r0,r5 .Lstore: add r0,r0,r3 stdx r0,r7,r6