
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 04/04/2013 01:52 AM, Wolfgang Denk wrote:
Dear Tom,
In message 20130403164215.GK7035@bill-the-cat you wrote:
... except, as I said above, at this point your code should not write at all, be int in BSS or data, until the C environment is set up. So...
But we have to save this ROM-passed information before we overwrite it ourselves (by accident or purpose).
Thete are two official places for data storage before the full C runtime environment is available: the stack, and the "global data" structure.
Well, there's a 3rd "official" way, that crept in. There's a certain amount of that has to get run before we can have the BSS ready (which resides in DDR) and we're still in some other form of RAM and need a few variables that would otherwise live in the BSS available now. Generally this is the i2c driver (so that we can see what platform this is and what our DDR is then). The other case is the pointer to whatever might have come in from ROM. We do not have stack at this point in time yet, even, when we call save_boot_params.
But I think, and need to re-read this thread a bit more, part of the solution is to rename jump_to_image_no_args as jump_to_image_uboot, keep it __weak and provide one that deals with this (and perhaps more cleanly deals with VIRTIO/ZEBU image_entry). And after that we can talk about moving things that can't be in the BSS out of the data section and into another section.
Adding another section makes things more complicated, but not really better. If you can provide writable storage, then you could also use it in a more regular way, say for a writable data segment, or bigger stack, or malloc space, or ... so it is generally useful instead of only this special case here.
I don't think we have much choice here. This is really the very first thing we do.
- -- Tom