[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Powerpc IRQ handling breaks strict EABI compliance



Sergei Organov wrote:
> Joel Sherrill <joel.sherrill at oarcorp.com> writes:
> 
> [...]
> 
> 
>>I agree with your analysis. The r2/r13 init needs to happen much earlier
>>than constructors can be executed.
>>
>>So the simplest solution (to me anyway) is:
>>
>>  + bsp assembly startup initializes r2/r13 possibly using common code
>>    derived from __eabi without the call to _init.
>>  + call _init from _Threaad_Handler
>>
>>Longer term, we can switch the toolset from non-EABI to EABI if that is
>>desirable.
> 
> 
> I also think this is the simplest solution. The only question remained is if
> the __eabi() is GPLed, and if so, if the "common code derived from __eabi"
> could be put into RTEMS ;-)
> 

I don't like the idea of replicating (parts of) __eabi(). I'd rather
use the original. Note that if we cant change the way it branches
to __init, there's a simple fix to this:

add ecrti_rtems/ecrtn_rtems startup files who are put after
ecdri/ecdrtn. ecrti_rtems.S could simply do
     .section ".init","ax"
     .align 2
FUNC_START(__init)
     lwz 0,20(1)
     mtlr 0
     addi 1,1,16
     blr
FUNC_START(_init)
     stwu 1,-16(1)
     mflr 0
     stw  0,20(1)

This snippet makes __init() a no-op and creates a new entry
point _init for use by the ThreadHandler (remember, ThreadHandler
calls _init anyways). Alternatively, a special symbol may be used.

All the BSP has to do now is calling __eabi() at an early stage.

-- Till