Author: afaerber Date: Sat Oct 30 17:44:08 2010 New Revision: 930 URL: http://tracker.coreboot.org/trac/openbios/changeset/930
Log: Don't assume that pointer and cell size are identical, part 2
Do the double-dereference in two cell2pointer steps to avoid garbage in the high 32 address bits on ppc64.
Signed-off-by: Andreas Färber andreas.faerber@web.de
Modified: trunk/openbios-devel/kernel/internal.c
Modified: trunk/openbios-devel/kernel/internal.c ============================================================================== --- trunk/openbios-devel/kernel/internal.c Sat Oct 30 17:33:11 2010 (r929) +++ trunk/openbios-devel/kernel/internal.c Sat Oct 30 17:44:08 2010 (r930) @@ -329,10 +329,11 @@ #ifndef FCOMPILER static ucell get_myself(void) { - static ucell **myself = NULL; - if( !myself ) - myself = (ucell**)findword("my-self") + 1; - return (*myself && **myself) ? (ucell)**myself : 0; + static ucell *myselfptr = NULL; + if (myselfptr == NULL) + myselfptr = (ucell*)cell2pointer(findword("my-self")) + 1; + ucell *myself = (ucell*)cell2pointer(*myselfptr); + return (myself != NULL) ? *myself : 0; }
static void doivar(void)