[ros-dev] Re: [ros-svn] [arty] 14588: Commit for blight: fix stack alignment.

Hartmut Birr hartmut.birr at gmx.de
Tue Apr 12 18:18:12 CEST 2005


James Tabor wrote:

> Hartmut Birr wrote:
>
>> Hi,  
>> why do you change this file? Alloca.c isn't used and should be removed.
>> If we have an alloca function somewhere in our source, it must be
>> completely written in assembler because the stack layout and the using
>> of ebp depends on the compilers optimisation.  
>> - Hartmut
>>
>> arty at svn.reactos.com wrote:
>>
>>
>>> Commit for blight: fix stack alignment.
>>>
>>>
>>> Updated files:
>>> trunk/reactos/lib/crtdll/stdlib/alloca.c
>>>
> Rewrite it! Make lib/crtdll/stdlib/i386/alloca.s and powerpc/alloca.s.
> James

Hi,   

I think it isn't possible to write the alloca function outside from
compiler. The compiler may use esp instead of ebp to access local
variables. In this case it isn't possible to manipulate esp. I remember
same old problems from hal:   

pushf 
cli
 ...
 popf  

 This sequence has crashed reactos on optimized builds, because there
was accessed a local variable inside pushf/popf by using esp+offset.   

- Hartmut



More information about the Ros-dev mailing list