[OpenBIOS] [PATCH] Add tbu@ and tbl@ words

Segher Boessenkool segher at kernel.crashing.org
Wed Dec 27 19:48:01 CET 2017


On Wed, Dec 27, 2017 at 01:35:46PM -0500, John Arbuckle wrote:
> +/* reads the lower timebase register ( -- tbl ) */
> +static void get_tbl(void)
> +{
> +    int time;
> +    asm volatile("mftb %0" : "=r"(time)); // load from TBL register
> +    PUSH(time);
> +}

This doesn't get TBL: on 64-bit implementations it gets all of TB.  You'll
have to mask out the high half if you want to get just TBL.  Or, you could
just use mftb (mfspr 268) on 64-bit systems, instead of the TBU dance that
you need on 32-bit systems.


Segher



More information about the OpenBIOS mailing list