PowerPC in_cksum() needs -O
Till Straumann
strauman at slac.stanford.edu
Tue Sep 22 03:23:36 UTC 2009
Two details strike the eye -- I'm not sure they are responsible
for this problem but they need to be fixed anyways:
The PPC version of in_cksum() uses inline assembly and
a) fails to declare that XER[CR] is clobbered
b) assumes that XER[CR] is preserved between separate 'asm'
statements. This is AFAIK an illegal assumption. All the
additions using the carry bit must be coded into a *single* asm
statement and xer added to the clobber list.
YMMV
-- Till
Joel Sherrill wrote:
> Peter Dufault wrote:
>> On Sep 21, 2009, at 2:12 , Peter Dufault wrote:
>>
>>
>>> I've tracked it down to everything getting dropped with a bad
>>> checksum in tcp_input() at line 321.
>>>
>>
>> I had built with optimization off for debugging. Without
>> optimization in_cksum() is returning 1. With -O2 in effect it is
>> returning 0.
>>
>> I put a breakpoint right after the call to in_cksum() with the only
>> change recompiling tcp_input.c with and without optimization.
>>
>> Checksum with tcp_input.c compiled with -O2:
>> (gdb) print ti->ti_t.th_sum
>> $1 = 0x0
>> (gdb)
>>
>> Checksum with tcp_input.c compiled without any optimization:
>> (gdb) print ti->ti_t.th_sum
>> $1 = 0x1
>> (gdb)
>>
>> I'll open a bug.
>>
>>
> It is probably some less than perfectly specific
> asm constraint. Can you check the current
> BSD source for the implementation? It may
> already be fixed.
>
> --joel
>> Peter
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
>>
>
>
More information about the users
mailing list