RTEMS stack + TSIM-LEON2 weird behaviour

Jiri Gaisler jiri at gaisler.com
Tue May 6 16:14:32 UTC 2008


%sp is set either by the boot loader (mkprom), grmon
or rdbmon (gdb stub). The %sp is also stored to an
unused part of the trap table (0x7C0). This works
fine without any problems on both simulator and
real hardware ...

Jiri.

Joel Sherrill wrote:

> I don't disagree.  But why is the stack pointer set the way it is in 
> start.S? It assumes some value is in %sp from the invoking environment.  
> If that
> isn't 0, it looks to me that the code doesn't work.
> 
> --joel
>> Jiri.
>>
>>
>>
>> Joel Sherrill wrote:
>>  
>>> Aitor.Viana.Sanchez at esa.int wrote:
>>>    
>>>>      
>>>>> The initial value of %sp seens to be 0 on the sparc configurations I
>>>>>         
>>>> have.
>>>>      
>>>>> So the sub instruction you highlighted above would set the %sp to
>>>>> the area below the work space.
>>>>>         This code hasn't changed in a LONG time and makes 
>>>>> assumptions about
>>>>> the execution environment which I cannot personally guarantee.  Jiri
>>>>> would be able to do so.
>>>>>         
>>>> i am pretty sure (Jiri will correct me if I am wrong) that TSIM
>>>> initializes %sp and %fp to allow direct RAM execution in case the SW
>>>> does not have a bootstrap SW behind (e.g. mkprom)
>>>>
>>>>      
>>>>> My first thought this morning is that this may have been a valid
>>>>>         
>>>> assumption
>>>>      
>>>>> at one time (initial %sp is 0) but with more variations and starting
>>>>> environments,
>>>>> it may not be valid anymore.  I would guess that the "sub" statement
>>>>>         
>>>> would
>>>>      
>>>>> be better changed to a "mov %l3, %sp" and ignore the inherited %sp.
>>>>>         
>>>> I think this a good solution.
>>>>
>>>>       
>>> It is certainly simple.  We need confirmation from Jiri or Daniel.
>>>    
>>>> Regards,
>>>>
>>>> Aitor
>>>>
>>>>
>>>>       
>>>     
> 
> 



More information about the users mailing list