On Mon, Jun 20, 2011 at 6:40 PM, Bob Breuer breuerr@mc.net wrote:
Mark Cave-Ayland wrote:
On 15/06/11 19:48, Blue Swirl wrote:
By the way, what would it take to get the space[cwLd] commands in OpenBIOS? They come in handy for verifying these asi accesses.
Shouldn't be very difficult. Since on Sparc32 it's not possible to give ASI in a register, a switch or hand assembly would be needed.
+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");
IIRC there is some way to let GCC pick the register instead of fixing it to 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.
I'd add all of them.