From nobody Tue Feb 10 10:55:16 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1560195195; cv=none; d=zoho.com; s=zohoarc; b=h4yYbxEbDdVKRf4KvzCyBQ5zeHEv/dsdxoj/nWYhgtc6npVBWj4bPKhYOuxdpmFBdmO2p1qte3jp2iLziBAMyxlqZJOyXMekwrTpnaCnTcQVti08Cptnt63S/2hOdKzhH9VTKK0+QP0OcakyAsEFqC9PfFve1SXpGrmZbSYHvJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560195195; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dVg36GpuHS3j6xpC6nndZXPHBXCyiCJjMVzEC316tog=; b=RpVRmByZdJ9kQDggvWSkKaUuI5gHSetPop31+ou5LLcK5/fgnuFdONMC4CqsmBnURSDS4qnH4DAtW1syuCFgDfT4dI722sidf2y3pmQ0y8TnaoaCDw1Wr9ten7K++yFtBm8rQ7hFDWukK1aDm+MQsns0xiaHo9ux4xlOolxXeEI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1560195195175481.7964539041325; Mon, 10 Jun 2019 12:33:15 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haQ24-0007rM-Pu; Mon, 10 Jun 2019 19:32:40 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haQ22-0007nw-Sw for xen-devel@lists.xenproject.org; Mon, 10 Jun 2019 19:32:38 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 815a49c3-8bb6-11e9-8980-bc764e045a96; Mon, 10 Jun 2019 19:32:38 +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 EF725344; Mon, 10 Jun 2019 12:32:37 -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 131E73F73C; Mon, 10 Jun 2019 12:32:36 -0700 (PDT) X-Inumbo-ID: 815a49c3-8bb6-11e9-8980-bc764e045a96 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 10 Jun 2019 20:32:14 +0100 Message-Id: <20190610193215.23704-17-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190610193215.23704-1-julien.grall@arm.com> References: <20190610193215.23704-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 16/17] xen/arm64: head: Rework and document launch() 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: andre.przywara@arm.com, Julien Grall , Stefano Stabellini , andrii_anisov@epam.com, Oleksandr_Tyshchenko@epam.com MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Boot CPU and secondary CPUs will use different entry point to C code. At the moment, the decision on which entry to use is taken within launch(). In order to avoid a branch for the decision and make the code clearer, launch() is reworked to take in parameters the entry point and its arguments. Lastly, document the behavior and the main registers usage within the function. Signed-off-by: Julien Grall --- xen/arch/arm/arm64/head.S | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4f7fa6769f..130ab66d8e 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -312,6 +312,11 @@ primary_switched: /* Use a virtual address to access the UART. */ ldr x23, =3DEARLY_UART_VIRTUAL_ADDRESS #endif + PRINT("- Ready -\r\n") + /* Setup the arguments for start_xen and jump to C world */ + mov x0, x20 /* x0 :=3D phys_offset */ + mov x1, x21 /* x1 :=3D paddr(FDT) */ + ldr x2, =3Dstart_xen b launch ENDPROC(real_start) =20 @@ -374,6 +379,9 @@ secondary_switched: /* Use a virtual address to access the UART. */ ldr x23, =3DEARLY_UART_VIRTUAL_ADDRESS #endif + PRINT("- Ready -\r\n") + /* Jump to C world */ + ldr x2, =3Dstart_secondary b launch ENDPROC(init_secondary) =20 @@ -734,23 +742,24 @@ setup_fixmap: ret ENDPROC(setup_fixmap) =20 +/* + * Setup the initial stack and jump to the C world + * + * Inputs: + * x0 : Argument 0 of the C function to call + * x1 : Argument 1 of the C function to call + * x2 : C entry point + */ launch: - PRINT("- Ready -\r\n") - - ldr x0, =3Dinit_data - add x0, x0, #INITINFO_stack /* Find the boot-time stack */ - ldr x0, [x0] - add x0, x0, #STACK_SIZE /* (which grows down from the top). */ - sub x0, x0, #CPUINFO_sizeof /* Make room for CPU save record */ - mov sp, x0 - - cbnz x22, 1f - - mov x0, x20 /* Marshal args: - phys_offset */ - mov x1, x21 /* - FDT */ - b start_xen /* and disappear into the land of C */ -1: - b start_secondary /* (to the appropriate entry point) */ + ldr x4, =3Dinit_data + add x4, x4, #INITINFO_stack /* Find the boot-time stack */ + ldr x4, [x4] + add x4, x4, #STACK_SIZE /* (which grows down from the top). */ + sub x4, x4, #CPUINFO_sizeof /* Make room for CPU save record */ + mov sp, x4 + + /* Jump to C world */ + br x2 ENDPROC(launch) =20 /* Fail-stop */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel