After the via-rhine, here is something weird about the
Realtek driver :
I had Etherboot stop after the "(DHCP)..." and
the frames were "malformed" due to the type in the
mac header being 0x0000.
Cause :
In "rtl_transmit", the variable nstype is updated only AFTER
the memcpy is done !
Moving the "nstype = htons(type)" far from the "memcpy" makes
the problem disappear.
The assembly output (Gcc 3.0.3) :
00000248 <rtl_transmit>:
248: 55 push %ebp
249: 57 push %edi
24a: 56 push %esi
24b: 53 push %ebx
24c: 83 ec 0c sub $0xc,%esp
24f: 8b 4c 24 24 mov 0x24(%esp,1),%ecx
253: 8b 01 mov (%ecx),%eax
255: 8b 6c 24 20 mov 0x20(%esp,1),%ebp
259: a3 20 00 00 00 mov %eax,0x20
25e: 66 8b 41 04 mov 0x4(%ecx),%ax
262: 8b 4d 18 mov 0x18(%ebp),%ecx
265: 66 a3 24 00 00 00 mov %ax,0x24
26b: 8b 01 mov (%ecx),%eax
26d: 8b 5c 24 2c mov 0x2c(%esp,1),%ebx
271: 8b 54 24 28 mov 0x28(%esp,1),%edx ;Here is
"type", from the function parameters
275: a3 26 00 00 00 mov %eax,0x26
27a: 86 d6 xchg %dl,%dh ;htons(type)
27c: 66 8b 41 04 mov 0x4(%ecx),%ax
280: 66 a3 2a 00 00 00 mov %ax,0x2a
286: 0f b7 d2 movzwl %dx,%edx ;extend %edx
289: 8b 44 24 08 mov 0x8(%esp,1),%eax ; %eax=nstype
(!!!Uninitialized!!!)
28d: 85 db test %ebx,%ebx
28f: 8b 74 24 30 mov 0x30(%esp,1),%esi
293: 89 54 24 08 mov %edx,0x8(%esp,1)
;nstype=htons(type)
297: 66 a3 2c 00 00 00 mov %ax,0x2c ; !!! We are using
%ax, not %dx !!!
; Thus the tx_buffer.mactype is WRONG !
Let's hope it does not appear at other places in the code !!!
Not that easy to trace !
Regards,
--
Jean-Jacques Michel mailto:jjm...@li...
Hardware Engineer - Linbox http://www.linbox.com
Technopôle Metz 2000 - 152 rue de Grigy - 57070 Metz - France
Tel : +33 (0)3 87 75 55 21 - Fax : +33 (0)3 87 75 19 26
|