On 07/01/13 19:37, Tarl Neustaedter wrote:
The key error here (as I see it) is:
dup FFFF and to cursorY 10 >> d# 1000 swap / to cursorDelay
Where is that code? It looks like it's the third argument to "slw_spin_init" that is being used as a divisor, and it should be checked for zero.
...
So it looks like this code depends on arg3 being non-zero. I assume the arguments are coming from right-to-left, which is backwards from other c-to-forth implementations I've seen (usually the c call is procedure(arg1, arg2, arg3, ...) ), but that would not seem to fit here, since arg5 appears to require a pointer. Note that not all architectures use 0 == NULL; some use other values, so I wonder if this is a bug originating from some such usage combined with argument order confusion.
That's an interesting thought about argument order. Of course given that BootX has been supplied on OS X CDs in this state for a long time (and probably isn't even supported now) we are still left with having to work around it :(
The better fix would be to check for zero in slw_spin_init. Or are you saying that both the call to SpinInit() /and/ the slw_spin_init( -- ) forth code are in BootX, code we aren't allowed to touch? If that's the case, indeed, a program which deliberately sets up a divide by zero expecting it to work has to be hacked around. To quote from that PPC 8360 article:
"I've inherited legacy code like this before & I feel your pain. You want to shake your fist at the people who installed such bone-headed behavior, but right now shaking your fist doesn't help you ship product. You need a solution. Good luck."
Well the source for SpinInit() and friends can be found here: http://www.opensource.apple.com/source/BootX/BootX-74.1/bootx.tproj/ci.subpr..., and as you can see slw_spin_init is lovingly hard-coded into BootX in this form. The C snippet from my last email invoking SpinInit() with all zero arguments is also hard-coded into a different file. So it looks like I'll need all the luck I can get... I'm hoping that the RFC patch is the lesser of all evils though ;)
ATB,
Mark.