[Prev][Next][Index][Thread]

Re: failure isolated



Lo and Behold, Giuseppe Lettieri said:
> [Bootp hangs on floating point calculation]
> 
> bootp_timeout *= (float)BOOTP_TIMER_FREQ/1000;
> 
> and:
> 
> bp.bp_secs = htons((bootp_currticks() - starttime) / (float)BOOTP_TIMER_FREQ);
> 
> I have replaced both expressions with constant values, and now pingreplay works well...
> 
> I have also tried to execute a floating point operation in the "hello" kernel, and it works correctly.
> 
> Any ideas?

   Just off the top of my head, it _may_ be generating a floating
point exception at some point, or it doesn't have the floating point
support set up yet.  I suspect that the compiler was perhaps able to
optimize these away, since it really is a totally constant value
propagation through bootp_timeout, but I haven't verified that.

   In any event, it's rather silly to have floating point operations
in the bootp code (!), so the following patch removes them.  I've
tested it on our test machines (tulip ethernet device) and it still
works, so I can't have broken too much. :-)

   Those were the only two floating point operations in the bootp and
boot/net code, so this should leave things completely float free.

   -Dave

Index: bootp.c
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/bootp/bootp.c,v
retrieving revision 1.12
diff -u -r1.12 bootp.c
--- bootp.c     1998/04/08 22:42:21     1.12
+++ bootp.c     1999/06/24 17:45:54
@@ -55,7 +55,8 @@
        bp.bp_xid = ++bootp_xid;
 
        /* bootp_timeout is in milliseconds, scale it to ticks */
-       bootp_timeout *= (float)BOOTP_TIMER_FREQ / 1000;
+       bootp_timeout *= BOOTP_TIMER_FREQ;
+       bootp_timeout /= 1000;
 
        /* Fill in my hardware address */
        memcpy(bp.bp_hwaddr, hwaddr, ETHER_ADDR_SIZE);
@@ -63,7 +64,7 @@
                int timeout;
 
                bp.bp_secs = htons((bootp_currticks() - starttime) /
-                                  (float)BOOTP_TIMER_FREQ);
+                                  BOOTP_TIMER_FREQ);
 
                /* send BOOTP request */
                bootp_udp_broadcast(bp.bp_hwaddr, srcip, 0, BOOTP_SERVER,


References: