[OpenBIOS] [PATCH, RFC 1/5] Don't assume that pointer and cell size are identical, part 2
Andreas Färber
andreas.faerber at web.de
Sat Oct 30 13:59:14 CEST 2010
Am 27.10.2010 um 01:08 schrieb Andreas Färber:
> Do the double-dereference in two steps to avoid garbage in the
> high 32 address bits on ppc64.
>
> Signed-off-by: Andreas Färber <andreas.faerber at web.de>
If no one objects, I'll commit this one and some switch-arch support
to try it on ppc64 later today.
> ---
> kernel/internal.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/internal.c b/kernel/internal.c
> index 0235737..760c66d 100644
> --- a/kernel/internal.c
> +++ b/kernel/internal.c
> @@ -329,10 +329,11 @@ static void doplusloop(void)
> #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)
> --
> 1.7.3
>
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
More information about the OpenBIOS
mailing list