From patchwork Mon Jul 22 21:39:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169457 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012400ilk; Mon, 22 Jul 2019 14:41:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8olIXK3gFIXSE7qDXkF1aUK9E6LuMguYrm3xaLoHQCvQictelyCRAgAcSaBxJXaIL0kcd X-Received: by 2002:a02:13c3:: with SMTP id 186mr73897435jaz.30.1563831685372; Mon, 22 Jul 2019 14:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831685; cv=none; d=google.com; s=arc-20160816; b=jxk5zsK3Vn41vQ6EU1WhJ6Md6x/af5P9GfbWHcy1O5Aj4eJf6Dp154GySghyE5qmul oe72hQcQbtyv58kCY6lTynGdHYXcCxCk1VH67tJIKPasIX2vOFFyx7KLTmFfbFEgZ2Hx Tqpu5Ofg7a+04Cf0kdaZz2ZLo8PfEUrq7eku0YzGmNgRxG8wNNbW+rON7Tr+26C/ju8l f2CD6LB36T+2ZdkFIhF8ljuX6kq/us09CH73+XpCSbEDf7IHyjia1tIBKiPjJ2ZcA6T5 sZF9LYiAnKyuJw8ulpNNktiY0Kpo1MPAz4JctxigHdvtARsS8BEf57i1BvEVSboD53Ay 9ubw== 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=3/nnOe5Y+HseZ2FfHzka+U4SBK/fb0ToVMN4nJBi3LE=; b=JfVbNiwFYpSgF0l1eQl/+F427zbOdMLjO6J9cBMNaO5ntUo/luLF01mvm3wPk6PBBX Iv8qzi1Oo0BdeGnwr609Wr/5GNg22jrOakqC+/hoD4xKDDoh4rw1vTkdeqa5H/qdbmGE YlAtnAwHcZSWXtZYf/1yVFe3bfnF4haer1MIbhXih2r6QBzL3j5Cb445sEUMumpAZ5hw dhoNNTh4YTZ8nfzC4hWB9VOMfXDLYF+vGbAC1j43rvAhxVk0/5Xjw/CQ7W5waQUce+5w epG6vB6C1BAsFJ9dkin6IdRzpr0c+d+QavIUB9gER1IyjlecVTuG3wGQJN1ef7Z1wjcZ Qa7w== 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 l10si37478000ion.114.2019.07.22.14.41.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:25 -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 1hpg2U-0002Qg-NM; Mon, 22 Jul 2019 21:40:10 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2T-0002Ps-7e for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:09 +0000 X-Inumbo-ID: 46acabbc-acc9-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 46acabbc-acc9-11e9-8980-bc764e045a96; Mon, 22 Jul 2019 21:40:08 +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 68F93153B; Mon, 22 Jul 2019 14:40:08 -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 B6F463F71F; Mon, 22 Jul 2019 14:40:07 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:26 +0100 Message-Id: <20190722213958.5761-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190722213958.5761-1-julien.grall@arm.com> References: <20190722213958.5761-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v2 03/35] xen/arm64: head: Don't clobber x30/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 x30/lr. This means the user should save lr if it cares about it. Follow-up patches will introduce more use of PRINT in place where lr should be preserved. Rather than requiring all the users to preserve lr, the macro PRINT is modified to save and restore it. While the comment state x3 will be clobbered, this is not the case. So PRINT will use x3 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 v2: - Add Stefano's reviewed-by --- xen/arch/arm/arm64/head.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index f2d7445f6a..6afe83c347 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -78,12 +78,17 @@ * x30 - lr */ -/* Macro to print a string to the UART, if there is one. - * Clobbers x0-x3. */ #ifdef CONFIG_EARLY_PRINTK -#define PRINT(_s) \ - adr x0, 98f ; \ - bl puts ; \ +/* + * Macro to print a string to the UART, if there is one. + * + * Clobbers x0 - x3 + */ +#define PRINT(_s) \ + mov x3, lr ; \ + adr x0, 98f ; \ + bl puts ; \ + mov lr, x3 ; \ RODATA_STR(98, _s) #else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) @@ -622,9 +627,8 @@ init_uart: #ifdef EARLY_PRINTK_INIT_UART early_uart_init x23, 0 #endif - adr x0, 1f - b puts -RODATA_STR(1, "- UART enabled -\r\n") + PRINT("- UART enabled -\r\n") + ret /* Print early debug messages. * x0: Nul-terminated string to print.