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

Programmingkid programmingkidx at gmail.com
Thu Dec 28 14:26:53 CET 2017


> On Dec 28, 2017, at 2:51 AM, Jd Lyons <lyons_dj at yahoo.com> wrote:
> 
> 
> 
>> On Dec 27, 2017, at 1:35 PM, John Arbuckle <programmingkidx at gmail.com> wrote:
>> 
>> The PowerPC timebase register is made available to forth using
>> the tbu@ and tbl@ words. The tbu@ word pushes the upper 32 bits
>> of this register. The tbl@ word pushes the lower 32 bits of
>> this register.
>> 
>> Signed-off-by: John Arbuckle <programmingkidx at gmail.com>
>> ---
>> arch/ppc/qemu/init.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>> 
>> diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
>> index 5ce080c..d12084c 100644
>> --- a/arch/ppc/qemu/init.c
>> +++ b/arch/ppc/qemu/init.c
>> @@ -751,6 +751,22 @@ static void adler32(void)
>>    RET(s2 << 16 | s1);
>> }
>> 
>> +/* reads the upper timebase register ( -- tbu ) */
>> +static void get_tbu(void)
>> +{
>> +    int time;
>> +    asm volatile("mftbu %0" : "=r"(time)); // load from TBU register
>> +    PUSH(time);
>> +}
>> +
>> +/* 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);
>> +}
>> +
>> void
>> arch_of_init(void)
>> {
>> @@ -1022,4 +1038,8 @@ arch_of_init(void)
>> 
>>    bind_func("platform-boot", boot);
>>    bind_func("(arch-go)", arch_go);
>> +    
>> +    /* Makes the timebase register accessible from forth */
>> +    bind_func("tbu@", get_tbu);
>> +    bind_func("tbl@", get_tbl);
>> }
>> -- 
>> 2.14.3 (Apple Git-98)
>> 
>> 
>> -- 
>> OpenBIOS                 http://openbios.org/
>> Mailinglist:  http://lists.openbios.org/mailman/listinfo
>> Free your System - May the Forth be with you
> 
> Ok, dumb question, how do I pull and apply this patch?

I would save the patch email to disk. Then use this command from inside the OpenBIOS folder: patch -p0 <path>/tb.patch




More information about the OpenBIOS mailing list