From patchwork Sat Dec 27 22:35:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 424265 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 038381400D2 for ; Sun, 28 Dec 2014 09:36:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A1AE64B616; Sat, 27 Dec 2014 23:36:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yp-eoOf0EcFf; Sat, 27 Dec 2014 23:36:17 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8F1BC4B610; Sat, 27 Dec 2014 23:36:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C71AB4B610 for ; Sat, 27 Dec 2014 23:36:11 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id favt1Lk4oDpq for ; Sat, 27 Dec 2014 23:36:11 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by theia.denx.de (Postfix) with ESMTPS id 7FEF14B60B for ; Sat, 27 Dec 2014 23:36:08 +0100 (CET) Received: from dc8secmta1.synopsys.com (dc8secmta1.synopsys.com [10.13.218.200]) by smtprelay.synopsys.com (Postfix) with ESMTP id A321710C0B64; Sat, 27 Dec 2014 14:36:05 -0800 (PST) Received: from dc8secmta1.internal.synopsys.com (dc8secmta1.internal.synopsys.com [127.0.0.1]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 8690327113; Sat, 27 Dec 2014 14:36:05 -0800 (PST) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by dc8secmta1.internal.synopsys.com (Service) with ESMTP id 51F8A27102; Sat, 27 Dec 2014 14:36:05 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 440592D5; Sat, 27 Dec 2014 14:36:05 -0800 (PST) Received: from abrodkin-8560l.internal.synopsys.com (unknown [10.225.15.208]) by mailhost.synopsys.com (Postfix) with ESMTP id 97A952D1; Sat, 27 Dec 2014 14:36:02 -0800 (PST) From: Alexey Brodkin To: u-boot@lists.denx.de Date: Sun, 28 Dec 2014 01:35:57 +0300 Message-Id: <1419719757-6093-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.1.0 Cc: Alexey Brodkin Subject: [U-Boot] [PATCH] initcall: add explicit hint if initcall was relocated X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Commit "initcall: Improve debugging support" makes sense and indeed simplifies process of matching initcalls executed with static disassembly. Until you are debugging relocation functionality. Existign output may make you think that at some point execution somehow returned back to non-relocated area. And there're many reasons/problems that may provoke this behavior. In order to make things clear let's add explicit mention in case initall was actually relocated like this: --->--- initcall: 810015f8 Relocation Offset is: 0efcf000 Relocating to 8ffcf000, new gd at 8fdced3c, sp at 8fdced20 initcall: 810015b8 initcall: 8ffd093c initcall: 8ffd0a14 initcall: 81001940 (relocated to 8ffd0940) initcall: 81001958 (relocated to 8ffd0958) --->--- Note "unexpected" jump from 0x8f... area to 0x81... area. Without explanation this raises many questions: execution jumped in relocated area right as expected and then for some reason returned back? But I hope comment in brackets will save some time for those curious developers who are careful enough to catch "unexpected jump to pre-reloc area" or those unlucky ones who'll have to deal with relocation debugging. Signed-off-by: Alexey Brodkin Cc: Simon Glass Cc: Minkyu Kang Acked-by: Simon Glass --- lib/initcall.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/initcall.c b/lib/initcall.c index 39f4b3f..7142744 100644 --- a/lib/initcall.c +++ b/lib/initcall.c @@ -19,7 +19,11 @@ int initcall_run_list(const init_fnc_t init_sequence[]) if (gd->flags & GD_FLG_RELOC) reloc_ofs = gd->reloc_off; - debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs); + debug("initcall: %p", (char *)*init_fnc_ptr - reloc_ofs); + if (gd->flags & GD_FLG_RELOC) + debug(" (relocated to %p)\n", (char *)*init_fnc_ptr); + else + debug("\n"); ret = (*init_fnc_ptr)(); if (ret) { printf("initcall sequence %p failed at call %p (err=%d)\n",