Serious Bug All Targets -- Please Read

Ralf Corsepius ralf.corsepius at rtems.org
Wed Mar 4 02:44:29 UTC 2009


Till Straumann wrote:
> Ralf Corsepius wrote:
>> Till Straumann wrote:
>>> Ralf Corsepius wrote:
>>>> Till Straumann wrote:
>>>>> Ralf Corsepius wrote:
>>>>>> Till Straumann wrote:
>>>>>>> Hmm - AFAIK, c99 doesn't specify the exact representation
>>>>>>> of 'bool' / '_Bool'. It only says that
>>>>>>>
>>>>>>> "An object declared as type _Bool is large enough to store the 
>>>>>>> values 0 and 1"
>>>>>>>
>>>>>>> Hence, there is no really safe way to access such
>>>>>>> an object from assembly code.
>>>>>> Exactly.
>>>>>>
>>>>>>> I wonder if it wouldn't be better to change the
>>>>>>> type of _Context_Switch_necessary & friends
>>>>>>> to a type of known width.
>>>>>> IMO, no.
>>>>>>
>>>>>> We should change to code into something which doesn't need to know 
>>>>>> the size of a type, rsp. automatically gets it right.
>>>>> So how would you do that given the requirement
>>>>> that these variables need to be available to
>>>>> assembly code, maybe w/o a stack available?
>>>> E.g. by rewriting the code in question in C
>>> That's what the new PPC framework does.
>>>> w/ inline asm. This isn't always possible, but is possible on many 
>>>> occasions, even when  stack is not available.
>>> w/o stack I'm not sure...
>> You can do something like this (Pseudo-C code):
>>
>> extern bool var;
>>
>> int _foo_stub(....)
>> {
>>   asm( ENTRY_SYMBOL(foo) );
>>   asm( PROCESS(var) );
>>
>>   asm( RETURN );
>> }
> You can't be serious.
>
What's your problem with this? This is all valid C  and is not any 
dirtier than using asm.

Ralf



More information about the users mailing list