[coreboot] v3 challenge: global variables

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Feb 4 14:52:05 CET 2008


I have a really tough challenge for you: I need a global variable in v3.
Global means that it has to be accessible from all of stage1/stage2 code
(maybe except initram).

So far I only see one unacceptably hackish solution: Pass a pointer to
the global variable to every function in the codebase. It works, but I'd
rather not post a patch doing this because it violates my aesthetic
sense, especially because the variable is used in only very few
functions, however those are called all over the place.

A possible alternative would be a getter/setter function for the
variable. I have no problem with that, but the getter/setter function
has to store the location of the variable somewhere, and that can't be
solved except through pointer passing like above.

There must be a solution out there, I just can't see it.


More information about the coreboot mailing list