From patchwork Mon Aug 12 17:30:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 171101 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3120187ily; Mon, 12 Aug 2019 10:31:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUGzlKMeFYaU8tF6HiGes4ufBIj8A1VIsYZGt++Ju1lE6gzPK/YfiAM9DOyfjBQ4btyKlo X-Received: by 2002:a02:7f15:: with SMTP id r21mr34641284jac.120.1565631104830; Mon, 12 Aug 2019 10:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565631104; cv=none; d=google.com; s=arc-20160816; b=XP69nukrFaAnPP20BwphHGrG1yUYg9eMsksLM7RQwzp++UBYFgRlpiHK4639QbRy9s 2gbFnqF6vijHc1qfbxrKZFJJijo0bvwpEBMW7Ds4XYOu9C4ST782wvUutPSWJS+bKNaM SKbkTzTDqzcURpDX/aVizeAxEiWQTpP734iXuIouvHExX5mXloaq1CgS/hSxeix2S8zO 1fCt0yoU/2DQkMl+IcAY4WLcqCP6pjEhhyHD8XWbcyaRlZYkRfvFILUpbkCsA+fX265C fvK/RYvxJSVx2w3ZCKtc3JM8YARgZp0rgl8SZX52pYr0RhcVPN5y/6FIXO+ZSbITBg81 upKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=/s5EPjYegcOAe62m+pveZEHcZyiV91rrUeU5gXuqjVY=; b=A3NGQNILvgOCpDJL1lDQ178k+tIHKUOicueCbmkOkRpFvxIi+lRIuUTpTgNOW4tgh0 sJJNMy2bLxYafnIn8FpYh3CRRJxE0myznd5CD17Uor9rwrEsOKpvlVWaM7GeI6Em7Ght D9ms8F8SBesL91cBQQRI3HcDVeW4+f4N35hz79Pm/39f2McRZ6+ZE7/hgssltDraO8KP LLPon6CSV2RF8+J2lp1iEuMRQ31pmWnSUGh/LpCnvi2WBRwSEvyC4Zh/5VU6s2Ktdrqa ZOu162ORwGjZkxbtLXMOyK4UJbyxDQUTdFrFkPDfXvk7oDowz2o9Ll2GQkxACvOAvto/ kRLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y68si11011685iof.27.2019.08.12.10.31.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Aug 2019 10:31:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxE9W-0006iK-Lg; Mon, 12 Aug 2019 17:30:38 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxE9V-0006ha-Ev for xen-devel@lists.xenproject.org; Mon, 12 Aug 2019 17:30:37 +0000 X-Inumbo-ID: e555a358-bd26-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id e555a358-bd26-11e9-8980-bc764e045a96; Mon, 12 Aug 2019 17:30:36 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 60AA51715; Mon, 12 Aug 2019 10:30:36 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF5953F706; Mon, 12 Aug 2019 10:30:35 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 12 Aug 2019 18:30:01 +0100 Message-Id: <20190812173019.11956-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190812173019.11956-1-julien.grall@arm.com> References: <20190812173019.11956-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 10/28] xen/arm32: head: Don't clobber r14/lr in the macro PRINT X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The current implementation of the macro PRINT will clobber r14/lr. This means the user should save r14 if it cares about it. Follow-up patches will introduce more use of PRINT in places where lr should be preserved. Rather than requiring all the user to preserve lr, the macro PRINT is modified to save and restore it. While the comment state r3 will be clobbered, this is not the case. So PRINT will use r3 to preserve lr. Lastly, take the opportunity to move the comment on top of PRINT and use PRINT in init_uart. Both changes will be helpful in a follow-up patch. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v3: - Add Stefano's acked-by Changes in v2: - Patch added --- xen/arch/arm/arm32/head.S | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 8b4c8a4714..b54331c19d 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -64,15 +64,20 @@ * r14 - LR * r15 - PC */ -/* Macro to print a string to the UART, if there is one. - * Clobbers r0-r3. */ #ifdef CONFIG_EARLY_PRINTK -#define PRINT(_s) \ - adr r0, 98f ; \ - bl puts ; \ - b 99f ; \ -98: .asciz _s ; \ - .align 2 ; \ +/* + * Macro to print a string to the UART, if there is one. + * + * Clobbers r0 - r3 + */ +#define PRINT(_s) \ + mov r3, lr ;\ + adr r0, 98f ;\ + bl puts ;\ + mov lr, r3 ;\ + b 99f ;\ +98: .asciz _s ;\ + .align 2 ;\ 99: #else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) @@ -500,10 +505,8 @@ init_uart: #ifdef EARLY_PRINTK_INIT_UART early_uart_init r11, r1, r2 #endif - adr r0, 1f - b puts /* Jump to puts */ -1: .asciz "- UART enabled -\r\n" - .align 4 + PRINT("- UART enabled -\r\n") + mov pc, lr /* * Print early debug messages.