Skip to contentSkip to conversation

scripts/kallsyms: extending region checking for Blackfin memory regions

PATCH Mike Frysinger 3 participants 6 messages Jun 8, 2009 – Jun 15, 2009

lore
Share & tools
lore
#0 lore raw

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard. that means we cannot create a linear map of start/end text sections. we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions. we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions. the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

doesnt matter to me which method is picked :)

(yes, another change is needed to kernel/kallsysms.c, but one thing at a time) -mike

From efafce5dd0ceba132c80fb937412684aab5e8f16 Mon Sep 17 00:00:00 2001
From: Robin Getz <[email protected]>
Date: Mon, 10 Jul 2006 06:25:40 +0000
Subject: [PATCH] kallsyms: support kernel symbols in Blackfin on-chip memory

The Blackfin arch has a discontiguous .text layout due to having on-chip instruction memory and no virtual memory support. As such, we need to add explicit checks for these additional .text regions.

---
 scripts/kallsyms.c |   13 ++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
scripts/kallsyms.c +12 -1
index 6654cbe..fb82a5b 100644
@@ -35,6 +35,7 @@ struct sym_entry {
 static struct sym_entry *table;
 static unsigned int table_size, table_cnt;
 static unsigned long long _text, _stext, _etext, _sinittext, _einittext;
+static unsigned long long _stext_l1, _etext_l1, _stext_l2, _etext_l2;
 static int all_symbols = 0;
 static char symbol_prefix_char = '\0';
 
@@ -92,6 +93,14 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 		_sinittext = s->addr;
 	else if (strcmp(sym, "_einittext") == 0)
 		_einittext = s->addr;
+	else if (strcmp(sym, "_stext_l1") == 0)
+		_stext_l1 = s->addr;
+	else if (strcmp(sym, "_etext_l1") == 0)
+		_etext_l1 = s->addr;
+	else if (strcmp(sym, "_stext_l2") == 0)
+		_stext_l2 = s->addr;
+	else if (strcmp(sym, "_etext_l2") == 0)
+		_etext_l2 = s->addr;
 	else if (toupper(stype) == 'A')
 	{
 		/* Keep these useful absolute symbols */
@@ -157,7 +166,9 @@ static int symbol_valid(struct sym_entry *s)
 	 * and inittext sections are discarded */
 	if (!all_symbols) {
 		if ((s->addr < _stext || s->addr > _etext)
-		    && (s->addr < _sinittext || s->addr > _einittext))
+		    && (s->addr < _sinittext || s->addr > _einittext)
+		    && (s->addr < _stext_l1 || s->addr > _etext_l1)
+		    && (s->addr < _stext_l2 || s->addr > _etext_l2))
 			return 0;
 		/* Corner case.  Discard any symbols with the same value as
 		 * _etext _einittext; they can move between pass 1 and 2 when
Signature · 1 line
1.6.3.1

From 21a5308cb2144f7268ceaa150897b8a7995a26c3 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Mon, 8 Jun 2009 19:12:13 -0400
Subject: [PATCH] kallsyms: generalize text region handling

---
 scripts/kallsyms.c |   87 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 61 insertions(+), 26 deletions(-)
scripts/kallsyms.c +61 -26

131 lines not on this page · raw message

Signature · 1 line
1.6.3.1
#1 lore raw
Quoted 24 lines · Mike Frysinger

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard. that means we cannot create a linear map of start/end text sections. we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions. we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions. the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

Quoted 1 line

doesnt matter to me which method is picked :)

I added both as I liked the generalization.
I had to rearrange the "Signed-off-by" in the first patch as this patch came in vai you and not Robin.

Sam

#2 lore raw

On Sun 14 Jun 2009 16:44, Sam Ravnborg pondered:

Quoted 25 lines · Mike Frysinger
Quoted 24 lines

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard. that means we cannot create a linear map of start/end text sections. we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions. we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions. the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

Quoted 5 lines
Quoted 1 line

doesnt matter to me which method is picked :)

I added both as I liked the generalization.
I had to rearrange the "Signed-off-by" in the first patch as this patch came in vai you and not Robin.

I think Mike pulled this from some work I did awhile ago, (and sent to you) that obviously never got added (since I didn't send it in the proper patch format).

http://lkml.indiana.edu/hypermail/linux/kernel/0607.1/0558.html

#3 lore raw
Quoted 32 lines · Robin Getz

On Sun 14 Jun 2009 16:44, Sam Ravnborg pondered:

Quoted 25 lines · Mike Frysinger
Quoted 24 lines

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard.  that means we cannot create a linear map of start/end text sections.  we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions.  we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions.  the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

Quoted 5 lines
Quoted 1 line

doesnt matter to me which method is picked :)

I added both as I liked the generalization.
I had to rearrange the "Signed-off-by" in the first patch as this patch came in vai you and not Robin.

Quoted 5 lines

I think Mike pulled this from some work I did awhile ago, (and sent to you) that obviously never got added (since I didn't send it in the proper patch format).

http://lkml.indiana.edu/hypermail/linux/kernel/0607.1/0558.html

yeah, the first patch was by Robin ... the "From:" line in the patch should have shown that (and git-am would have respected) ... -mike

#4 lore raw
Quoted 33 lines · Mike Frysinger
Quoted 32 lines · Robin Getz

On Sun 14 Jun 2009 16:44, Sam Ravnborg pondered:

Quoted 30 lines · Mike Frysinger
Quoted 24 lines

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard.  that means we cannot create a linear map of start/end text sections.  we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions.  we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions.  the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

Quoted 1 line

doesnt matter to me which method is picked :)

I added both as I liked the generalization.
I had to rearrange the "Signed-off-by" in the first patch as this patch came in vai you and not Robin.

Quoted 8 lines
Quoted 5 lines

I think Mike pulled this from some work I did awhile ago, (and sent to you) that obviously never got added (since I didn't send it in the proper patch format).

http://lkml.indiana.edu/hypermail/linux/kernel/0607.1/0558.html

yeah, the first patch was by Robin ... the "From:" line in the patch should have shown that (and git-am would have respected) ...

So does the patch.
What I had to change was that the Signed-off-by: lines indicated that this patch came in like this:

Robin -> Mike -> Bryan Wu -> Sam
So I rearranged the signed-off-by: lines so it indicated the following order:

Robin -> Bryan Wu -> Mike -> Sam

I trust that Bryan really did add his sob, and it
was only a mistake that Mike added his sob before
that of Bryans.

Sam

#5 lore raw
Quoted 51 lines · Sam Ravnborg
Quoted 33 lines · Mike Frysinger
Quoted 32 lines · Robin Getz

On Sun 14 Jun 2009 16:44, Sam Ravnborg pondered:

Quoted 30 lines · Mike Frysinger
Quoted 24 lines

intro: the current Blackfin memory architecture is (1) no virtualized memory and (2) distinctly harvard.  that means we cannot create a linear map of start/end text sections.  we end up with distinct regions like so:
00001000 T __stext
000dc4c0 T __etext
feb00000 A __etext_l2
feb00010 A __stext_l2
ffa00000 T __stext_l1
ffa0160c T __etext_l1
this is because external memory starts at address 0 while on-chip regions have different discontiguous hardcoded addresses (L1 instruction in this case starts at 0xffa00000 while L2 starts at 0xfeb00000).

the current kallsyms is written to search for the special stext/etext symbols only which means the resulting kallsyms output knows nothing of the Blackfin symbols living in these on-chip regions.  we've written two patches to fix this: the first one is straight forward and simply copies & pastes the existing hardcoded regions.  the second creates an array of text regions which makes it much easier to extend in the future for other people (and can be squashed into the first one).

Quoted 1 line

doesnt matter to me which method is picked :)

I added both as I liked the generalization.
I had to rearrange the "Signed-off-by" in the first patch as this patch came in vai you and not Robin.

Quoted 8 lines
Quoted 5 lines

I think Mike pulled this from some work I did awhile ago, (and sent to you) that obviously never got added (since I didn't send it in the proper patch format).

http://lkml.indiana.edu/hypermail/linux/kernel/0607.1/0558.html

yeah, the first patch was by Robin ... the "From:" line in the patch should have shown that (and git-am would have respected) ...

So does the patch.
What I had to change was that the Signed-off-by: lines indicated that this patch came in like this:

Robin -> Mike -> Bryan Wu -> Sam
So I rearranged the signed-off-by: lines so it indicated the following order:

Quoted 6 lines

Robin -> Bryan Wu -> Mike -> Sam

I trust that Bryan really did add his sob, and it
was only a mistake that Mike added his sob before
that of Bryans.

yes, i took a bunch of patches from Bryan like this one -mike