Skip to contentSkip to conversation

lookup tables: how can i manage them?

U-Boot Luigi 'Comio' Mantellini 1 participant 1 message Oct 19, 2008

lore
Share & tools
lore
#0 lore raw

Hi ML,

in my code (for now a stupid SMI interface) I'm using a jump table like this:

struct reg:{
	callback_1 c1,
	callback_2 c2,

...
};

struct reg mytable[100]={ ......... }

c1 and c2 are pointer to functions.

My problem is that U-boot relocates itself into ram and these pointers are calculated at linking time.

Which is the best practice (into u.boot) to manage these loolup tables/jmps tables? is there a suggest way or a common place to put the needed relocation code (adding the gd->reloc_off to the pointers)?

I'm working on mips, but I thinks that this is a general question.

thanks in advance.

best regards,

luigi

PS.: I made a stupid driver to manage smi interface, that is a "theme variation" on mii bus, to manage a tantos switch. I can send the code if there is interest.

Signature · 8 lines
Luigi Mantellini
R&D - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantellini at idf-hit.com