cvs commit: src/sys/kern subr_rman.c

Warner Losh imp at FreeBSD.org
Tue Mar 15 12:28:52 PST 2005


imp         2005-03-15 20:28:51 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             subr_rman.c 
  Log:
  Sometimes, when asked to return region A..C, we'd return A+N..C+N
  instead of failing.
  
  When looking for a region to allocate, we used to check to see if the
  start address was < end.  In the case where A..B is allocated already,
  and one wants to allocate A..C (B < C), then this test would
  improperly fail (which means we'd examine that region as a possible
  one), and we'd return the region B+1..C+(B-A+1) rather than NULL.
  Since C+(B-A+1) is necessarily larger than C (end argument), this is
  incorrect behavior for rman_reserve_resource_bound().
  
  The fix is to exclude those regions where r->r_start + count - 1 > end
  rather than r->r_start > end.  This bug has been in this code for a
  very long time.  I believe that all other tests against end are
  correctly done.
  
  This is why sio0 generated a message about interrupts not being
  enabled properly for the device.  When fdc had a bug that allocated
  from 0x3f7 to 0x3fb, sio0 was then given 0x3fc-0x404 rather than the
  0x3f8-0x3ff that it wanted.  Now when fdc has the same bug, sio0 fails
  to allocate its ports, which is the proper behavior.  Since the probe
  failed, we never saw the messed up resources reported.
  
  I suspect that there are other places in the tree that have weird
  looping or other odd work arounds to try to cope with the observed
  weirdness this bug can introduce.  These workarounds should be located
  and eliminated.
  
  Minor debug write fix to match the above test done as well.
  
  'nice' by: mdodd
  Sponsored by: timing solutions (http://www.timing.com/)
  
  Revision  Changes    Path
  1.40      +3 -2      src/sys/kern/subr_rman.c


More information about the cvs-src mailing list