[OpenBIOS] [RFC 3/3] SPARC32/64: Mimic Sun's OBP behaviour if a divide by zero occurs.
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sat Jan 12 15:41:48 CET 2013
On 12/01/13 14:18, Segher Boessenkool wrote:
> [It seems you showed __udivmodti4 instead -- but the code is much the
> same].
Oops ;)
> That's not libgcc code: it is x86 Linux kernel code or klibc or something
> like that. Libgcc forces a single-precision divide by zero when the double-
> precision routine divides by zero, so there can be no problem there.
Okay.
>> A quick grep of the source shows that __divide_error() is manually set
>> to the unexpected exception trap handler in start.S:
>>
>> _GLOBAL(__divide_error):
>> trap_error:
>> mflr r3
>> LOAD_REG_FUNC(r4, unexpected_excep)
>> mtctr r4
>> bctr
>>
>> Heh. So actually all we need to do is provide an empty function for
>> __divide_error() and we magically get the behaviour we want. Revised
>> patch to follow shortly.
>
> Or not have a __divide_error at all, which makes it clearer the intent
> is to have the double precision divide have the same behaviour as single
> precision on whatever hardware it runs on. Your patch should work though
> :-)
I suspect that it's used by other platforms within OpenBIOS, so I don't
really want to remove it as it allows customisation of the behaviour as
required.
I really like the last patch, so will commit tomorrow unless I hear any
major objections from people on this thread. Thanks for your help on this.
ATB,
Mark.
More information about the OpenBIOS
mailing list