From mboxrd@z Thu Jan 1 00:00:00 1970 From: Graeme Russ Date: Sat, 13 Nov 2010 22:18:52 +1100 Subject: [U-Boot] RFC: Aligning arch initialisation sequences In-Reply-To: <4CDE4A53.4070106@free.fr> References: <4CD67A22.9040802@gmail.com> <201011091835.38581.vapier@gentoo.org> <4CDE1107.80108@gmail.com> <4CDE4A53.4070106@free.fr> Message-ID: <4CDE741C.1020507@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 13/11/10 19:20, Albert ARIBAUD wrote: > Le 13/11/2010 05:16, Graeme Russ a ?crit : > >> I essence, the gd pointer is a unique global variable available prior to >> relocation. On all other arches, this is achieved by using a reserved >> register which I do not have the luxury of on x86 :( > > Dusting off ooooold knowledge of x86 and without even a glance at x86 > u-boot... Since GD is the only global used pre-reloc, can you not ensure > it always ends up first in the data segment, and then manage two values > for the DS segment reg, one pre-reloc where only gd can be used, and one > post-reloc where gd and all the other globals can be accessed? I had though of something similar to that by using GS (which is not generally used by u-boot) but it is very messy All segments are currently setup to be full 4GB with the initial descriptor table hard-coded in flash and then reloaded after relocation (it needs to be reloaded so it does not get clobbered when erasing flash or relocating from RAM). I did have a dynamic GTD calculated in asm using self modifying code but changed that out to use the same 'C' methodology as Linux. I would prefer not to go back there... So yes, it is possible, but quite frankly, I would rather leave the init functions post relocation than mess around with the GTS pre-relocation Regards, Graeme