PowerPC trouble and patch for 'mbuf.h'.

Sergei Organov osv at javad.ru
Thu Nov 16 11:49:26 UTC 2000


Hello,

I've found that on PowerPC networking tasks, while created as non-fp tasks,
in fact use floating point instructions. This is is because 'gcc' tends to use
lfd/stfd instructions to copy 8-bytes entities. There is one place in TCP
stack where such collision occured, the M_COPY_PKTHDR macro. The patch below
fixes this by copying 8-bytes long structure field by field.

BTW, this is an example of how dangerous it is to don't disable FPU in MSR for 
non-fp tasks!

BR,
Sergei Organov.

--- mbuf.old.h  Thu May 27 22:03:50 1999
+++ mbuf.h      Tue Nov 14 16:48:53 2000
@@ -298,7 +298,8 @@
  * from must have M_PKTHDR set, and to must be empty.
  */
 #define        M_COPY_PKTHDR(to, from) { \
-       (to)->m_pkthdr = (from)->m_pkthdr; \
+       (to)->m_pkthdr.rcvif = (from)->m_pkthdr.rcvif; \
+       (to)->m_pkthdr.len = (from)->m_pkthdr.len; \
        (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
        (to)->m_data = (to)->m_pktdat; \
 }




More information about the users mailing list