On 20/08/11 06:11, Bob Breuer wrote:
Unfortunately I have no way of testing what the output should be for any given input for this function, but to my untrained eye the general patch style/location look fine. The only thing I'd like to see is a stack diagram for the sun4m-sbus-intr>cpu word at which point if no-one else objects then I'm happy to commit.
Ah, I forgot a pointer to something resembling documentation. I used the Linux source file arch/sparc/kernel/sun4m_irq.c. To get the resulting value for intr, the low 4 bits are the PIL, and the upper 4 bits correspond to 0x30 for SBUS.
That's great - a comment within tree.fs next to the sun4m-sbus-inter>cpu would be fine for me.
If someone could show how this C snippet might translate into forth: static const uint8_t map[7] = { 0x32, ... }; return map[sbus_level]; then I could just do an array lookup in sun4m-sbus-intr>cpu to make the mapping more obvious.
Have you tried Leo Brodie's excellent "Starting Forth" book which is now available online? Have a look at the "Initializing an Array" section here: http://www.forth.com/starting-forth/sf8/sf8.html.
HTH,
Mark.