[OpenBIOS] [PATCH] Add tbu@ and tbl@ words
Segher Boessenkool
segher at kernel.crashing.org
Sat Dec 30 12:14:39 CET 2017
On Sat, Dec 30, 2017 at 02:01:41AM +0100, BALATON Zoltan wrote:
> I've tried to implement it the way I've suggested and came up with the
> patch below, but it does not seem to work. I think this is because the
> arithmetic in get-msec overflows and does not get the right values. Could
> it be it works in SLOF because that runs on 64bit? Or is something needed
> to tell Forth to use 64bit values on PPC32? Any ideas?
> +static void tb_fetch(void)
> +{
> + unsigned long tbl, tbu;
> +
> + do {
> + tbu = mftbu();
> + tbl = mftb();
> + } while (tbu != mftbu());
> + DPUSH(((uint64_t)tbu << 32) | tbl);
> +}
Whether the code here is correct or not, it is simpler to just write it as
PUSH(tbl);
PUSH(tbu);
Segher
More information about the OpenBIOS
mailing list