From patchwork Sun Sep 27 12:36:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1372044 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=SVAArHrI; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BzlX468phz9sPB for ; Sun, 27 Sep 2020 22:36:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B5D41823A2; Sun, 27 Sep 2020 14:36:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="SVAArHrI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 29D6F82393; Sun, 27 Sep 2020 14:36:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AEBCB82369 for ; Sun, 27 Sep 2020 14:36:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1601210180; bh=9ayRznRXOQMq/oNL66J+YafbUsD2unRcD4DnkBhgrhA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SVAArHrIzdoDg1dbltLc9BDNowfqaBOj2Ull/gEzG4S/oI1nCWQkMMkIRduy1Jsdr lXCl7MO3nUAfQ3HIPUz2o3b7YmstCICNhMlf8iw3hOaT+o/tBEOj4iwMJ09TM6XPNM 4OlPGuPjFYb7/7dx/ubyx6Kvzi+MvR0GY5E+umYk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M4s4r-1kOQmx1E7b-0022JL; Sun, 27 Sep 2020 14:36:20 +0200 From: Heinrich Schuchardt To: Tom Rini Cc: Simon Glass , Ilias Apalodimas , Peng Fan , Bin Meng , Masahiro Yamada , Baruch Siach , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 3/3] doc: global data pointer Date: Sun, 27 Sep 2020 14:36:09 +0200 Message-Id: <20200927123609.37517-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200927123609.37517-1-xypron.glpk@gmx.de> References: <20200927123609.37517-1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SEqx2G6yAmerHmNWmWy10mkPtA8k2nG8caPq15aUX/s+8S4wLVZOmD1+ VzXQ7PePhp/4svaJXctlkAJ5YGgnTHLnIFL+sB6MwIdjvosXECjg3KjhHeuILSoarnBXMjHOJ rd+pNotvP73NZur2eMedK1GEDm3Ow7jcooGXp5dXCsJ9T9Rk1F7OFPs7M4uJ0ocLxkmvtZzhz sujRdesTO596INKem+T3t50/w+DoCL7kWfKvirKccsjVcN5wT4/1dxQgVnJNO9b2m5VWpjwQY 7Lo0jy1Q93aq+g07Nd/zMEVa/Jlff/ucTO8MykEpDInm5oCesd+dwr037LQcWBdaum9RBpCbE tWkPjIMzQ1XF/gkjAb0tc/myj+NeNa6d4PCMezCZAON00mMOhY/4wGlYHvpnm3p8gE3PGCwUP GAfx0/X/oGxJY0tjggoKCx5obVkQSelLIc5o3QDC0A48sSnEYxCqT27TqCJlKmb+5Ax++1Bof MaEPtnnQoiLC6pWSpvGVvIC/e9eHKSXPzRkvLnQ== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the description of the global data pointer to the generated HTML documentation. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- v3: x86 uses register fs for global data pointer v2: no change --- doc/develop/global_data.rst | 53 +++++++++++++++++++++++++++++++++++++ doc/develop/index.rst | 1 + 2 files changed, 54 insertions(+) create mode 100644 doc/develop/global_data.rst -- 2.28.0 diff --git a/doc/develop/global_data.rst b/doc/develop/global_data.rst new file mode 100644 index 0000000000..9e7c8a24da --- /dev/null +++ b/doc/develop/global_data.rst @@ -0,0 +1,53 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Global data +=========== + +Globally required fields are held in the global data structure. A pointer to the +structure is available as symbol gd. The symbol is made available by the macro +%DECLARE_GLOBAL_DATA_PTR. + +Register pointing to global data +-------------------------------- + +On most architectures the global data pointer is stored in a register. + ++------------+----------+ +| ARC | r25 | ++------------+----------+ +| ARM 32bit | r9 | ++------------+----------+ +| ARM 64bit | x18 | ++------------+----------+ +| M68000 | d7 | ++------------+----------+ +| MicroBlaze | r31 | ++------------+----------+ +| NDS32 | r10 | ++------------+----------+ +| Nios II | gp | ++------------+----------+ +| PowerPC | r2 | ++------------+----------+ +| RISC-V | gp (x3) | ++------------+----------+ +| SuperH | r13 | ++------------+----------+ + +The sandbox, x86, and Xtensa are notable exceptions. + +Clang for ARM does not support assigning a global register. When using Clang +gd is defined as an inline function using assembly code. This adds a few bytes +to the code size. + +Binaries called by U-Boot are not aware of the register usage and will not +conserve gd. UEFI binaries call the API provided by U-Boot and may return to +U-Boot. The value of gd has to be saved every time U-Boot is left and restored +whenever U-Boot is reentered. This is also relevant for the implementation of +function tracing. For setting the value of gd function set_gd() can be used. + +Global data structure +--------------------- + +.. kernel-doc:: include/asm-generic/global_data.h + :internal: diff --git a/doc/develop/index.rst b/doc/develop/index.rst index 98a95ad434..89e80eab94 100644 --- a/doc/develop/index.rst +++ b/doc/develop/index.rst @@ -9,4 +9,5 @@ Develop U-Boot coccinelle crash_dumps + global_data logging