diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-04 21:25:04 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-10-04 21:25:04 +0000 |
commit | f82657a4cbdc3c11d816fb242a7c9b6e2637829f (patch) | |
tree | d5cb18e17b777bdca3a4e9ffd9a30dabc6896145 /sys/arch | |
parent | fa01df2e5de645dd9ccbe94769c61fed89db968e (diff) |
in _bus_dmamem_alloc_range() use TAILQ_*() instead of tq*_* internals; more diagnostic checks
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 3e05c52936d..72d05721a4c 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.177 2001/10/04 21:20:12 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.178 2001/10/04 21:25:03 mickey Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3300,17 +3300,20 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, * Compute the location, size, and number of segments actually * returned by the VM code. */ - m = mlist.tqh_first; + m = TAILQ_FIRST(&mlist); curseg = 0; lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m); segs[curseg].ds_len = PAGE_SIZE; - m = m->pageq.tqe_next; - for (; m != NULL; m = m->pageq.tqe_next) { + for (m = TAILQ_NEXT(m, pageq); m != NULL; m = TAILQ_NEXT(m, pageq)) { curaddr = VM_PAGE_TO_PHYS(m); #ifdef DIAGNOSTIC + if (curseg == nsegs) { + printf("uvm_pglistalloc returned too many\n"); + panic("_bus_dmamem_alloc_range"); + } if (curaddr < low || curaddr >= high) { - printf("vm_page_alloc_memory returned non-sensical" + printf("uvm_pglistalloc returned non-sensical" " address 0x%lx\n", curaddr); panic("_bus_dmamem_alloc_range"); } |