From patchwork Mon Jul 22 21:39:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169456 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012249ilk; Mon, 22 Jul 2019 14:41:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOC5JhR45CkSZ2ECG4QL+TuBmIm9auzsZzA859EF2Gc2iMZ4zg65PE8VBRZ0EdlrhRRWdv X-Received: by 2002:a05:6602:2183:: with SMTP id b3mr55321626iob.249.1563831675197; Mon, 22 Jul 2019 14:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831675; cv=none; d=google.com; s=arc-20160816; b=vJ/lRM2nnyAag3ijBHsWVxcmLGbnQZxNzD52wllBH3V6kXX5FkCmgrgeJvQcyA86aO Cv15+4VmQK9K3FRZQqW8NOCY9y4mpF15bp7Dja3BJtglrPWjerKYzCp3G2EOc2R9mTGD peNTaHz9P5rnHPndBY5/fC75VUVZsFWoCSt2Xl14FBCs7G+5Y6E4BYIxs/S9RghbR9oq v4QGqIN90YeMGHcuMRB4lvCuM4OLRiweaiDGnb1xmOPmSP+q0nr/LTPu7Sp3Mwcz5bxi b2A8dQGaNIfAwEbT5R6RF3xY6njla1H4gZPWLZM8NBmGHENG0VBJBhO0NbuR6Iqe/4kz PhFQ== 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=UUevUdp6663+V64p5ViS4lTYYpQ/2TG2qVa8paPbxOo=; b=OPVmKQ2oli0GgMe9sHBnDbfs9F7eQbUuvsT+4TtBoIGtV0ycxDM+GZb8b5RCWTrFYe fc7Rec+fzwwxw85ehosFXlFxeuIrBAl4J3hLHjGOn+5BqXlZYqNdl29DuXP910EqX63V yoVcRSMSxuwIp79tTPbm4DVVZiwhaDNQj7iYiG9hbg3wd09CWArN6JMchqAaZqR7j/nY mRxoi5jdg6rHEGUHy0MBvgeLZLogUhrYrmQ6g7pnqAEp54aRy7l2LWLEtx6zwIqHP4WS OERK3gk9CKt1LT34tC/fZ5YEAanWtnW1DIIkNc2bxcJVwD5FTxZk5vXNDHZ0E5Uu7AV1 VcRQ== 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 c23si52708150iob.102.2019.07.22.14.41.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:15 -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 1hpg2o-0002x2-6q; Mon, 22 Jul 2019 21:40:30 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2k-0002pV-Pe for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:26 +0000 X-Inumbo-ID: 50767792-acc9-11e9-8a0f-579bf927f4ca Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 50767792-acc9-11e9-8a0f-579bf927f4ca; Mon, 22 Jul 2019 21:40:25 +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 BEDBC153B; Mon, 22 Jul 2019 14:40:24 -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 18C523F71F; Mon, 22 Jul 2019 14:40:23 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:44 +0100 Message-Id: <20190722213958.5761-22-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 21/35] 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 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.