[U-Boot] debug uboot from ram for x86 board

Lance Zhang Lance.Zhang at taihootech.com
Fri Dec 26 06:34:32 CET 2008


Hi Graeme
>I have the same problem. I am in the process of finalising some other
x86
>common code to make the custom board port more seemless before I dig
deeper.

>I do, however, feel that a look at the nios code (lib_nios/board.c)
might
>shed some light on the issue. Specifically the comment in do_go_exec:
>
>unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char
*argv[])
>
>{
>	/*
>	 * x86 does not use a dedicated register to pass the pointer
>	 * to the global_data
>	 */
>	argv[-1] = (char *)gd;
>	return entry (argc, argv);
>}

>I think the lib_i386 implementation of do_go_exec() is not right
I carefully read the codes related to the do_go function, and I find
that(u boot 1.1.6):
In do_go() functions:
#if defined(CONFIG_I386)
	/*
	 * x86 does not use a dedicated register to pass the pointer
	 * to the global_data
	 */
	argv[0] = (char *)gd;
#endif

But in app_startup function:
void app_startup(char **argv)
{
	unsigned long * cp = &__bss_start;

	/* Zero out BSS */
	while (cp < &_end) {
		*cp++ = 0;
	}

#if defined(CONFIG_I386)
	/* x86 does not have a dedicated register for passing
global_data */
	global_data = (gd_t *)argv[-1];
	jt = global_data->jt;
#endif
}

The gd is not in the same place :see do_go is argv[0], and app_startup
is (gd_t *)argv[-1].

But later I modified the global_data = (gd_t *)argv[-1]; in app_startup
function to global_data = (gd_t *)argv[0], the change still does not
make sense.

Any ideas?  Maybe I should change the argv[0] = (char *)gd; in do_go
function to argv[-1] = (char *)gd;

Thanks
Lance Zhang


More information about the U-Boot mailing list