Skip to contentSkip to conversation

initcall: add explicit hint if initcall was relocated

PATCH In review Alexey Brodkin 3 participants 3 messages Dec 27, 2014 – Dec 30, 2014 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initcall: add explicit hint if initcall was relocated

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.

Cc Simon Glass <[email protected]>
Cc Minkyu Kang <[email protected]>
---
 lib/initcall.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/initcall.c +5 -1
index 39f4b3f..7142744 100644
@@ -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",
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 initcall: add explicit hint if initcall was relocated

Quoted 33 lines · Alexey Brodkin

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.

Quoted 6 lines
Cc Simon Glass <[email protected]>
Cc Minkyu Kang <[email protected]>
---
 lib/initcall.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Alexey Brodkin
Quoted 4 lines · Alexey Brodkin

Commit "initcall: Improve debugging support" makes sense and indeed simplifies process of matching initcalls executed with static disassembly.

Quoted 8 lines

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:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141229/c2b36b80/attachment.pgp>