svn commit: r216177 - head/lib/libgeom
Author: jh Date: Sat Dec 4 08:44:56 2010 New Revision: 216177 URL: http://svn.freebsd.org/changeset/base/216177 Log: Remove stale link. PR: 151252 Modified: head/lib/libgeom/libgeom.3 Modified: head/lib/libgeom/libgeom.3 == --- head/lib/libgeom/libgeom.3 Sat Dec 4 06:38:21 2010(r216176) +++ head/lib/libgeom/libgeom.3 Sat Dec 4 08:44:56 2010(r216177) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2010 +.Dd December 4, 2010 .Dt LIBGEOM 3 .Os .Sh NAME @@ -382,8 +382,6 @@ if (errstr != NULL) err(1, "could not destroy ccd: %s", errstr); gctl_free(H); .Ed -.Sh SEE ALSO -.Pa http://ezine.daemonnews.org/200308/blueprints.html .Sh HISTORY The .Nm geom ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
On Fri, 3 Dec 2010, Jung-uk Kim wrote: On Friday 03 December 2010 05:43 pm, Jung-uk Kim wrote: On Friday 03 December 2010 05:08 pm, John Baldwin wrote: On Friday, December 03, 2010 4:54:10 pm Jung-uk Kim wrote: Author: jkim Date: Fri Dec 3 21:54:10 2010 New Revision: 216161 URL: http://svn.freebsd.org/changeset/base/216161 Log: Explicitly initialize TSC frequency. To calibrate TSC frequency, we use DELAY(9) and it may use TSC in turn if TSC frequency is non-zero. We zero the BSS, so these were already zero. This just makes the actual kernel file on disk larger by wasting space in .data instead of .bss. Please note that I didn't touch other variables, e.g., tsc_is_broken, because I knew that. However, I just wanted to do that *explicitly*. Anyway, it is reverted now and SVN will remember what I wanted to do. ;-) BTW, if my memory serves, GCC (and all modern C compilers) put(s) zero-initialized variables back in .bss. Yes, this is just a style bug, since it doesn't even waste space :-). It still gives control over the layout, at least with gcc-3.3.3 on i386, but most places don't care about the layout. Why are you doing style bugs explicitly? :-) I just tried it. GCC generates identical binaries as I thought. However, Clang doesn't do the optimization. :-/ I get large differences even with gcc for assembler files (.zero and .p2align directives for explicit initialization -- this gives control over the layout) and small differences in .o files). BTW, at least i386 has some nonsense initialization related to this: from i386/initcpu.c: % /* Must *NOT* be BSS or locore will bzero these after setting them */ % int cpu = 0;/* Are we 386, 386sx, 486, etc? */ % u_int cpu_feature = 0;/* Feature flags */ % u_int cpu_feature2 = 0; /* Feature flags */ % u_int amd_feature = 0;/* AMD feature flags */ % u_int amd_feature2 = 0; /* AMD feature flags */ % u_int amd_pminfo = 0; /* AMD advanced power management info */ % u_int via_feature_rng = 0;/* VIA RNG features */ % u_int via_feature_xcrypt = 0; /* VIA ACE features */ % u_int cpu_high = 0; /* Highest arg to CPUID */ % u_int cpu_id = 0; /* Stepping ID */ % u_int cpu_procinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */ % u_int cpu_procinfo2 = 0; /* Multicore info */ % char cpu_vendor[20] = ""; /* CPU Origin code */ % u_int cpu_vendor_id = 0; /* CPU vendor ID */ % u_int cpu_clflush_line_size = 32; But all of these except the ones initialized to nonzero ARE in the BSS. The comment is wrong because locore does the bzeroing as early as possible so as to avoid this problem. It has done the bss bzeroing early enough since at least RELENG_3, and probably always in FreeBSD. Perhaps there was a problem with bzeroing NOT related to the bss (for page tables?), but it doesn't seem to be a problem now. The comment was added in 2001 not long before gcc invalidated it. BSS. These declarations also have many comments that do less than echo the variable names. ISTR than there are a few variables in locore that should be declared here but aren't, since they were put in locore for some bad reason. bootinfo may be one. Now, only the PC98 pc98_system_parameter variable seems to be written to by locore before the bzero. After fixing this, only easier control over the layout justifies locore allocating any non-static variable. I fixed the comment and removed the explicit initializations long ago. and haven't noticed any problems: % Index: initcpu.c % === % RCS file: /home/ncvs/src/sys/i386/i386/initcpu.c,v % retrieving revision 1.49 % diff -u -2 -r1.49 initcpu.c % --- initcpu.c 10 Nov 2003 15:48:30 - 1.49 % +++ initcpu.c 11 Nov 2003 08:07:01 - % @@ -77,15 +77,13 @@ % &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU"); % % -/* Must *NOT* be BSS or locore will bzero these after setting them */ % -int cpu = 0;/* Are we 386, 386sx, 486, etc? */ % -u_intcpu_feature = 0;/* Feature flags */ % -u_intcpu_high = 0; /* Highest arg to CPUID */ % -u_intcpu_id = 0; /* Stepping ID */ % -u_intcpu_procinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */ % -char cpu_vendor[20] = ""; /* CPU Origin code */ % - % +int cpu;/* Are we 386, 386sx, 486, etc? */ % +u_intcpu_feature;/* Feature flags */ % #ifdef CPU_ENABLE_SSE % u_intcpu_fxsr; /* SSE enabled */ % #endif % +u_intcpu_high; /* Highest arg to CPUID */ % +u_intcpu_id; /* Stepping ID */ % +u_intcpu_procinfo; /* HyperThreading Info / Brand Index / CLFUSH */ % +char cpu_vendor[20]; /* CPU Origin code */ % % #ifdef I486_CPU This fixes some style bugs (unsorted declarations) but not the comments
Re: svn commit: r216143 - 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/sun4
On Fri, 3 Dec 2010, Eygene Ryabinkin wrote: Sat, Dec 04, 2010 at 05:01:55AM +1100, Bruce Evans wrote: On Fri, 3 Dec 2010, Bruce Cran wrote: Log: Revert r216134. This checkin broke platforms where bus_space are macros: they need to be a single statement, and do { } while (0) doesn't work in this situation so revert until a solution can be devised. Surprising that do-while doesn't work. Prior to the revert, something like "a = bus_space_read_multi_1(...)" will generate improper code like "a = KASSERT(); __bs_nonsigle(XXX);" and making "do { KASSERT(); __bs_nonsingle(XXX); } while(0)" won't help either, since we can't generally assign the compound statement to the lvalue. Ah, the functions actually return something :-). I just noticed the following possibly more serious problems for the macro versions: - the `c' arg is missing parentheses in the KASSERT() - the `c' arg is now evaluated twice. This turns safe macros into unsafe ones. Perhaps we can define the macros as {{{ #define bus_space_read_multi_1(t, h, o, a, c) ({\ size_t count = (c); \ KASSERT(count != 0, ("bus_space_read_multi_1: count == 0")); \ __bs_nonsingle(rm,1,(t),(h),(o),(a),count); \ }) }}} This will both allow to avoid unsafety and will make this statement to be the correct assignment for any compiler that supports the "braced-groups within expressions" GNU extension. GNU C, Clang and Intel C both support it (but not with -pedantic -ansi -Werror flag combo). This is why amd64 and i386 use __extension when they use statement-expressions. grep in -current shows 32 .h files under /sys matching "({", and only 7 of these files use __extension. It is mostly headers visible in userland that are careful. sparc64 and sun4v atomic.h seem to be the only headers that both use ({ and are used in userland. For .c files, statement-expressions are remarkably little-used -- there are more line 32 lines total matching "({", and 0 lines matching "__extension". But, probably, the inline function will be better here from the portability point of view, since it is supported by the C standard and braced-groups -- aren't. So, the question is "why these statements were made to be macros at some platforms?". I guess it is just because they seemed to be simple enough to be macros. Macros and inline have different technical advantages but I don't see any important ones here. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216178 - in head: bin/csh/USD.doc lib/libc/rpc/PSD.doc sbin/fsck_ffs/SMM.doc share/doc/psd/12.make share/doc/psd/18.gprof share/doc/psd/22.rpcgen share/doc/psd/23.rpc share/doc/psd/24....
Author: uqs Date: Sat Dec 4 10:11:20 2010 New Revision: 216178 URL: http://svn.freebsd.org/changeset/base/216178 Log: Move most of the remaining USD/PSD/SMM papers into share/doc Added: head/share/doc/psd/12.make/stubs - copied unchanged from r216131, head/usr.bin/make/PSD.doc/stubs head/share/doc/psd/12.make/tutorial.ms - copied unchanged from r216131, head/usr.bin/make/PSD.doc/tutorial.ms head/share/doc/psd/18.gprof/abstract.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/abstract.me head/share/doc/psd/18.gprof/gathering.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/gathering.me head/share/doc/psd/18.gprof/header.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/header.me head/share/doc/psd/18.gprof/intro.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/intro.me head/share/doc/psd/18.gprof/postp.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/postp.me head/share/doc/psd/18.gprof/postp1.pic - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/postp1.pic head/share/doc/psd/18.gprof/postp2.pic - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/postp2.pic head/share/doc/psd/18.gprof/postp3.pic - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/postp3.pic head/share/doc/psd/18.gprof/pres1.pic - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/pres1.pic head/share/doc/psd/18.gprof/pres2.pic - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/pres2.pic head/share/doc/psd/18.gprof/present.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/present.me head/share/doc/psd/18.gprof/profiling.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/profiling.me head/share/doc/psd/18.gprof/refs.me - copied unchanged from r216131, head/usr.bin/gprof/PSD.doc/refs.me head/share/doc/psd/22.rpcgen/rpcgen.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/rpcgen.ms head/share/doc/psd/22.rpcgen/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/psd/23.rpc/rpc.prog.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/rpc.prog.ms head/share/doc/psd/23.rpc/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/psd/24.xdr/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/psd/24.xdr/xdr.nts.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/xdr.nts.ms head/share/doc/psd/25.xdrrfc/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/psd/25.xdrrfc/xdr.rfc.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/xdr.rfc.ms head/share/doc/psd/26.rpcrfc/rpc.rfc.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/rpc.rfc.ms head/share/doc/psd/26.rpcrfc/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/psd/27.nfsrpc/nfs.rfc.ms - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/nfs.rfc.ms head/share/doc/psd/27.nfsrpc/stubs - copied unchanged from r216131, head/lib/libc/rpc/PSD.doc/stubs head/share/doc/smm/02.config/0.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/0.t head/share/doc/smm/02.config/1.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/1.t head/share/doc/smm/02.config/2.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/2.t head/share/doc/smm/02.config/3.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/3.t head/share/doc/smm/02.config/4.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/4.t head/share/doc/smm/02.config/5.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/5.t head/share/doc/smm/02.config/6.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/6.t head/share/doc/smm/02.config/a.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/a.t head/share/doc/smm/02.config/b.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/b.t head/share/doc/smm/02.config/c.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/c.t head/share/doc/smm/02.config/d.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/d.t head/share/doc/smm/02.config/e.t - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/e.t head/share/doc/smm/02.config/spell.ok - copied unchanged from r216131, head/usr.sbin/config/SMM.doc/spell.ok head/share/doc/smm/03.fsck/0.t - copied unchanged from r216131, head/sbin/fsck_ffs/SMM.doc/0.t head/share/doc/smm/03.fsck/1.t - copied unchanged from r216131, head/sbin/fsck_ffs/SMM.doc/1.t head/share/doc/smm/03.fsck/2.t - copied unchanged from r216131, head/sbin/fsck_ffs/SMM.doc/2.t head/share/doc/smm/03.fsck/3.t - copied un
Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
On Sat, Dec 04, 2010 at 11:36:25AM +0100, Roman Divacky wrote: > On Fri, Dec 03, 2010 at 06:17:16PM -0500, Jung-uk Kim wrote: > > On Friday 03 December 2010 06:02 pm, Jung-uk Kim wrote: > > > On Friday 03 December 2010 05:43 pm, Jung-uk Kim wrote: > > > > On Friday 03 December 2010 05:08 pm, John Baldwin wrote: > > > > > On Friday, December 03, 2010 4:54:10 pm Jung-uk Kim wrote: > > > > > > Author: jkim > > > > > > Date: Fri Dec 3 21:54:10 2010 > > > > > > New Revision: 216161 > > > > > > URL: http://svn.freebsd.org/changeset/base/216161 > > > > > > > > > > > > Log: > > > > > > Explicitly initialize TSC frequency. To calibrate TSC > > > > > > frequency, we use DELAY(9) and it may use TSC in turn if TSC > > > > > > frequency is non-zero. > > > > > > > > > > We zero the BSS, so these were already zero. This just makes > > > > > the actual kernel file on disk larger by wasting space in .data > > > > > instead of .bss. > > > > > > > > Please note that I didn't touch other variables, e.g., > > > > tsc_is_broken, because I knew that. However, I just wanted to do > > > > that *explicitly*. Anyway, it is reverted now and SVN will > > > > remember what I wanted to do. ;-) > > > > > > > > BTW, if my memory serves, GCC (and all modern C compilers) put(s) > > > > zero-initialized variables back in .bss. > > > > > > I just tried it. GCC generates identical binaries as I thought. > > > However, Clang doesn't do the optimization. :-/ > > > > Strangely, Clang increases .bss when a global variable is explicitly > > initialized to zero. > > > > - 2 .bss 0004 0540 2**2 > > + 2 .bss 0014 0540 2**3 > > in my naive test gcc produces: > > .globl foo > .section.bss > .align 4 > .type foo, @object > .size foo, 4 > foo: > .zero 4 > > > and clang produces: > > .type foo,@object # @foo > .bss > .globl foo > .align 4 > foo: > .long 0 # 0x0 > .size foo, 4 > > ie. both put them into BSS I have no idea how and where your gcc is configured, in particular, I find the non-documenting directive .zero somewhat puzzling. Behaviour of clang looks like a plain bug, since initialized objects must be put into the .data section, not into .bss. Both gcc 4.2.1/FreeBSD and plain 4.5.1 produce .comm foo,4,4 when compiling the file consisting of long foo; line. For amd64, substitute 4 by 8. pgpGiDXShPwwb.pgp Description: PGP signature
Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
On Fri, Dec 03, 2010 at 06:17:16PM -0500, Jung-uk Kim wrote: > On Friday 03 December 2010 06:02 pm, Jung-uk Kim wrote: > > On Friday 03 December 2010 05:43 pm, Jung-uk Kim wrote: > > > On Friday 03 December 2010 05:08 pm, John Baldwin wrote: > > > > On Friday, December 03, 2010 4:54:10 pm Jung-uk Kim wrote: > > > > > Author: jkim > > > > > Date: Fri Dec 3 21:54:10 2010 > > > > > New Revision: 216161 > > > > > URL: http://svn.freebsd.org/changeset/base/216161 > > > > > > > > > > Log: > > > > > Explicitly initialize TSC frequency. To calibrate TSC > > > > > frequency, we use DELAY(9) and it may use TSC in turn if TSC > > > > > frequency is non-zero. > > > > > > > > We zero the BSS, so these were already zero. This just makes > > > > the actual kernel file on disk larger by wasting space in .data > > > > instead of .bss. > > > > > > Please note that I didn't touch other variables, e.g., > > > tsc_is_broken, because I knew that. However, I just wanted to do > > > that *explicitly*. Anyway, it is reverted now and SVN will > > > remember what I wanted to do. ;-) > > > > > > BTW, if my memory serves, GCC (and all modern C compilers) put(s) > > > zero-initialized variables back in .bss. > > > > I just tried it. GCC generates identical binaries as I thought. > > However, Clang doesn't do the optimization. :-/ > > Strangely, Clang increases .bss when a global variable is explicitly > initialized to zero. > > - 2 .bss 0004 0540 2**2 > + 2 .bss 0014 0540 2**3 in my naive test gcc produces: .globl foo .section.bss .align 4 .type foo, @object .size foo, 4 foo: .zero 4 and clang produces: .type foo,@object # @foo .bss .globl foo .align 4 foo: .long 0 # 0x0 .size foo, 4 ie. both put them into BSS ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216179 - in head: . tools/build/mk
Author: uqs Date: Sat Dec 4 11:40:40 2010 New Revision: 216179 URL: http://svn.freebsd.org/changeset/base/216179 Log: Document two more ways to find duplicates in the obsolete file list. Remove the only duplicate found by the optional files check. Fix typos, while here. Suggested by: netchild Modified: head/ObsoleteFiles.inc head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Sat Dec 4 10:11:20 2010(r216178) +++ head/ObsoleteFiles.inc Sat Dec 4 11:40:40 2010(r216179) @@ -22,16 +22,31 @@ # grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \ # sort | uniq -d # +# To find regular duplicates not dependant on optional components, you can +# also use something that will not give you false positives, e.g.: +# for t in `make -V TARGETS universe`; do +# __MAKE_CONF=/dev/null make -f Makefile.inc1 TARGET=$t \ +# -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \ +# xargs -n1 | sort | uniq -d; +# done +# +# For optional components, you can use the following to see if some entries +# in OptionalObsoleteFiles.inc have been obsoleted by ObsoleteFiles.inc +# for o in tools/build/options/WITH*; do +# __MAKE_CONF=/dev/null make -f Makefile.inc1 -D${o##*/} \ +# -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \ +# xargs -n1 | sort | uniq -d; +# done # 20101112: vgonel(9) has gone to private API a while ago OLD_FILES+=usr/share/man/man9/vgonel.9.gz # 20101112: removed gasp.info OLD_FILES+=usr/share/info/gasp.info.gz -# 20101109: headers moved to machine/ to x86/ +# 20101109: headers moved from machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/mptable.h .endif -# 20101101: headers moved to machine/ to x86/ +# 20101101: headers moved from machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/apicreg.h OLD_FILES+=usr/include/machine/mca.h Modified: head/tools/build/mk/OptionalObsoleteFiles.inc == --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 4 10:11:20 2010(r216178) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 4 11:40:40 2010(r216179) @@ -1869,7 +1869,6 @@ OLD_FILES+=usr/lib/libfl_p.a OLD_FILES+=usr/lib/libform_p.a OLD_FILES+=usr/lib/libformw_p.a OLD_FILES+=usr/lib/libftpio_p.a -OLD_FILES+=usr/lib/libg2c_p.a OLD_FILES+=usr/lib/libgcc_p.a OLD_FILES+=usr/lib/libgeom_p.a OLD_FILES+=usr/lib/libgnuregex_p.a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
On Sat, 4 Dec 2010, Kostik Belousov wrote: On Sat, Dec 04, 2010 at 11:36:25AM +0100, Roman Divacky wrote: On Fri, Dec 03, 2010 at 06:17:16PM -0500, Jung-uk Kim wrote: ... I just tried it. GCC generates identical binaries as I thought. However, Clang doesn't do the optimization. :-/ Strangely, Clang increases .bss when a global variable is explicitly initialized to zero. - 2 .bss 0004 0540 2**2 + 2 .bss 0014 0540 2**3 in my naive test gcc produces: .globl foo .section.bss .align 4 .type foo, @object .size foo, 4 foo: .zero 4 and clang produces: .type foo,@object # @foo .bss .globl foo .align 4 foo: .long 0 # 0x0 .size foo, 4 ie. both put them into BSS I have no idea how and where your gcc is configured, in particular, I find the non-documenting directive .zero somewhat puzzling. All of gcc-3.3.3 on i386 on my local system, and gcc-4.2.1 on amd64 and i386 on FreeBSD cluseter machines produce the .zero, and either the .align or the .p2align. I think '.zero 4' is just a spelling of '.long 0' if longs have size 4. Not clear why the clang asm generates a different object. Behaviour of clang looks like a plain bug, since initialized objects must be put into the .data section, not into .bss. Note that gcc does this too in the above. The above is for explicitly initialized (to 0) objects. Such objects can be put in the bss just as validly as implicitly initialized (to 0) ones. Both gcc 4.2.1/FreeBSD and plain 4.5.1 produce .comm foo,4,4 when compiling the file consisting of long foo; line. For amd64, substitute 4 by 8. Now the initialization is implicit. I guess the difference is to preserve the possibility of laying out the objects using explicit initialization. Hmm, this only works if they are all explicitly initialized to 0 -- others cannot remain adjacent since they musyt be moved to put them in the data section. Of course, C doesn't require anything for the layout. ABIs might, but I don't know of any other than defacto ones. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r216161 - in head/sys: amd64/amd64 i386/i386
On 2010-12-04 11:52, Kostik Belousov wrote: ... I have no idea how and where your gcc is configured, in particular, I find the non-documenting directive .zero somewhat puzzling. According to the gas sources (see contrib/binutils/gas/read.c, line 412), .zero is equivalent to .skip, which itself is equivalent to .space, except for HPPA targets. Behaviour of clang looks like a plain bug, since initialized objects must be put into the .data section, not into .bss. I think the only requirement is that the object is initialized at runtime with the value you specified at compile time. If you specify zero, it is simply an optimization to put it in BSS (which is really just an implementation detail). There is even a gcc flag to control this behaviour: -fno-zero-initialized-in-bss If the target supports a BSS section, GCC by default puts variables that are initialized to zero into BSS. This can save space in the resulting code. This option turns off this behavior because some programs explicitly rely on variables going to the data section. E.g., so that the resulting executable can find the beginning of that section and/or make assumptions based on that. The default is -fzero-initialized-in-bss. Clang also supports this flag, and its default setting is the same as gcc's. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216184 - in head: contrib/traceroute usr.sbin/traceroute
Author: uqs Date: Sat Dec 4 14:19:27 2010 New Revision: 216184 URL: http://svn.freebsd.org/changeset/base/216184 Log: traceroute(8): make WARNS=3 clean Also fixes an operator precedence bug for TCP tracerouting Modified: head/contrib/traceroute/as.c head/contrib/traceroute/as.h head/contrib/traceroute/ifaddrlist.c head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute/Makefile Modified: head/contrib/traceroute/as.c == --- head/contrib/traceroute/as.cSat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/as.cSat Dec 4 14:19:27 2010 (r216184) @@ -56,13 +56,14 @@ struct aslookup { }; void * -as_setup(char *server) +as_setup(const char *server) { struct aslookup *asn; struct addrinfo hints, *res0, *res; FILE *f; int s, error; + s = -1; if (server == NULL) server = getenv("RA_SERVER"); if (server == NULL) Modified: head/contrib/traceroute/as.h == --- head/contrib/traceroute/as.hSat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/as.hSat Dec 4 14:19:27 2010 (r216184) @@ -30,6 +30,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup(char *); +void *as_setup(const char *); unsigned int as_lookup(void *, char *, sa_family_t); void as_shutdown(void *); Modified: head/contrib/traceroute/ifaddrlist.c == --- head/contrib/traceroute/ifaddrlist.cSat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/ifaddrlist.cSat Dec 4 14:19:27 2010 (r216184) @@ -71,14 +71,14 @@ ifaddrlist(register struct ifaddrlist ** { register int fd, nipaddr; #ifdef HAVE_SOCKADDR_SA_LEN - register int n; + size_t n; #endif register struct ifreq *ifrp, *ifend, *ifnext, *mp; register struct sockaddr_in *sin; register struct ifaddrlist *al; struct ifconf ifc; struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr; -#define MAX_IPADDR (sizeof(ibuf) / sizeof(ibuf[0])) +#define MAX_IPADDR ((int)(sizeof(ibuf) / sizeof(ibuf[0]))) static struct ifaddrlist ifaddrlist[MAX_IPADDR]; char device[sizeof(ifr.ifr_name) + 1]; @@ -91,10 +91,10 @@ ifaddrlist(register struct ifaddrlist ** ifc.ifc_buf = (caddr_t)ibuf; if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 || - ifc.ifc_len < sizeof(struct ifreq)) { + ifc.ifc_len < (int)sizeof(struct ifreq)) { if (errno == EINVAL) (void)sprintf(errbuf, - "SIOCGIFCONF: ifreq struct too small (%d bytes)", + "SIOCGIFCONF: ifreq struct too small (%zu bytes)", sizeof(ibuf)); else (void)sprintf(errbuf, "SIOCGIFCONF: %s", Modified: head/contrib/traceroute/traceroute.c == --- head/contrib/traceroute/traceroute.cSat Dec 4 13:06:41 2010 (r216183) +++ head/contrib/traceroute/traceroute.cSat Dec 4 14:19:27 2010 (r216184) @@ -220,7 +220,6 @@ static const char rcsid[] = #include #include #include -#include #include #include @@ -1424,7 +1423,7 @@ tcp_check(const u_char *data, int seq) return (ntohs(tcp->th_sport) == ident && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq)) - && tcp->th_seq == (ident << 16) | (port + seq); + && tcp->th_seq == (((tcp_seq)ident << 16) | (port + seq)); } void @@ -1497,19 +1496,17 @@ u_short p_cksum(struct ip *ip, u_short *data, int len) { static struct ipovly ipo; - u_short sumh, sumd; - u_long sumt; + u_short sum[2]; ipo.ih_pr = ip->ip_p; ipo.ih_len = htons(len); ipo.ih_src = ip->ip_src; ipo.ih_dst = ip->ip_dst; - sumh = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */ - sumd = in_cksum((u_short*)data, len); /* payload data cksum */ - sumt = (sumh << 16) | (sumd); + sum[1] = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */ + sum[0] = in_cksum(data, len); /* payload data cksum */ - return ~in_cksum((u_short*)&sumt, sizeof(sumt)); + return ~in_cksum(sum, sizeof(sum)); } /* Modified: head/usr.sbin/traceroute/Makefile == --- head/usr.sbin/traceroute/Makefile Sat Dec 4 13:06:41 2010 (r216183) +++ head/usr.sbin/traceroute/Makefile Sat Dec 4 14:19:27 2010 (r216184) @@ -31,7 +31,7 @@ LDADD=-lipsec CFLAGS+= -I${TRACEROUTE_DISTDIR} -WARN
svn commit: r216185 - head/usr.sbin/traceroute6
Author: uqs Date: Sat Dec 4 14:19:35 2010 New Revision: 216185 URL: http://svn.freebsd.org/changeset/base/216185 Log: traceroute6(8): make WARNS=3 clean Modified: head/usr.sbin/traceroute6/Makefile head/usr.sbin/traceroute6/traceroute6.c Modified: head/usr.sbin/traceroute6/Makefile == --- head/usr.sbin/traceroute6/Makefile Sat Dec 4 14:19:27 2010 (r216184) +++ head/usr.sbin/traceroute6/Makefile Sat Dec 4 14:19:35 2010 (r216185) @@ -25,7 +25,7 @@ BINMODE= 4555 CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. -WARNS?=1 +WARNS?=3 DPADD= ${LIBIPSEC} LDADD= -lipsec Modified: head/usr.sbin/traceroute6/traceroute6.c == --- head/usr.sbin/traceroute6/traceroute6.c Sat Dec 4 14:19:27 2010 (r216184) +++ head/usr.sbin/traceroute6/traceroute6.c Sat Dec 4 14:19:35 2010 (r216185) @@ -66,7 +66,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -322,7 +322,7 @@ voidsend_probe(int, u_long); void *get_uphdr(struct ip6_hdr *, u_char *); intget_hoplim(struct msghdr *); double deltaT(struct timeval *, struct timeval *); -char *pr_type(int); +const char *pr_type(int); intpacket_ok(struct msghdr *, int, int); void print(struct msghdr *, int); const char *inetname(struct sockaddr *); @@ -372,12 +372,12 @@ main(argc, argv) { int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; - int ch, i, on = 1, seq, rcvcmsglen, error, minlen; + int ch, i, on = 1, seq, rcvcmsglen, error; struct addrinfo hints, *res; static u_char *rcvcmsgbuf; u_long probe, hops, lport; struct hostent *hp; - size_t size; + size_t size, minlen; uid_t uid; /* @@ -671,11 +671,11 @@ main(argc, argv) datalen = minlen; else if (datalen >= MAXPACKET) { fprintf(stderr, - "traceroute6: packet size must be %d <= s < %ld.\n", - minlen, (long)MAXPACKET); + "traceroute6: packet size must be %zu <= s < %d.\n", + minlen, MAXPACKET); exit(1); } - outpacket = (struct opacket *)malloc((unsigned)datalen); + outpacket = malloc(datalen); if (!outpacket) { perror("malloc"); exit(1); @@ -913,7 +913,7 @@ main(argc, argv) for (hops = first_hop; hops <= max_hops; ++hops) { struct in6_addr lastaddr; int got_there = 0; - int unreachable = 0; + unsigned unreachable = 0; printf("%2lu ", hops); bzero(&lastaddr, sizeof(lastaddr)); @@ -1089,7 +1089,7 @@ send_probe(seq, hops) i = sendto(sndsock, (char *)outpacket, datalen, 0, (struct sockaddr *)&Dst, Dst.sin6_len); - if (i < 0 || i != datalen) { + if (i < 0 || (u_long)i != datalen) { if (i < 0) perror("sendto"); printf("traceroute6: wrote %s %lu chars, ret=%d\n", @@ -1129,12 +1129,11 @@ deltaT(t1p, t2p) /* * Convert an ICMP "type" field to a printable string. */ -char * -pr_type(t0) - int t0; +const char * +pr_type(int t0) { u_char t = t0 & 0xff; - char *cp; + const char *cp; switch (t) { case ICMP6_DST_UNREACH: @@ -1221,7 +1220,7 @@ packet_ok(mhdr, cc, seq) cc -= hlen; icp = (struct icmp6_hdr *)(buf + hlen); #else - if (cc < sizeof(struct icmp6_hdr)) { + if (cc < (int)sizeof(struct icmp6_hdr)) { if (verbose) { if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216186 - head/sys/vm
Author: trasz Date: Sat Dec 4 17:41:58 2010 New Revision: 216186 URL: http://svn.freebsd.org/changeset/base/216186 Log: Fix comment intentation. Modified: head/sys/vm/vm_mmap.c Modified: head/sys/vm/vm_mmap.c == --- head/sys/vm/vm_mmap.c Sat Dec 4 14:19:35 2010(r216185) +++ head/sys/vm/vm_mmap.c Sat Dec 4 17:41:58 2010(r216186) @@ -276,14 +276,14 @@ mmap(td, uap) if (addr + size < addr) return (EINVAL); } else { - /* -* XXX for non-fixed mappings where no hint is provided or -* the hint would fall in the potential heap space, -* place it after the end of the largest possible heap. -* -* There should really be a pmap call to determine a reasonable -* location. -*/ + /* +* XXX for non-fixed mappings where no hint is provided or +* the hint would fall in the potential heap space, +* place it after the end of the largest possible heap. +* +* There should really be a pmap call to determine a reasonable +* location. +*/ PROC_LOCK(td->td_proc); if (addr == 0 || (addr >= round_page((vm_offset_t)vms->vm_taddr) && ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216187 - head
Author: dougb Date: Sat Dec 4 18:52:05 2010 New Revision: 216187 URL: http://svn.freebsd.org/changeset/base/216187 Log: Add MAKEDEV.8 Submitted by: Alex Kozlov Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Sat Dec 4 17:41:58 2010(r216186) +++ head/ObsoleteFiles.inc Sat Dec 4 18:52:05 2010(r216187) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20101114: Remove long-obsolete MAKEDEV.8 +OLD_FILES+=usr/share/man/man8/MAKEDEV.8.gz # 20101112: vgonel(9) has gone to private API a while ago OLD_FILES+=usr/share/man/man9/vgonel.9.gz # 20101112: removed gasp.info ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216188 - head/sys/netinet
Author: tuexen Date: Sat Dec 4 19:29:49 2010 New Revision: 216188 URL: http://svn.freebsd.org/changeset/base/216188 Log: Fix a bug where also the number of non-renegable gap reports was considered to be potentially renegable. MFC after: 1 day. Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Sat Dec 4 18:52:05 2010 (r216187) +++ head/sys/netinet/sctp_indata.c Sat Dec 4 19:29:49 2010 (r216188) @@ -3081,14 +3081,17 @@ sctp_handle_segments(struct mbuf *m, int int num_frs = 0; int chunk_freed; int non_revocable; - uint16_t frag_strt, frag_end; - uint32_t last_frag_high; + uint16_t frag_strt, frag_end, prev_frag_end; - tp1 = NULL; - last_frag_high = 0; + tp1 = TAILQ_FIRST(&asoc->sent_queue); + prev_frag_end = 0; chunk_freed = 0; for (i = 0; i < (num_seg + num_nr_seg); i++) { + if (i == num_seg) { + prev_frag_end = 0; + tp1 = TAILQ_FIRST(&asoc->sent_queue); + } frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset, sizeof(struct sctp_gap_ack_block), (uint8_t *) & block); *offset += sizeof(block); @@ -3097,58 +3100,29 @@ sctp_handle_segments(struct mbuf *m, int } frag_strt = ntohs(frag->start); frag_end = ntohs(frag->end); - /* some sanity checks on the fragment offsets */ + if (frag_strt > frag_end) { - /* this one is malformed, skip */ + /* This gap report is malformed, skip it. */ continue; } - if (compare_with_wrap((frag_end + last_tsn), *biggest_tsn_acked, - MAX_TSN)) - *biggest_tsn_acked = frag_end + last_tsn; - - /* mark acked dgs and find out the highestTSN being acked */ - if (tp1 == NULL) { + if (frag_strt <= prev_frag_end) { + /* This gap report is not in order, so restart. */ tp1 = TAILQ_FIRST(&asoc->sent_queue); - /* save the locations of the last frags */ - last_frag_high = frag_end + last_tsn; - } else { - /* -* now lets see if we need to reset the queue due to -* a out-of-order SACK fragment -*/ - if (compare_with_wrap(frag_strt + last_tsn, - last_frag_high, MAX_TSN)) { - /* -* if the new frag starts after the last TSN -* frag covered, we are ok and this one is -* beyond the last one -*/ - ; - } else { - /* -* ok, they have reset us, so we need to -* reset the queue this will cause extra -* hunting but hey, they chose the -* performance hit when they failed to order -* their gaps -*/ - tp1 = TAILQ_FIRST(&asoc->sent_queue); - } - last_frag_high = frag_end + last_tsn; + } + if (compare_with_wrap((last_tsn + frag_end), *biggest_tsn_acked, MAX_TSN)) { + *biggest_tsn_acked = last_tsn + frag_end; } if (i < num_seg) { non_revocable = 0; } else { non_revocable = 1; } - if (i == num_seg) { - tp1 = NULL; - } if (sctp_process_segment_range(stcb, &tp1, last_tsn, frag_strt, frag_end, non_revocable, &num_frs, biggest_newly_acked_tsn, this_sack_lowest_newack, ecn_seg_sums)) { chunk_freed = 1; } + prev_frag_end = frag_end; } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { if (num_frs) @@ -4817,7 +4791,7 @@ sctp_handle_sack(struct mbuf *m, int off } } // - /* drop the acked chunks from the sendqueue */ + /* drop the acked chunks from the sentqueue */ //
svn commit: r216189 - head/usr.sbin/usbdevs
Author: uqs Date: Sat Dec 4 21:54:23 2010 New Revision: 216189 URL: http://svn.freebsd.org/changeset/base/216189 Log: De-orbit usbdevs(8) which hasn't worked with the new USB stack for a long time now. usbconfig(8) should be an adequate replacement. Deleted: head/usr.sbin/usbdevs/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216190 - head/sys/i386/i386
Author: cperciva Date: Sat Dec 4 23:24:35 2010 New Revision: 216190 URL: http://svn.freebsd.org/changeset/base/216190 Log: Remove unnecessary #includes which seem to have been accidentally added as part of CVS r1.76 (in January 2006). Modified: head/sys/i386/i386/busdma_machdep.c Modified: head/sys/i386/i386/busdma_machdep.c == --- head/sys/i386/i386/busdma_machdep.c Sat Dec 4 21:54:23 2010 (r216189) +++ head/sys/i386/i386/busdma_machdep.c Sat Dec 4 23:24:35 2010 (r216190) @@ -28,9 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include #include #include #include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216191 - head/sys/i386/i386
Author: cperciva Date: Sat Dec 4 23:36:40 2010 New Revision: 216191 URL: http://svn.freebsd.org/changeset/base/216191 Log: Remove gratuitous i386/amd64 inconsistency in favour of the less verbose version of declaring a variable initialized to zero. Modified: head/sys/i386/i386/busdma_machdep.c Modified: head/sys/i386/i386/busdma_machdep.c == --- head/sys/i386/i386/busdma_machdep.c Sat Dec 4 23:24:35 2010 (r216190) +++ head/sys/i386/i386/busdma_machdep.c Sat Dec 4 23:36:40 2010 (r216191) @@ -858,7 +858,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_callback2_t *callback, void *callback_arg, int flags) { - bus_addr_t lastaddr; + bus_addr_t lastaddr = 0; int nsegs, error, first, i; bus_size_t resid; struct iovec *iov; @@ -878,7 +878,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, nsegs = 0; error = 0; first = 1; - lastaddr = (bus_addr_t) 0; for (i = 0; i < uio->uio_iovcnt && resid != 0 && !error; i++) { /* * Now at the first iovec to load. Load each iovec ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216192 - head/sys/netinet
Author: bz Date: Sun Dec 5 01:09:48 2010 New Revision: 216192 URL: http://svn.freebsd.org/changeset/base/216192 Log: Use correct field to track statistics counting error as bad header length. This assimilates the code to what ip_input has been doing since r1.1 in this case. Submitted by: Rozhuk Ivan (rozhuk.im gmail.com) MFC after:4 days Modified: head/sys/netinet/ip_fastfwd.c Modified: head/sys/netinet/ip_fastfwd.c == --- head/sys/netinet/ip_fastfwd.c Sat Dec 4 23:36:40 2010 (r216191) +++ head/sys/netinet/ip_fastfwd.c Sun Dec 5 01:09:48 2010 (r216192) @@ -218,7 +218,7 @@ ip_fastforward(struct mbuf *m) */ hlen = ip->ip_hl << 2; if (hlen < sizeof(struct ip)) { /* minimum header length */ - IPSTAT_INC(ips_badlen); + IPSTAT_INC(ips_badhlen); goto drop; } if (hlen > m->m_len) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216193 - head/sys/powerpc/include
Author: nwhitehorn Date: Sun Dec 5 01:17:53 2010 New Revision: 216193 URL: http://svn.freebsd.org/changeset/base/216193 Log: Switch which software-reserved bit is used to designate a locked PTE to correspond to the definition used by the PAPR spec so that its PTE insertion algorithm will properly respect it. Modified: head/sys/powerpc/include/pte.h Modified: head/sys/powerpc/include/pte.h == --- head/sys/powerpc/include/pte.h Sun Dec 5 01:09:48 2010 (r216192) +++ head/sys/powerpc/include/pte.h Sun Dec 5 01:17:53 2010 (r216193) @@ -95,8 +95,8 @@ struct lpteg { /* High quadword: */ #define LPTE_VSID_SHIFT12 #define LPTE_API 0x0F80ULL -#define LPTE_WIRED 0x0010ULL -#define LPTE_LOCKED0x0008ULL +#define LPTE_LOCKED0x0040ULL +#define LPTE_WIRED 0x0008ULL #define LPTE_BIG 0x0004ULL /* 4kb/16Mb page */ #define LPTE_HID 0x0002ULL #define LPTE_VALID 0x0001ULL ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r216194 - head/sys/i386/i386
Author: cperciva Date: Sun Dec 5 03:20:55 2010 New Revision: 216194 URL: http://svn.freebsd.org/changeset/base/216194 Log: MFamd64 r204214: Enforce stronger alignment semantics (require that the end of segments be aligned, not just the start of segments) in order to allow Xen's blkfront driver to operate correctly. PR: kern/152818 MFC after:3 days Modified: head/sys/i386/i386/busdma_machdep.c Modified: head/sys/i386/i386/busdma_machdep.c == --- head/sys/i386/i386/busdma_machdep.c Sun Dec 5 01:17:53 2010 (r216193) +++ head/sys/i386/i386/busdma_machdep.c Sun Dec 5 03:20:55 2010 (r216194) @@ -246,8 +246,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->alignment = alignment; newtag->boundary = boundary; newtag->lowaddr = trunc_page((vm_paddr_t)lowaddr) + (PAGE_SIZE - 1); - newtag->highaddr = trunc_page((vm_paddr_t)highaddr) + - (PAGE_SIZE - 1); + newtag->highaddr = trunc_page((vm_paddr_t)highaddr) + (PAGE_SIZE - 1); newtag->filter = filter; newtag->filterarg = filterarg; newtag->maxsize = maxsize; @@ -594,15 +593,19 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm vendaddr = (vm_offset_t)buf + buflen; while (vaddr < vendaddr) { + bus_size_t sg_len; + + sg_len = PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK); if (pmap) paddr = pmap_extract(pmap, vaddr); else paddr = pmap_kextract(vaddr); if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) && run_filter(dmat, paddr) != 0) { + sg_len = roundup2(sg_len, dmat->alignment); map->pagesneeded++; } - vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); + vaddr += sg_len; } CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); } @@ -669,6 +672,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm bmask = ~(dmat->boundary - 1); for (seg = *segp; buflen > 0 ; ) { + bus_size_t max_sgsize; + /* * Get the physical address for this segment. */ @@ -680,11 +685,16 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm /* * Compute the segment size, and adjust counts. */ - sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); - if (sgsize > dmat->maxsegsz) - sgsize = dmat->maxsegsz; - if (buflen < sgsize) - sgsize = buflen; + max_sgsize = MIN(buflen, dmat->maxsegsz); + sgsize = PAGE_SIZE - ((vm_offset_t)curaddr & PAGE_MASK); + if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) && + map->pagesneeded != 0 && run_filter(dmat, curaddr)) { + sgsize = roundup2(sgsize, dmat->alignment); + sgsize = MIN(sgsize, max_sgsize); + curaddr = add_bounce_page(dmat, map, vaddr, sgsize); + } else { + sgsize = MIN(sgsize, max_sgsize); + } /* * Make sure we don't cross any boundaries. @@ -695,10 +705,6 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm sgsize = (baddr - curaddr); } - if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) && - map->pagesneeded != 0 && run_filter(dmat, curaddr)) - curaddr = add_bounce_page(dmat, map, vaddr, sgsize); - /* * Insert chunk into a segment, coalescing with * previous segment if possible. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"