[OpenBIOS] Solaris anyone?

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Mon Jun 20 17:53:51 CEST 2011

On 20/06/11 16:40, Bob Breuer wrote:

>> +1 this is a fairly easy job - handcraft some assembly into C and then
>> bind it into Forth. I'm happy to give you some pointers and help
>> review the patch if you can write it (especially as I know some of the
>> space* words are used in the SPARC64 loader too).
> Based off of
> http://forums.oracle.com/forums/thread.jspa?threadID=1905000&tstart=90 ,
> using the branch in a delay slot trick, here's a (untested) snippet of
> inline assembly to start from:
> __asm__("set 1f, %%g2\n\t"
>            "sll %1, 2, %1\n\t"
>            "jmp %1, %%g2, %%g0\n\t"
>            " ba 2f\n"
>            "1:\n\t"
>            "lda [%2] 0, %0\n\t"
>            "lda [%2] 4, %0\n\t"
>             ...
>            "2:\n"
>            : "=r" (result)
>            : "r" (asi), "r" (address)
>            : "g2");
> I'm not that familiar with the OpenBIOS source tree layout, so where
> would this best be placed?  How far to unroll the list of lda's?  I'm
> not even sure if the asi's are 7 or 8 bit, and it looks like nothing
> above 0x4c is defined for sparc32.  Maybe add some CPP magic to help
> with unrolling the list.

Hi Bob,

As a starting point, take a quick look at arch/sparc64/lib.c. I'd create 
a space* function in a similar way to the itlb_load2/itlb_load3 
functions and then in order to make the function visible to Forth as a 
word, add a bind_func() call within a suitable initialisation function. 
I'd suggest putting these both in arch/sparc32/lib.c as a starting point.

You should also use ASI_ defines from include/arch/sparc32/asi.h in 
order to aid readability, and in fact it seems many more of them are 
defined within include/arch/sparc64/asi.h so you may be able to 
cut/paste from there.



Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs

More information about the OpenBIOS mailing list