[OpenBIOS] [PATCH] Add tbu@ and tbl@ words
programmingkidx at gmail.com
Wed Dec 27 21:28:09 CET 2017
> On Dec 27, 2017, at 1:48 PM, Segher Boessenkool <segher at kernel.crashing.org> wrote:
> 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.
I wasn't aware that OpenBIOS supported 64-bit PowerPC. What if I change the type of the time variable to uint32_t. This type can only hold a 32-bit value, would the following code work on 64-bit PowerPC?
/* reads the lower timebase register ( -- tbl ) */
static void get_tbl(void)
asm volatile("mftb %0" : "=r"(time)); // load from TBL register
Also how would I test 64-bit PowerPC code in QEMU? If you could send the command-line needed that would help.
More information about the OpenBIOS