Date: Thu, 31 Jul 2003 22:30:44 -0700 (PDT) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 35318 for review Message-ID: <200308010530.h715Uidl044333@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=35318 Change 35318 by marcel@marcel_nfs on 2003/07/31 22:30:26 IFC @35316 Affected files ... .. //depot/projects/ia64/contrib/smbfs/mount_smbfs/mount_smbfs.8#4 integrate .. //depot/projects/ia64/gnu/usr.bin/cc/cc_int/Makefile#9 integrate .. //depot/projects/ia64/lib/libc/gen/arc4random.3#4 integrate .. //depot/projects/ia64/lib/libc/stdlib/random.3#3 integrate .. //depot/projects/ia64/lib/libkvm/kvm.c#6 integrate .. //depot/projects/ia64/lib/libkvm/kvm.h#4 integrate .. //depot/projects/ia64/lib/libkvm/kvm_file.c#3 integrate .. //depot/projects/ia64/lib/libkvm/kvm_getswapinfo.c#4 integrate .. //depot/projects/ia64/lib/libkvm/kvm_proc.c#19 integrate .. //depot/projects/ia64/lib/libpthread/arch/amd64/amd64/enter_uts.S#2 integrate .. //depot/projects/ia64/lib/libpthread/arch/amd64/include/ksd.h#2 integrate .. //depot/projects/ia64/lib/libpthread/arch/i386/Makefile.inc#2 integrate .. //depot/projects/ia64/lib/libpthread/arch/i386/i386/_atomic_lock.S#2 delete .. //depot/projects/ia64/lib/libpthread/arch/i386/i386/thr_enter_uts.S#4 integrate .. //depot/projects/ia64/lib/libpthread/arch/i386/i386/thr_getcontext.S#2 integrate .. //depot/projects/ia64/lib/libpthread/arch/i386/i386/thr_switch.S#7 delete .. //depot/projects/ia64/lib/libpthread/arch/i386/include/pthread_md.h#4 integrate .. //depot/projects/ia64/lib/libpthread/thread/thr_concurrency.c#5 integrate .. //depot/projects/ia64/release/Makefile#63 integrate .. //depot/projects/ia64/release/alpha/dokern.sh#11 delete .. //depot/projects/ia64/release/alpha/drivers.conf#16 delete .. //depot/projects/ia64/release/alpha/fixit_crunch.conf#6 delete .. //depot/projects/ia64/sbin/atm/fore_dnld/fore_dnld.8#3 integrate .. //depot/projects/ia64/sbin/atm/fore_dnld/fore_dnld.c#4 integrate .. //depot/projects/ia64/sbin/atm/fore_dnld/pca200e.c#2 integrate .. //depot/projects/ia64/share/man/man4/puc.4#3 integrate .. //depot/projects/ia64/sys/conf/files.alpha#21 integrate .. //depot/projects/ia64/sys/conf/files.amd64#8 integrate .. //depot/projects/ia64/sys/conf/files.i386#40 integrate .. //depot/projects/ia64/sys/conf/files.ia64#42 integrate .. //depot/projects/ia64/sys/ddb/db_command.c#14 integrate .. //depot/projects/ia64/sys/ddb/db_output.c#4 integrate .. //depot/projects/ia64/sys/ddb/db_ps.c#21 integrate .. //depot/projects/ia64/sys/ddb/ddb.h#9 integrate .. //depot/projects/ia64/sys/dev/amd/amd.c#7 integrate .. //depot/projects/ia64/sys/dev/firewire/firewire.h#10 integrate .. //depot/projects/ia64/sys/dev/firewire/firewirereg.h#20 integrate .. //depot/projects/ia64/sys/dev/firewire/fwdev.c#18 integrate .. //depot/projects/ia64/sys/dev/firewire/fwohci.c#30 integrate .. //depot/projects/ia64/sys/dev/firewire/if_fwe.c#16 integrate .. //depot/projects/ia64/sys/dev/firewire/sbp.c#40 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_aali.h#2 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_command.c#5 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_init.c#4 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_intr.c#2 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_output.c#6 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_var.h#4 integrate .. //depot/projects/ia64/sys/dev/hfa/fore_vcm.c#2 integrate .. //depot/projects/ia64/sys/dev/hfa/hfa_freebsd.c#5 integrate .. //depot/projects/ia64/sys/dev/hfa/hfa_freebsd.h#2 integrate .. //depot/projects/ia64/sys/dev/pci/pci.c#26 integrate .. //depot/projects/ia64/sys/dev/pdq/if_fea.c#6 integrate .. //depot/projects/ia64/sys/dev/ppc/ppc.c#2 integrate .. //depot/projects/ia64/sys/dev/ppc/ppc_puc.c#1 branch .. //depot/projects/ia64/sys/dev/ppc/ppcvar.h#1 branch .. //depot/projects/ia64/sys/dev/puc/puc.c#18 integrate .. //depot/projects/ia64/sys/i386/i386/sys_machdep.c#19 integrate .. //depot/projects/ia64/sys/isa/ppc.c#8 delete .. //depot/projects/ia64/sys/isa/ppcreg.h#2 delete .. //depot/projects/ia64/sys/kern/kern_ktr.c#13 integrate .. //depot/projects/ia64/sys/kern/kern_mutex.c#29 integrate .. //depot/projects/ia64/sys/kern/subr_witness.c#37 integrate .. //depot/projects/ia64/sys/kern/sys_generic.c#26 integrate .. //depot/projects/ia64/sys/netinet/ip_dummynet.c#21 integrate .. //depot/projects/ia64/sys/security/mac_biba/mac_biba.c#20 integrate .. //depot/projects/ia64/sys/security/mac_mls/mac_mls.c#20 integrate .. //depot/projects/ia64/sys/sys/lock.h#8 integrate .. //depot/projects/ia64/sys/vm/swap_pager.c#35 integrate .. //depot/projects/ia64/sys/vm/swap_pager.h#12 integrate .. //depot/projects/ia64/tools/regression/README#7 integrate .. //depot/projects/ia64/tools/regression/pipe/Makefile#1 branch .. //depot/projects/ia64/tools/regression/pipe/bigpipetest.c#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/ada.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/current.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/default.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/dsa.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/dwp.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/experimental.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/releng_4.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/etc/stanley.rc#1 branch .. //depot/projects/ia64/tools/tools/tinderbox/experimental.rc#2 integrate .. //depot/projects/ia64/usr.sbin/i4b/isdnd/support.c#4 integrate .. //depot/projects/ia64/usr.sbin/lpr/common_source/lp.local.h#3 integrate .. //depot/projects/ia64/usr.sbin/pstat/pstat.8#7 integrate .. //depot/projects/ia64/usr.sbin/pstat/pstat.c#13 integrate Differences ... ==== //depot/projects/ia64/contrib/smbfs/mount_smbfs/mount_smbfs.8#4 (text+ko) ==== @@ -1,4 +1,5 @@ .\" $Id: mount_smbfs.8,v 1.10 2002/04/16 02:47:41 bp Exp $ +.\" $FreeBSD: src/contrib/smbfs/mount_smbfs/mount_smbfs.8,v 1.2 2003/07/31 11:50:01 simon Exp $ .Dd March 10, 2000 .Dt MOUNT_SMBFS 8 .Os @@ -127,7 +128,7 @@ .It Pa ~/.nsmbrc Keeps static parameters for connections and other information. See -.Pa ./examples/dot.nsmbrc +.Pa /usr/share/examples/smbfs/dot.nsmbrc for details. .El .Sh EXAMPLES ==== //depot/projects/ia64/gnu/usr.bin/cc/cc_int/Makefile#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/gnu/usr.bin/cc/cc_int/Makefile,v 1.34 2003/07/11 05:37:23 kan Exp $ +# $FreeBSD: src/gnu/usr.bin/cc/cc_int/Makefile,v 1.35 2003/07/31 19:41:32 obrien Exp $ .include "../Makefile.inc" @@ -27,6 +27,9 @@ attribs.c cselib.c debug.c rtl-error.c tree-dump.c tree-inline.c SRCS+= ${GCC_CPU}.c +.if exists(${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}-c.c) +SRCS+= ${GCC_CPU}-c.c +.endif SRCS+= bb-reorder.c conflict.c ggc-common.c \ ggc-page.c ifcvt.c lists.c predict.c regrename.c resource.c sibcall.c \ ==== //depot/projects/ia64/lib/libc/gen/arc4random.3#4 (text+ko) ==== @@ -28,7 +28,7 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" Manual page, using -mandoc macros -.\" $FreeBSD: src/lib/libc/gen/arc4random.3,v 1.15 2003/05/22 13:02:26 ru Exp $ +.\" $FreeBSD: src/lib/libc/gen/arc4random.3,v 1.16 2003/07/31 06:18:24 das Exp $ .\" .Dd April 15, 1997 .Dt ARC4RANDOM 3 @@ -62,9 +62,11 @@ .Fn arc4random function returns pseudo-random numbers in the range of 0 to .if t 2\u\s731\s10\d\(mi1, -.if n (2**31)\(mi1, +.if n (2**32)\(mi1, and therefore has twice the range of -.Dv RAND_MAX . +.Xr rand 3 +and +.Xr random 3 . .Pp The .Fn arc4random_stir ==== //depot/projects/ia64/lib/libc/stdlib/random.3#3 (text+ko) ==== @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)random.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdlib/random.3,v 1.18 2003/05/31 21:14:41 schweikh Exp $ +.\" $FreeBSD: src/lib/libc/stdlib/random.3,v 1.19 2003/07/31 06:18:34 das Exp $ .\" .Dd June 4, 1993 .Dt RANDOM 3 @@ -174,6 +174,7 @@ detects that the state information has been garbled, error messages are printed on the standard error output. .Sh SEE ALSO +.Xr arc4random 3 , .Xr rand 3 , .Xr srand 3 , .Xr random 4 @@ -189,3 +190,6 @@ random sequence did not vary much with the seed. The current implementation employs a better pseudo-random number generator for the initial state calculation. +.Pp +Applications requiring cryptographic quality randomness should use +.Xr arc4random 3 . ==== //depot/projects/ia64/lib/libkvm/kvm.c#6 (text+ko) ==== @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libkvm/kvm.c,v 1.23 2002/09/11 16:41:39 nectar Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm.c,v 1.24 2003/07/31 21:44:31 phk Exp $"); #if defined(LIBC_SCCS) && !defined(lint) #if 0 @@ -54,7 +54,6 @@ #include <vm/vm.h> #include <vm/vm_param.h> -#include <vm/swap_pager.h> #include <machine/vmparam.h> ==== //depot/projects/ia64/lib/libkvm/kvm.h#4 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kvm.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/lib/libkvm/kvm.h,v 1.14 2002/08/21 16:19:57 mike Exp $ + * $FreeBSD: src/lib/libkvm/kvm.h,v 1.15 2003/07/31 21:30:28 phk Exp $ */ #ifndef _KVM_H_ @@ -69,7 +69,6 @@ int ksw_reserved2; }; -#define SWIF_DUMP_TREE 0x0001 #define SWIF_DEV_PREFIX 0x0002 __BEGIN_DECLS ==== //depot/projects/ia64/lib/libkvm/kvm_file.c#3 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libkvm/kvm_file.c,v 1.16 2002/03/21 23:38:09 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm_file.c,v 1.17 2003/07/31 21:44:31 phk Exp $"); #if defined(LIBC_SCCS) && !defined(lint) #if 0 @@ -60,7 +60,6 @@ #include <vm/vm.h> #include <vm/vm_param.h> -#include <vm/swap_pager.h> #include <sys/sysctl.h> ==== //depot/projects/ia64/lib/libkvm/kvm_getswapinfo.c#4 (text+ko) ==== @@ -8,7 +8,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libkvm/kvm_getswapinfo.c,v 1.21 2003/01/11 01:09:51 dillon Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm_getswapinfo.c,v 1.25 2003/07/31 21:42:12 phk Exp $"); #include <sys/param.h> #include <sys/time.h> @@ -17,7 +17,6 @@ #include <sys/sysctl.h> #include <vm/vm_param.h> -#include <vm/swap_pager.h> #include <err.h> #include <errno.h> @@ -33,53 +32,18 @@ #include "kvm_private.h" -static struct nlist kvm_swap_nl[] = { - { "_swapblist" }, /* new radix swap list */ - { "_swdevt" }, /* list of swap devices and sizes */ - { "_nswdev" }, /* number of swap devices */ - { "_dmmax" }, /* maximum size of a swap block */ - { "" } -}; - #define NL_SWAPBLIST 0 #define NL_SWDEVT 1 #define NL_NSWDEV 2 #define NL_DMMAX 3 static int kvm_swap_nl_cached = 0; -static int nswdev; static int unswdev; /* number of found swap dev's */ static int dmmax; -static void getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, - int swap_max, int flags); -static int kvm_getswapinfo2(kvm_t *kd, struct kvm_swap *swap_ary, - int swap_max, int flags); -static int kvm_getswapinfo_kvm(kvm_t *, struct kvm_swap *, int, int); static int kvm_getswapinfo_sysctl(kvm_t *, struct kvm_swap *, int, int); -static int nlist_init(kvm_t *); static int getsysctl(kvm_t *, char *, void *, size_t); -#define SVAR(var) __STRING(var) /* to force expansion */ -#define KGET(idx, var) \ - KGET1(idx, &var, sizeof(var), SVAR(var)) -#define KGET1(idx, p, s, msg) \ - KGET2(kvm_swap_nl[idx].n_value, p, s, msg) -#define KGET2(addr, p, s, msg) \ - if (kvm_read(kd, (u_long)(addr), p, s) != s) \ - warnx("cannot read %s: %s", msg, kvm_geterr(kd)) -#define KGETN(idx, var) \ - KGET1N(idx, &var, sizeof(var), SVAR(var)) -#define KGET1N(idx, p, s, msg) \ - KGET2N(kvm_swap_nl[idx].n_value, p, s, msg) -#define KGET2N(addr, p, s, msg) \ - ((kvm_read(kd, (u_long)(addr), p, s) == s) ? 1 : 0) -#define KGETRET(addr, p, s, msg) \ - if (kvm_read(kd, (u_long)(addr), p, s) != s) { \ - warnx("cannot read %s: %s", msg, kvm_geterr(kd)); \ - return (0); \ - } - #define GETSWDEVNAME(dev, str, flags) \ if (dev == NODEV) { \ strlcpy(str, "[NFS swap]", sizeof(str)); \ @@ -98,10 +62,6 @@ int swap_max, int flags ) { - int rv; -#ifdef DEBUG_SWAPINFO - int i; -#endif /* * clear cache @@ -111,344 +71,13 @@ return(0); } - rv = kvm_getswapinfo2(kd, swap_ary, swap_max, flags); - - /* This is only called when the tree shall be dumped. It needs kvm. */ - if (flags & SWIF_DUMP_TREE) { -#ifdef DEBUG_SWAPINFO - /* - * sanity check: Sizes must be equal - used field must be - * 0 after this. Fill it with total-used before, where - * getswapinfo_radix will subtrat total-used. - * This will of course only work if there is no swap activity - * while we are working, so this code is normally not active. - */ - for (i = 0; i < unswdev; i++) { - swap_ary[i].ksw_used = swap_ary[i].ksw_total - - swap_ary[i].ksw_used; - } -#endif - getswapinfo_radix(kd, swap_ary, swap_max, flags); -#ifdef DEBUG_SWAPINFO - for (i = 0; i < unswdev; i++) { - if (swap_ary[i].ksw_used != 0) { - fprintf(stderr, "kvm_getswapinfo: swap size " - "mismatch (%d blocks)!\n", - swap_ary[i].ksw_used - ); - } - } - /* This is fast enough now, so just do it again. */ - rv = kvm_getswapinfo2(kd, swap_ary, swap_max, flags); -#endif - } - - return rv; -} - -static int -kvm_getswapinfo2( - kvm_t *kd, - struct kvm_swap *swap_ary, - int swap_max, - int flags -) { if (ISALIVE(kd)) { return kvm_getswapinfo_sysctl(kd, swap_ary, swap_max, flags); } else { - return kvm_getswapinfo_kvm(kd, swap_ary, swap_max, flags); - } -} - -int -kvm_getswapinfo_kvm( - kvm_t *kd, - struct kvm_swap *swap_ary, - int swap_max, - int flags -) { - int ti = 0; - - /* - * namelist - */ - if (!nlist_init(kd)) - return (-1); - - { - struct swdevt *sw; - int i; - - ti = unswdev; - if (ti >= swap_max) - ti = swap_max - 1; - - if (ti >= 0) - bzero(swap_ary, sizeof(struct kvm_swap) * (ti + 1)); - - KGET(NL_SWDEVT, sw); - for (i = 0; i < unswdev; ++i) { - struct swdevt swinfo; - int ttl; - - KGET2(&sw[i], &swinfo, sizeof(swinfo), "swinfo"); - - /* - * old style: everything in DEV_BSIZE'd chunks, - * convert to pages. - * - * new style: swinfo in DEV_BSIZE'd chunks but dmmax - * in pages. - * - * The first dmmax is never allocating to avoid - * trashing the disklabels - */ - - ttl = swinfo.sw_nblks - dmmax; - - if (ttl == 0) - continue; - - if (i < ti) { - swap_ary[i].ksw_total = ttl; - swap_ary[i].ksw_used = swinfo.sw_used; - swap_ary[i].ksw_flags = swinfo.sw_flags; - GETSWDEVNAME(swinfo.sw_dev, - swap_ary[i].ksw_devname, flags - ); - } - if (ti >= 0) { - swap_ary[ti].ksw_total += ttl; - swap_ary[ti].ksw_used += swinfo.sw_used; - } - } - } - - return(ti); -} - -/* - * scanradix() - support routine for radix scanner - */ - -#define TABME tab, tab, "" - -static int -scanradix( - blmeta_t *scan, - daddr_t blk, - daddr_t radix, - daddr_t skip, - daddr_t count, - kvm_t *kd, - int dmmax, - int nswdev, - struct kvm_swap *swap_ary, - int swap_max, - int tab, - int flags -) { - blmeta_t meta; -#ifdef DEBUG_SWAPINFO - int ti = (unswdev >= swap_max) ? swap_max - 1 : unswdev; -#endif - - KGET2(scan, &meta, sizeof(meta), "blmeta_t"); - - /* - * Terminator - */ - if (meta.bm_bighint == (daddr_t)-1) { - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Terminator\n", - TABME, - blk, - radix - ); - } - return(-1); - } - - if (radix == BLIST_BMAP_RADIX) { - /* - * Leaf bitmap - */ -#ifdef DEBUG_SWAPINFO - int i; -#endif - - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Bitmap %08x big=%d\n", - TABME, - blk, - radix, - (int)meta.u.bmu_bitmap, - meta.bm_bighint - ); - } - -#ifdef DEBUG_SWAPINFO - /* - * If not all allocated, count. - */ - if (meta.u.bmu_bitmap != 0) { - for (i = 0; i < BLIST_BMAP_RADIX && i < count; ++i) { - /* - * A 0 bit means allocated - */ - if ((meta.u.bmu_bitmap & (1 << i))) { - int t = 0; - - if (nswdev) - t = (blk + i) / dmmax % nswdev; - if (t < ti) - --swap_ary[t].ksw_used; - if (ti >= 0) - --swap_ary[ti].ksw_used; - } - } - } -#endif - } else if (meta.u.bmu_avail == radix) { - /* - * Meta node if all free - */ - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap ALL-FREE {\n", - TABME, - blk, - radix - ); - } -#ifdef DEBUG_SWAPINFO - /* - * Note: both dmmax and radix are powers of 2. However, dmmax - * may be larger then radix so use a smaller increment if - * necessary. - */ - { - int t; - int tinc = dmmax; - - while (tinc > radix) - tinc >>= 1; - - for (t = blk; t < blk + radix; t += tinc) { - int u = (nswdev) ? (t / dmmax % nswdev) : 0; - - if (u < ti) - swap_ary[u].ksw_used -= tinc; - if (ti >= 0) - swap_ary[ti].ksw_used -= tinc; - } - } -#endif - } else if (meta.u.bmu_avail == 0) { - /* - * Meta node if all used - */ - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap ALL-ALLOCATED\n", - TABME, - blk, - radix - ); - } - } else { - /* - * Meta node if not all free - */ - int i; - int next_skip; - - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s(0x%06x,%d) Submap avail=%d big=%d {\n", - TABME, - blk, - radix, - (int)meta.u.bmu_avail, - meta.bm_bighint - ); - } - - radix /= BLIST_META_RADIX; - next_skip = skip / BLIST_META_RADIX; - - for (i = 1; i <= skip; i += next_skip) { - int r; - daddr_t vcount = (count > radix) ? radix : count; - - r = scanradix( - &scan[i], - blk, - radix, - next_skip - 1, - vcount, - kd, - dmmax, - nswdev, - swap_ary, - swap_max, - tab + 4, - flags - ); - if (r < 0) - break; - blk += radix; - } - if (flags & SWIF_DUMP_TREE) { - printf("%*.*s}\n", TABME); - } + return -1; } - return(0); } -static void -getswapinfo_radix(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max, int flags) -{ - struct blist *swapblist = NULL; - struct blist blcopy = { 0 }; - - if (!nlist_init(kd)) { - fprintf(stderr, "radix tree: nlist_init failed!\n"); - return; - } - - KGET(NL_SWAPBLIST, swapblist); - - if (swapblist == NULL) { - if (flags & SWIF_DUMP_TREE) - printf("radix tree: NULL - no swap in system\n"); - return; - } - - KGET2(swapblist, &blcopy, sizeof(blcopy), "*swapblist"); - - if (flags & SWIF_DUMP_TREE) { - printf("radix tree: %d/%d/%d blocks, %dK wired\n", - blcopy.bl_free, - blcopy.bl_blocks, - blcopy.bl_radix, - (int)((blcopy.bl_rootblks * sizeof(blmeta_t) + 1023)/ - 1024) - ); - } - scanradix( - blcopy.bl_root, - 0, - blcopy.bl_radix, - blcopy.bl_skip, - blcopy.bl_rootblks, - kd, - dmmax, - nswdev, - swap_ary, - swap_max, - 0, - flags - ); -} - #define GETSYSCTL(kd, name, var) \ getsysctl(kd, name, &(var), sizeof(var)) @@ -522,53 +151,6 @@ } static int -nlist_init ( - kvm_t *kd -) { - struct swdevt *sw; - - if (kvm_swap_nl_cached) - return (1); - - if (kvm_nlist(kd, kvm_swap_nl) < 0) - return (0); - - /* - * required entries - */ - if ( - kvm_swap_nl[NL_SWDEVT].n_value == 0 || - kvm_swap_nl[NL_NSWDEV].n_value == 0 || - kvm_swap_nl[NL_DMMAX].n_value == 0 || - kvm_swap_nl[NL_SWAPBLIST].n_type == 0 - ) { - return (0); - } - - /* - * get globals, type of swap - */ - KGET(NL_NSWDEV, nswdev); - KGET(NL_DMMAX, dmmax); - - /* - * figure out how many actual swap devices are enabled - */ - KGET(NL_SWDEVT, sw); - for (unswdev = nswdev - 1; unswdev >= 0; --unswdev) { - struct swdevt swinfo; - - KGET2(&sw[unswdev], &swinfo, sizeof(swinfo), "swinfo"); - if (swinfo.sw_nblks) - break; - } - ++unswdev; - - kvm_swap_nl_cached = 1; - return (1); -} - -static int getsysctl ( kvm_t *kd, char *name, ==== //depot/projects/ia64/lib/libkvm/kvm_proc.c#19 (text+ko) ==== @@ -42,7 +42,7 @@ #endif #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.69 2003/06/15 03:42:04 davidxu Exp $"); +__FBSDID("$FreeBSD: src/lib/libkvm/kvm_proc.c,v 1.70 2003/07/31 21:44:31 phk Exp $"); /* * Proc traversal interface for kvm. ps and w are (probably) the exclusive @@ -69,7 +69,6 @@ #include <vm/vm.h> #include <vm/vm_param.h> -#include <vm/swap_pager.h> #include <sys/sysctl.h> ==== //depot/projects/ia64/lib/libpthread/arch/amd64/amd64/enter_uts.S#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD: src/lib/libpthread/arch/amd64/amd64/enter_uts.S,v 1.1 2003/07/19 04:44:21 deischen Exp $"); +__FBSDID("$FreeBSD: src/lib/libpthread/arch/amd64/amd64/enter_uts.S,v 1.2 2003/07/31 08:50:01 davidxu Exp $"); /* @@ -34,8 +34,8 @@ */ ENTRY(_amd64_enter_uts) addq %rcx, %rdx /* get stack base */ - andq -15, %rdx /* align to 16 bytes */ + andq $-15, %rdx /* align to 16 bytes */ movq %rdx, %rsp /* switch to UTS stack */ movq %rdx, %rbp /* set frame */ - jmp *(%rsi) /* jump to UTS entry point */ + pushq %rsi ret ==== //depot/projects/ia64/lib/libpthread/arch/amd64/include/ksd.h#2 (text+ko) ==== @@ -26,13 +26,15 @@ */ /* - * $FreeBSD: src/lib/libpthread/arch/amd64/include/ksd.h,v 1.1 2003/07/19 04:44:21 deischen Exp $ + * $FreeBSD: src/lib/libpthread/arch/amd64/include/ksd.h,v 1.3 2003/07/31 22:06:36 davidxu Exp $ */ #ifndef _KSD_H_ #define _KSD_H_ #include <sys/types.h> +#include <machine/sysarch.h> +extern int sysarch(int, void *); struct kse; struct pthread; @@ -55,7 +57,7 @@ __ksd_type(name) __result; \ \ u_long __i; \ - __asm __volatile("movq %%gs:%1, %0" \ + __asm __volatile("movq %%fs:%1, %0" \ : "=r" (__i) \ : "m" (*(u_long *)(__ksd_offset(name)))); \ __result = *(__ksd_type(name) *)&__i; \ @@ -71,7 +73,7 @@ \ u_long __i; \ __i = *(u_long *)&__val; \ - __asm __volatile("movq %1,%%gs:%0" \ + __asm __volatile("movq %1,%%fs:%0" \ : "=m" (*(u_long *)(__ksd_offset(name))) \ : "r" (__i)); \ }) @@ -83,7 +85,7 @@ __asm __volatile ( " xorq %0, %0;" - " xchgq %%gs:%1, %0;" + " xchgq %%fs:%1, %0;" "# __ksd_readandclear64" : "=&r" (result) : "m" (*addr)); @@ -124,12 +126,7 @@ static __inline int _ksd_setprivate(struct ksd *ksd) { - /* - * Make it fail; only the kernel can do this on amd64. - * This interface is going to be removed. The KSD - * will be set by the kernel when the kse is created. - */ - return (-1); + return (sysarch(AMD64_SET_FSBASE, &ksd->base)); } #endif ==== //depot/projects/ia64/lib/libpthread/arch/i386/Makefile.inc#2 (text+ko) ==== @@ -1,5 +1,5 @@ -# $FreeBSD: src/lib/libpthread/arch/i386/Makefile.inc,v 1.1 2003/06/23 04:28:31 marcel Exp $ +# $FreeBSD: src/lib/libpthread/arch/i386/Makefile.inc,v 1.2 2003/07/31 21:09:10 deischen Exp $ .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/${MACHINE_ARCH} -SRCS+= ksd.c thr_enter_uts.S thr_getcontext.S thr_switch.S +SRCS+= ksd.c thr_enter_uts.S thr_getcontext.S ==== //depot/projects/ia64/lib/libpthread/arch/i386/i386/thr_enter_uts.S#4 (text+ko) ==== @@ -26,76 +26,20 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/thr_enter_uts.S,v 1.4 2003/04/18 05:00:52 deischen Exp $"); +__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/thr_enter_uts.S,v 1.5 2003/07/31 21:09:10 deischen Exp $"); -/* - * Where do we define these? - */ -#define MC_SIZE 640 /* sizeof mcontext_t */ -#define UC_MC_OFFSET 16 /* offset to mcontext from ucontext */ -#define MC_LEN_OFFSET 80 /* offset to mc_len from mcontext */ -#define MC_FP_CW_OFFSET 96 /* offset to FP control word */ -#define MC_FPFMT_OFFSET 84 /* offset to mc_fpformat from mcontext */ -#define MC_FPFMT_NODEV 0x10000 -#define MC_OWNEDFP_OFFSET 88 /* offset to mc_ownedfp from mcontext */ -#define MC_OWNEDFP_NONE 0x20000 -#define KM_STACK_SP_OFFSET 36 /* offset to km_stack.ss_sp */ -#define KM_STACK_SIZE_OFFSET 40 /* offset to km_stack.ss_sp */ -#define KM_FUNC_OFFSET 32 /* offset to km_func */ /* - * int _thread_enter_uts(kse_thr_mailbox *tm, kse_mailbox *km); - * - * Returns 0 on success, -1 otherwise. + * _i386_enter_uts(struct kse_mailbox *km, kse_func_t uts, void *stack, + * long stacksz); + * +4 = km, +8 = uts, +12 = stack, +16 = size */ -ENTRY(_thread_enter_uts) - movl 4(%esp), %eax /* get address of context */ - cmpl $0, %eax /* check for null pointer */ - jne 1f - movl $-1, %eax - jmp 2f -1: pushl %edx /* save value of edx */ - movl %eax, %edx /* get address of context */ - addl $UC_MC_OFFSET, %edx /* add offset to mcontext */ - /*movl %gs, 4(%edx)*/ /* we don't touch %gs */ - movl %fs, 8(%edx) - movl %es, 12(%edx) - movl %ds, 16(%edx) - movl %edi, 20(%edx) - movl %esi, 24(%edx) - movl %ebp, 28(%edx) - movl %ebx, 36(%edx) - movl $0, 48(%edx) /* store successful return in eax */ - popl %eax /* get saved value of edx */ - movl %eax, 40(%edx) /* save edx */ - movl %ecx, 44(%edx) - movl (%esp), %eax /* get return address */ - movl %eax, 60(%edx) /* save return address */ - movl %ss, 76(%edx) - /* - * Don't save floating point registers here. - * - * This is an explicit call to get the current context, so - * the caller is done with the floating point registers. - * Contexts formed by involuntary switches, such as signal delivery, - * have floating point registers saved by the kernel. - */ - fnstcw MC_FP_CW_OFFSET(%edx) - movl $MC_OWNEDFP_NONE, MC_OWNEDFP_OFFSET(%edx) /* no FP */ - movl $MC_FPFMT_NODEV, MC_FPFMT_OFFSET(%edx) /* no FP */ - pushfl /* get eflags */ - popl %eax - movl %eax, 68(%edx) /* store eflags */ - movl %esp, %eax /* setcontext pushes the return */ - addl $4, %eax /* address onto the top of the */ - movl %eax, 72(%edx) /* stack; account for this */ - movl $MC_SIZE, MC_LEN_OFFSET(%edx) /* context is now valid */ - movl 8(%esp), %edx /* get address of mailbox */ - movl KM_STACK_SP_OFFSET(%edx), %eax /* get bottom of stack */ - addl KM_STACK_SIZE_OFFSET(%edx), %eax /* add length */ - movl %eax, %esp /* switch to the uts's stack */ - pushl %edx /* push the address of the mailbox */ - pushl KM_FUNC_OFFSET(%edx) /* .. the uts can return to itself */ - pushl KM_FUNC_OFFSET(%edx) /* push the address of the uts func */ -2: ret - +ENTRY(_i386_enter_uts) + movl %esp, %edx /* save stack */ + movl 12(%edx), %eax /* get bottom of stack */ + addl 16(%edx), %eax /* add length */ + movl %eax, %esp /* switch to uts stack */ + pushl 4(%edx) /* push the address of the mailbox */ + pushl 8(%edx) /* .. the uts can return to itself */ + pushl 8(%edx) /* .. the uts can return to itself */ + ret ==== //depot/projects/ia64/lib/libpthread/arch/i386/i386/thr_getcontext.S#2 (text+ko) ==== @@ -25,12 +25,11 @@ */ #include <machine/asm.h> -__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/thr_getcontext.S,v 1.2 2003/04/18 07:09:42 deischen Exp $"); +__FBSDID("$FreeBSD: src/lib/libpthread/arch/i386/i386/thr_getcontext.S,v 1.3 2003/07/31 21:09:10 deischen Exp $"); /* * Where do we define these? */ -#define UC_MC_OFFSET 16 /* offset to mcontext from ucontext */ #define MC_LEN_OFFSET 80 /* offset to mc_len from mcontext */ #define MC_LEN 640 /* mc_len <machine/ucontext.h> */ #define MC_FPFMT_OFFSET 84 @@ -45,27 +44,26 @@ #define MC_FP_CW_OFFSET 96 /* offset to FP control word */ /* - * int thr_setcontext(ucontext_t *ucp) + * int thr_setcontext(mcontext_t *mcp, intptr_t val, intptr_t *loc) * - * Restores the context in ucp. + * Restores the context in mcp. * * Returns 0 if there are no errors; -1 otherwise */ .weak CNAME(_thr_setcontext) .set CNAME(_thr_setcontext),CNAME(__thr_setcontext) ENTRY(__thr_setcontext) - movl 4(%esp), %eax /* get address of context and sigset */ - cmpl $0, %eax /* check for null pointer */ + movl 4(%esp), %edx /* get address of mcontext */ + cmpl $0, %edx /* check for null pointer */ jne 1f movl $-1, %eax - jmp 7f -1: addl $UC_MC_OFFSET, %eax /* add offset to mcontext */ - cmpl $MC_LEN, MC_LEN_OFFSET(%eax) /* is context valid? */ + jmp 8f +1: cmpl $MC_LEN, MC_LEN_OFFSET(%edx) /* is context valid? */ je 2f movl $-1, %eax /* bzzzt, invalid context */ - jmp 7f -/*2: movl 4(%edx), %gs*/ /* we don't touch %gs */ -2: movl 8(%edx), %fs + jmp 8f +2: /*movl 4(%edx), %gs*/ /* we don't touch %gs */ + movl 8(%edx), %fs movl 12(%edx), %es movl 16(%edx), %ds movl 76(%edx), %ss @@ -74,12 +72,9 @@ movl 28(%edx), %ebp movl %esp, %ecx /* save current stack in ecx */ movl 72(%edx), %esp /* switch to context defined stack */ - movl 60(%edx), %eax /* put return address at top of stack */ - pushl %eax - movl 44(%edx), %eax /* get ecx from context, */ - pushl %eax /* push on top of stack */ - movl 48(%edx), %eax /* get eax from context, */ - pushl %eax /* push on top of stack */ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308010530.h715Uidl044333>