From owner-svn-src-all@FreeBSD.ORG Thu Dec 2 22:19:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 988CF106564A; Thu, 2 Dec 2010 22:19:30 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82BE38FC12; Thu, 2 Dec 2010 22:19:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB2MJUq8031480; Thu, 2 Dec 2010 22:19:30 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB2MJUx5031472; Thu, 2 Dec 2010 22:19:30 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201012022219.oB2MJUx5031472@svn.freebsd.org> From: Bruce Cran Date: Thu, 2 Dec 2010 22:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216134 - in head: share/man/man9 sys/amd64/include sys/arm/include sys/i386/include sys/ia64/include sys/mips/include sys/pc98/include sys/powerpc/include sys/sparc64/include sys/sun4v... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Dec 2010 22:19:30 -0000 Author: brucec Date: Thu Dec 2 22:19:30 2010 New Revision: 216134 URL: http://svn.freebsd.org/changeset/base/216134 Log: Disallow passing in a count of zero bytes to the bus_space(9) functions. Passing a count of zero on i386 and amd64 for [I386|AMD64]_BUS_SPACE_MEM causes a crash/hang since the 'loop' instruction decrements the counter before checking if it's zero. PR: kern/80980 Discussed with: jhb Modified: head/share/man/man9/bus_space.9 head/sys/amd64/include/bus.h head/sys/arm/include/bus.h head/sys/i386/include/bus.h head/sys/ia64/include/bus.h head/sys/mips/include/bus.h head/sys/pc98/include/bus.h head/sys/powerpc/include/bus.h head/sys/sparc64/include/bus.h head/sys/sun4v/include/bus.h Modified: head/share/man/man9/bus_space.9 ============================================================================== --- head/share/man/man9/bus_space.9 Thu Dec 2 22:00:57 2010 (r216133) +++ head/share/man/man9/bus_space.9 Thu Dec 2 22:19:30 2010 (r216134) @@ -719,6 +719,9 @@ or which return data read from bus space do not obviously return an error code) do not fail. They could only fail if given invalid arguments, and in that case their behaviour is undefined. +Functions which take a count of bytes must not pass in a count of zero; +doing so will cause a panic if the kernel was compiled with +.Cd "options INVARIANTS" . .Sh TYPES Several types are defined in .In machine/bus.h Modified: head/sys/amd64/include/bus.h ============================================================================== --- head/sys/amd64/include/bus.h Thu Dec 2 22:00:57 2010 (r216133) +++ head/sys/amd64/include/bus.h Thu Dec 2 22:19:30 2010 (r216134) @@ -104,6 +104,9 @@ #ifndef _AMD64_BUS_H_ #define _AMD64_BUS_H_ +#include +#include + #include #include @@ -268,7 +271,7 @@ static __inline void bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) insb(bsh + offset, addr, count); else { @@ -289,7 +292,7 @@ static __inline void bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) insw(bsh + offset, addr, count); else { @@ -310,7 +313,7 @@ static __inline void bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) insl(bsh + offset, addr, count); else { @@ -356,7 +359,7 @@ static __inline void bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -388,7 +391,7 @@ static __inline void bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -420,7 +423,7 @@ static __inline void bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -532,7 +535,7 @@ static __inline void bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) outsb(bsh + offset, addr, count); else { @@ -553,7 +556,7 @@ static __inline void bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) outsw(bsh + offset, addr, count); else { @@ -574,7 +577,7 @@ static __inline void bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) outsl(bsh + offset, addr, count); else { @@ -621,7 +624,7 @@ static __inline void bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -653,7 +656,7 @@ static __inline void bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -685,7 +688,7 @@ static __inline void bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -877,6 +880,7 @@ bus_space_copy_region_1(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ @@ -912,6 +916,7 @@ bus_space_copy_region_2(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ @@ -947,6 +952,7 @@ bus_space_copy_region_4(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == AMD64_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ Modified: head/sys/arm/include/bus.h ============================================================================== --- head/sys/arm/include/bus.h Thu Dec 2 22:00:57 2010 (r216133) +++ head/sys/arm/include/bus.h Thu Dec 2 22:19:30 2010 (r216134) @@ -66,6 +66,9 @@ #ifndef _MACHINE_BUS_H_ #define _MACHINE_BUS_H_ +#include +#include + #include /* @@ -318,21 +321,29 @@ struct bus_space { * Bus read multiple operations. */ #define bus_space_read_multi_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_1: count == 0")); \ __bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) #define bus_space_read_multi_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_2: count == 0")); \ __bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) #define bus_space_read_multi_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_4: count == 0")); \ __bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) #define bus_space_read_multi_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_8: count == 0")); \ __bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_1: count == 0")); \ __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_2: count == 0")); \ __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_4: count == 0")); \ __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_8: count == 0")); \ __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c)) @@ -340,21 +351,29 @@ struct bus_space { * Bus read region operations. */ #define bus_space_read_region_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_1: count == 0")); \ __bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) #define bus_space_read_region_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_2: count == 0")); \ __bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) #define bus_space_read_region_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_4: count == 0")); \ __bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) #define bus_space_read_region_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_8: count == 0")); \ __bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_stream_1: count == 0"));\ __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_stream_2: count == 0"));\ __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_stream_4: count == 0"));\ __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_stream_8 count == 0")); \ __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c)) @@ -376,21 +395,29 @@ struct bus_space { * Bus write multiple operations. */ #define bus_space_write_multi_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_1: count == 0")); \ __bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) #define bus_space_write_multi_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_2: count == 0")); \ __bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) #define bus_space_write_multi_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_4: count == 0")); \ __bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) #define bus_space_write_multi_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_8: count == 0")); \ __bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_stream_1: count == 0"));\ __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_stream_2: count == 0"));\ __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_stream_4: count == 0"));\ __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_stream_8: count == 0"));\ __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c)) @@ -398,34 +425,50 @@ struct bus_space { * Bus write region operations. */ #define bus_space_write_region_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_1: count == 0")); \ __bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) #define bus_space_write_region_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_2: count == 0")); \ __bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) #define bus_space_write_region_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_4: count == 0")); \ __bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) #define bus_space_write_region_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_8: count == 0")); \ __bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_1: count == 0")); \ __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_2: count == 0")); \ __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_4: count == 0")); \ __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_8: count == 0")); \ __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c)) /* * Set multiple operations. */ -#define bus_space_set_multi_1(t, h, o, v, c) \ +#define bus_space_set_multi_1(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_1: count == 0")); \ __bs_set(sm,1,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_2(t, h, o, v, c) \ +#define bus_space_set_multi_2(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_2: count == 0")); \ __bs_set(sm,2,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_4(t, h, o, v, c) \ +#define bus_space_set_multi_4(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_4: count == 0")); \ __bs_set(sm,4,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_8(t, h, o, v, c) \ +#define bus_space_set_multi_8(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_8: count == 0")); \ __bs_set(sm,8,(t),(h),(o),(v),(c)) @@ -433,25 +476,33 @@ struct bus_space { * Set region operations. */ #define bus_space_set_region_1(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_1: count == 0")); \ __bs_set(sr,1,(t),(h),(o),(v),(c)) #define bus_space_set_region_2(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_2: count == 0")); \ __bs_set(sr,2,(t),(h),(o),(v),(c)) #define bus_space_set_region_4(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_4: count == 0")); \ __bs_set(sr,4,(t),(h),(o),(v),(c)) #define bus_space_set_region_8(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_8: count == 0")); \ __bs_set(sr,8,(t),(h),(o),(v),(c)) /* * Copy operations. */ -#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_1: count == 0")); \ __bs_copy(1, t, h1, o1, h2, o2, c) -#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_2: count == 0")); \ __bs_copy(2, t, h1, o1, h2, o2, c) -#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_4: count == 0")); \ __bs_copy(4, t, h1, o1, h2, o2, c) -#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_8: count == 0")); \ __bs_copy(8, t, h1, o1, h2, o2, c) /* Modified: head/sys/i386/include/bus.h ============================================================================== --- head/sys/i386/include/bus.h Thu Dec 2 22:00:57 2010 (r216133) +++ head/sys/i386/include/bus.h Thu Dec 2 22:19:30 2010 (r216134) @@ -104,6 +104,9 @@ #ifndef _I386_BUS_H_ #define _I386_BUS_H_ +#include +#include + #include #include @@ -272,7 +275,7 @@ static __inline void bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) insb(bsh + offset, addr, count); else { @@ -297,7 +300,7 @@ static __inline void bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) insw(bsh + offset, addr, count); else { @@ -322,7 +325,7 @@ static __inline void bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) insl(bsh + offset, addr, count); else { @@ -372,7 +375,7 @@ static __inline void bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -412,7 +415,7 @@ static __inline void bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -452,7 +455,7 @@ static __inline void bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -572,7 +575,7 @@ static __inline void bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) outsb(bsh + offset, addr, count); else { @@ -597,7 +600,7 @@ static __inline void bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) outsw(bsh + offset, addr, count); else { @@ -622,7 +625,7 @@ static __inline void bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) outsl(bsh + offset, addr, count); else { @@ -673,7 +676,7 @@ static __inline void bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int8_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -713,7 +716,7 @@ static __inline void bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int16_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -753,7 +756,7 @@ static __inline void bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t offset, const u_int32_t *addr, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { int _port_ = bsh + offset; #ifdef __GNUCLIKE_ASM @@ -818,6 +821,7 @@ bus_space_set_multi_1(bus_space_tag_t ta { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) while (count--) outb(addr, value); @@ -832,6 +836,7 @@ bus_space_set_multi_2(bus_space_tag_t ta { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) while (count--) outw(addr, value); @@ -846,6 +851,7 @@ bus_space_set_multi_4(bus_space_tag_t ta { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) while (count--) outl(addr, value); @@ -882,6 +888,7 @@ bus_space_set_region_1(bus_space_tag_t t { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) for (; count != 0; count--, addr++) outb(addr, value); @@ -896,6 +903,7 @@ bus_space_set_region_2(bus_space_tag_t t { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) for (; count != 0; count--, addr += 2) outw(addr, value); @@ -910,6 +918,7 @@ bus_space_set_region_4(bus_space_tag_t t { bus_space_handle_t addr = bsh + offset; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) for (; count != 0; count--, addr += 4) outl(addr, value); @@ -953,6 +962,7 @@ bus_space_copy_region_1(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ @@ -988,6 +998,7 @@ bus_space_copy_region_2(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ @@ -1023,6 +1034,7 @@ bus_space_copy_region_4(bus_space_tag_t bus_space_handle_t addr1 = bsh1 + off1; bus_space_handle_t addr2 = bsh2 + off2; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (tag == I386_BUS_SPACE_IO) { if (addr1 >= addr2) { /* src after dest: copy forward */ Modified: head/sys/ia64/include/bus.h ============================================================================== --- head/sys/ia64/include/bus.h Thu Dec 2 22:00:57 2010 (r216133) +++ head/sys/ia64/include/bus.h Thu Dec 2 22:19:30 2010 (r216134) @@ -91,6 +91,9 @@ #ifndef _MACHINE_BUS_H_ #define _MACHINE_BUS_H_ +#include +#include + #include #include @@ -298,7 +301,7 @@ static __inline void bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_multi_io_1(bsh + ofs, bufp, count); else { @@ -311,7 +314,7 @@ static __inline void bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_multi_io_2(bsh + ofs, bufp, count); else { @@ -324,7 +327,7 @@ static __inline void bus_space_read_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_multi_io_4(bsh + ofs, bufp, count); else { @@ -337,7 +340,7 @@ static __inline void bus_space_read_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_multi_io_8(bsh + ofs, bufp, count); else { @@ -361,7 +364,7 @@ static __inline void bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint8_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_multi_io_1(bsh + ofs, bufp, count); else { @@ -374,7 +377,7 @@ static __inline void bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint16_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_multi_io_2(bsh + ofs, bufp, count); else { @@ -387,7 +390,7 @@ static __inline void bus_space_write_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint32_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_multi_io_4(bsh + ofs, bufp, count); else { @@ -400,7 +403,7 @@ static __inline void bus_space_write_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_multi_io_8(bsh + ofs, bufp, count); else { @@ -425,7 +428,7 @@ static __inline void bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_region_io_1(bsh + ofs, bufp, count); else { @@ -439,7 +442,7 @@ static __inline void bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_region_io_2(bsh + ofs, bufp, count); else { @@ -453,7 +456,7 @@ static __inline void bus_space_read_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_region_io_4(bsh + ofs, bufp, count); else { @@ -467,7 +470,7 @@ static __inline void bus_space_read_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_read_region_io_8(bsh + ofs, bufp, count); else { @@ -493,7 +496,7 @@ static __inline void bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint8_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_region_io_1(bsh + ofs, bufp, count); else { @@ -507,7 +510,7 @@ static __inline void bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint16_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_region_io_2(bsh + ofs, bufp, count); else { @@ -521,7 +524,7 @@ static __inline void bus_space_write_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint32_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_region_io_4(bsh + ofs, bufp, count); else { @@ -535,7 +538,7 @@ static __inline void bus_space_write_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, const uint64_t *bufp, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_write_region_io_8(bsh + ofs, bufp, count); else { @@ -555,7 +558,7 @@ static __inline void bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); while (count-- > 0) bus_space_write_1(bst, bsh, ofs, val); } @@ -564,7 +567,7 @@ static __inline void bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); while (count-- > 0) bus_space_write_2(bst, bsh, ofs, val); } @@ -573,7 +576,7 @@ static __inline void bus_space_set_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); while (count-- > 0) bus_space_write_4(bst, bsh, ofs, val); } @@ -582,7 +585,7 @@ static __inline void bus_space_set_multi_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); while (count-- > 0) bus_space_write_8(bst, bsh, ofs, val); } @@ -603,7 +606,7 @@ static __inline void bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint8_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_set_region_io_1(bsh + ofs, val, count); else { @@ -617,7 +620,7 @@ static __inline void bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint16_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_set_region_io_2(bsh + ofs, val, count); else { @@ -631,7 +634,7 @@ static __inline void bus_space_set_region_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint32_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_set_region_io_4(bsh + ofs, val, count); else { @@ -645,7 +648,7 @@ static __inline void bus_space_set_region_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs, uint64_t val, size_t count) { - + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) bus_space_set_region_io_4(bsh + ofs, val, count); else { @@ -674,6 +677,7 @@ bus_space_copy_region_1(bus_space_tag_t { uint8_t *dst, *src; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) { bus_space_copy_region_io_1(sbsh + sofs, dbsh + dofs, count); return; @@ -698,6 +702,7 @@ bus_space_copy_region_2(bus_space_tag_t { uint16_t *dst, *src; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) { bus_space_copy_region_io_2(sbsh + sofs, dbsh + dofs, count); return; @@ -722,6 +727,7 @@ bus_space_copy_region_4(bus_space_tag_t { uint32_t *dst, *src; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) { bus_space_copy_region_io_4(sbsh + sofs, dbsh + dofs, count); return; @@ -746,6 +752,7 @@ bus_space_copy_region_8(bus_space_tag_t { uint64_t *dst, *src; + KASSERT(count != 0, ("%s: count == 0", __func__)); if (__predict_false(bst == IA64_BUS_SPACE_IO)) { bus_space_copy_region_io_8(sbsh + sofs, dbsh + dofs, count); return; Modified: head/sys/mips/include/bus.h ============================================================================== --- head/sys/mips/include/bus.h Thu Dec 2 22:00:57 2010 (r216133) +++ head/sys/mips/include/bus.h Thu Dec 2 22:19:30 2010 (r216134) @@ -73,6 +73,9 @@ #ifndef _MACHINE_BUS_H_ #define _MACHINE_BUS_H_ +#include +#include + #include struct bus_space { @@ -314,21 +317,29 @@ struct bus_space { * Bus read multiple operations. */ #define bus_space_read_multi_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_1: count == 0")); \ __bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) #define bus_space_read_multi_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_2: count == 0")); \ __bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) #define bus_space_read_multi_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_4: count == 0")); \ __bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) #define bus_space_read_multi_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_8: count == 0")); \ __bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_1: count == 0")); \ __bs_nonsingle_s(rm,1,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_2: count == 0")); \ __bs_nonsingle_s(rm,2,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_4: count == 0")); \ __bs_nonsingle_s(rm,4,(t),(h),(o),(a),(c)) #define bus_space_read_multi_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_multi_stream_8: count == 0")); \ __bs_nonsingle_s(rm,8,(t),(h),(o),(a),(c)) @@ -336,21 +347,33 @@ struct bus_space { * Bus read region operations. */ #define bus_space_read_region_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_1: count == 0")); \ __bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) #define bus_space_read_region_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_2: count == 0")); \ __bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) #define bus_space_read_region_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_4: count == 0")); \ __bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) #define bus_space_read_region_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_read_region_8: count == 0")); \ __bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_read_region_stream_1: count == 0")); \ __bs_nonsingle_s(rr,1,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_read_region_stream_2: count == 0")); \ __bs_nonsingle_s(rr,2,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_read_region_stream_4: count == 0")); \ __bs_nonsingle_s(rr,4,(t),(h),(o),(a),(c)) #define bus_space_read_region_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_read_region_stream_8: count == 0")); \ __bs_nonsingle_s(rr,8,(t),(h),(o),(a),(c)) @@ -372,21 +395,33 @@ struct bus_space { * Bus write multiple operations. */ #define bus_space_write_multi_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_1: count == 0")); \ __bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) #define bus_space_write_multi_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_2: count == 0")); \ __bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) #define bus_space_write_multi_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_4: count == 0")); \ __bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) #define bus_space_write_multi_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_multi_8: count == 0")); \ __bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_multi_stream_1: count == 0")); \ __bs_nonsingle_s(wm,1,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_multi_stream_2: count == 0")); \ __bs_nonsingle_s(wm,2,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_multi_stream_4: count == 0")); \ __bs_nonsingle_s(wm,4,(t),(h),(o),(a),(c)) #define bus_space_write_multi_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_multi_stream_8: count == 0")); \ __bs_nonsingle_s(wm,8,(t),(h),(o),(a),(c)) @@ -394,34 +429,50 @@ struct bus_space { * Bus write region operations. */ #define bus_space_write_region_1(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_1: count == 0")); \ __bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) #define bus_space_write_region_2(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_2: count == 0")); \ __bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) #define bus_space_write_region_4(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_4: count == 0")); \ __bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) #define bus_space_write_region_8(t, h, o, a, c) \ + KASSERT(c != 0, ("bus_space_write_region_8: count == 0")); \ __bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_1(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_1: count == 0")); \ __bs_nonsingle_s(wr,1,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_2(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_2: count == 0")); \ __bs_nonsingle_s(wr,2,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_4(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_4: count == 0")); \ __bs_nonsingle_s(wr,4,(t),(h),(o),(a),(c)) #define bus_space_write_region_stream_8(t, h, o, a, c) \ + KASSERT(c != 0, \ + ("bus_space_write_region_stream_8: count == 0")); \ __bs_nonsingle_s(wr,8,(t),(h),(o),(a),(c)) /* * Set multiple operations. */ -#define bus_space_set_multi_1(t, h, o, v, c) \ +#define bus_space_set_multi_1(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_1: count == 0")); \ __bs_set(sm,1,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_2(t, h, o, v, c) \ +#define bus_space_set_multi_2(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_2: count == 0")); \ __bs_set(sm,2,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_4(t, h, o, v, c) \ +#define bus_space_set_multi_4(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_4: count == 0")); \ __bs_set(sm,4,(t),(h),(o),(v),(c)) -#define bus_space_set_multi_8(t, h, o, v, c) \ +#define bus_space_set_multi_8(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_multi_8: count == 0")); \ __bs_set(sm,8,(t),(h),(o),(v),(c)) @@ -429,25 +480,33 @@ struct bus_space { * Set region operations. */ #define bus_space_set_region_1(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_1: count == 0")); \ __bs_set(sr,1,(t),(h),(o),(v),(c)) #define bus_space_set_region_2(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_2: count == 0")); \ __bs_set(sr,2,(t),(h),(o),(v),(c)) #define bus_space_set_region_4(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_4: count == 0")); \ __bs_set(sr,4,(t),(h),(o),(v),(c)) #define bus_space_set_region_8(t, h, o, v, c) \ + KASSERT(c != 0, ("bus_space_set_region_8: count == 0")); \ __bs_set(sr,8,(t),(h),(o),(v),(c)) /* * Copy operations. */ -#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_1: count == 0")); \ __bs_copy(1, t, h1, o1, h2, o2, c) -#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_2: count == 0")); \ __bs_copy(2, t, h1, o1, h2, o2, c) -#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ +#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ + KASSERT(c != 0, ("bus_space_copy_region_4: count == 0")); \ __bs_copy(4, t, h1, o1, h2, o2, c) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***