PERFORCE change 76132 for review

Robert Watson rwatson at FreeBSD.org
Thu Apr 28 10:53:21 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=76132

Change 76132 by rwatson at rwatson_tislabs on 2005/04/28 10:52:21

	Top up integration of TrustedBSD base branch from FreeBSD CVS:
	primarily to pick up IPFITLER build cleanups.

Affected files ...

.. //depot/projects/trustedbsd/base/etc/pam.d/xdm#8 integrate
.. //depot/projects/trustedbsd/base/include/netdb.h#8 integrate
.. //depot/projects/trustedbsd/base/lib/libbsnmp/modules/snmp_netgraph/snmp_netgraph.c#6 delete
.. //depot/projects/trustedbsd/base/lib/libc/net/gethostbydns.c#13 integrate
.. //depot/projects/trustedbsd/base/lib/libc/net/gethostbyht.c#5 integrate
.. //depot/projects/trustedbsd/base/lib/libc/net/gethostnamadr.c#6 integrate
.. //depot/projects/trustedbsd/base/lib/libc/net/getnetnamadr.c#4 integrate
.. //depot/projects/trustedbsd/base/lib/libc/net/name6.c#18 integrate
.. //depot/projects/trustedbsd/base/lib/libc/net/netdb_private.h#3 integrate
.. //depot/projects/trustedbsd/base/lib/libthr/thread/thr_find_thread.c#5 delete
.. //depot/projects/trustedbsd/base/lib/libthr/thread/thr_getschedparam.c#3 branch
.. //depot/projects/trustedbsd/base/lib/libthr/thread/thr_mattr_kind_np.c#4 delete
.. //depot/projects/trustedbsd/base/libexec/rtld-elf/i386/reloc.c#9 integrate
.. //depot/projects/trustedbsd/base/share/mk/sys.mk#20 integrate
.. //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/iq31244_machdep.c#5 integrate
.. //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_amd.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_mod.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_piv.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_ppro.c#2 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio.c#7 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio.h#3 integrate
.. //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio_pcm.c#8 integrate
.. //depot/projects/trustedbsd/base/sys/dev/uart/uart_dev_z8530.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_amd.c#2 delete
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_intel.c#2 delete
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_mod.c#2 delete
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_pentium.c#2 delete
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_piv.c#2 delete
.. //depot/projects/trustedbsd/base/sys/hwpmc/hwpmc_ppro.c#2 delete
.. //depot/projects/trustedbsd/base/sys/i386/include/pmc_mdep.h#2 integrate
.. //depot/projects/trustedbsd/base/sys/libkern/crc32.c#4 integrate
.. //depot/projects/trustedbsd/base/sys/modules/hwpmc/Makefile#2 integrate
.. //depot/projects/trustedbsd/base/sys/nfsclient/nfs_vfsops.c#38 integrate
.. //depot/projects/trustedbsd/base/sys/sparc64/pci/apb.c#10 integrate
.. //depot/projects/trustedbsd/base/sys/sys/libkern.h#16 integrate
.. //depot/projects/trustedbsd/base/sys/sys/pmc.h#2 integrate
.. //depot/projects/trustedbsd/base/sys/sys/systm.h#33 integrate
.. //depot/projects/trustedbsd/base/usr.bin/make/Makefile#13 integrate
.. //depot/projects/trustedbsd/base/usr.bin/make/directive_hash.c#1 branch
.. //depot/projects/trustedbsd/base/usr.bin/make/directive_hash.h#1 branch
.. //depot/projects/trustedbsd/base/usr.bin/make/parse.c#20 integrate

Differences ...

==== //depot/projects/trustedbsd/base/etc/pam.d/xdm#8 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $FreeBSD: src/etc/pam.d/xdm,v 1.9 2004/02/20 21:59:51 des Exp $
+# $FreeBSD: src/etc/pam.d/xdm,v 1.10 2005/04/28 07:59:09 des Exp $
 #
 # PAM configuration for the "xdm" service
 #
@@ -16,7 +16,7 @@
 
 # session
 #session 	required	pam_ssh.so		want_agent
-session		required	pam_permit.so
+session		required	pam_lastlog.so		no_fail
 
 # password
 password	required	pam_deny.so

==== //depot/projects/trustedbsd/base/include/netdb.h#8 (text+ko) ====

@@ -55,7 +55,7 @@
 /*
  *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
  *      From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
- * $FreeBSD: src/include/netdb.h,v 1.34 2005/02/14 11:33:11 phantom Exp $
+ * $FreeBSD: src/include/netdb.h,v 1.35 2005/04/27 19:12:56 ume Exp $
  */
 
 #ifndef _NETDB_H_
@@ -257,18 +257,6 @@
 
 /* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
 int	* __h_error(void);
-void	_sethosthtent(int);
-void	_endhosthtent(void);
-void	_sethostdnsent(int);
-void	_endhostdnsent(void);
-void	_setnethtent(int);
-void	_endnethtent(void);
-void	_setnetdnsent(int);
-void	_endnetdnsent(void);
-struct hostent * _gethostbynisname(const char *, int);
-struct hostent * _gethostbynisaddr(const char *, int, int);
-void _map_v4v6_address(const char *, char *);
-void _map_v4v6_hostent(struct hostent *, char **, char **);
 __END_DECLS
 
 #endif /* !_NETDB_H_ */

==== //depot/projects/trustedbsd/base/lib/libc/net/gethostbydns.c#13 (text+ko) ====

@@ -58,7 +58,7 @@
 static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/gethostbydns.c,v 1.49 2005/04/25 17:36:28 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/gethostbydns.c,v 1.50 2005/04/27 19:12:57 ume Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -79,6 +79,7 @@
 #include <stdarg.h>
 #include <nsswitch.h>
 
+#include "netdb_private.h"
 #include "res_config.h"
 
 #define SPRINTF(x) ((size_t)sprintf x)

==== //depot/projects/trustedbsd/base/lib/libc/net/gethostbyht.c#5 (text+ko) ====

@@ -55,7 +55,7 @@
 static char sccsid[] = "@(#)gethostnamadr.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/gethostbyht.c,v 1.17 2005/01/03 11:07:45 sobomax Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/gethostbyht.c,v 1.18 2005/04/27 19:12:57 ume Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -69,6 +69,7 @@
 #include <nsswitch.h>
 #include <arpa/nameser.h>	/* XXX */
 #include <resolv.h>		/* XXX */
+#include "netdb_private.h"
 
 #define	MAXALIASES	35
 

==== //depot/projects/trustedbsd/base/lib/libc/net/gethostnamadr.c#6 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/gethostnamadr.c,v 1.23 2005/04/25 17:36:28 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/gethostnamadr.c,v 1.24 2005/04/27 19:12:57 ume Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -41,6 +41,7 @@
 #include <arpa/nameser.h>		/* XXX hack for _res */
 #include <resolv.h>			/* XXX hack for _res */
 #include "un-namespace.h"
+#include "netdb_private.h"
 
 extern int _ht_gethostbyname(void *, void *, va_list);
 extern int _dns_gethostbyname(void *, void *, va_list);

==== //depot/projects/trustedbsd/base/lib/libc/net/getnetnamadr.c#4 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/getnetnamadr.c,v 1.17 2003/04/24 18:05:48 nectar Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/getnetnamadr.c,v 1.18 2005/04/27 19:12:57 ume Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -38,6 +38,7 @@
 #include <stdarg.h>
 #include <nsswitch.h>
 #include "un-namespace.h"
+#include "netdb_private.h"
 
 extern int _ht_getnetbyname(void *, void *, va_list);
 extern int _dns_getnetbyname(void *, void *, va_list);

==== //depot/projects/trustedbsd/base/lib/libc/net/name6.c#18 (text+ko) ====

@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/name6.c,v 1.45 2005/04/19 12:28:17 ume Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/name6.c,v 1.46 2005/04/27 19:12:57 ume Exp $");
 
 #include "namespace.h"
 #if defined(YP) || defined(ICMPNL)
@@ -120,6 +120,7 @@
 #include <nsswitch.h>
 #include <unistd.h>
 #include "un-namespace.h"
+#include "netdb_private.h"
 
 #ifndef _PATH_HOSTS
 #define	_PATH_HOSTS	"/etc/hosts"

==== //depot/projects/trustedbsd/base/lib/libc/net/netdb_private.h#3 (text+ko) ====

@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/net/netdb_private.h,v 1.4 2005/04/19 14:41:13 ume Exp $
+ * $FreeBSD: src/lib/libc/net/netdb_private.h,v 1.5 2005/04/27 19:12:57 ume Exp $
  */
 
 #ifndef _NETDB_PRIVATE_H_
@@ -79,6 +79,18 @@
 
 struct protodata *__protodata_init(void);
 struct servdata *__servdata_init(void);
+void _endhostdnsent(void);
+void _endhosthtent(void);
+void _endnetdnsent(void);
+void _endnethtent(void);
+struct hostent *_gethostbynisaddr(const char *, int, int);
+struct hostent *_gethostbynisname(const char *, int);
+void _map_v4v6_address(const char *, char *);
+void _map_v4v6_hostent(struct hostent *, char **, char **);
+void _sethostdnsent(int);
+void _sethosthtent(int);
+void _setnetdnsent(int);
+void _setnethtent(int);
 void endprotoent_r(struct protoent_data *);
 void endservent_r(struct servent_data *);
 int getprotobyname_r(const char *, struct protoent *, struct protoent_data *);

==== //depot/projects/trustedbsd/base/libexec/rtld-elf/i386/reloc.c#9 (text+ko) ====

@@ -22,7 +22,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/libexec/rtld-elf/i386/reloc.c,v 1.16 2005/04/26 20:38:44 peter Exp $
+ * $FreeBSD: src/libexec/rtld-elf/i386/reloc.c,v 1.17 2005/04/27 13:17:23 davidxu Exp $
  */
 
 /*
@@ -336,7 +336,7 @@
      * use.
      */
     tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
-    tls = alloca_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
+    tls = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
     error = i386_set_gsbase(tls);
     if (error < 0) {
 	memset(&ldt, 0, sizeof(ldt));

==== //depot/projects/trustedbsd/base/share/mk/sys.mk#20 (text+ko) ====

@@ -1,5 +1,5 @@
 #	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94
-# $FreeBSD: src/share/mk/sys.mk,v 1.83 2004/12/23 08:51:50 ru Exp $
+# $FreeBSD: src/share/mk/sys.mk,v 1.84 2005/04/27 14:13:55 scottl Exp $
 
 unix		?=	We run FreeBSD, not UNIX.
 .FreeBSD	?=	true
@@ -265,6 +265,11 @@
 .include "${__MAKE_CONF}"
 .endif
 
+# XXX Hack until IPFILTER is buildable again.
+.if !defined(WANT_IPFILTER)
+NO_IPFILTER=
+.endif
+
 # Default executable format
 # XXX hint for bsd.port.mk
 OBJFORMAT?=	elf

==== //depot/projects/trustedbsd/base/sys/arm/xscale/i80321/iq31244_machdep.c#5 (text+ko) ====

@@ -48,7 +48,7 @@
 #include "opt_msgbuf.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.10 2005/04/07 22:04:18 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.11 2005/04/27 13:29:54 cognet Exp $");
 
 #define _ARM32_BUS_DMA_PRIVATE
 #include <sys/param.h>
@@ -356,13 +356,6 @@
 		pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
 		    UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 
 		    PTE_CACHE);
-	if (freemem_after + KSTACK_PAGES * PAGE_SIZE < afterkern) {
-		alloc_afterkern(kernelstack.pv_va, kernelstack.pv_pa, 
-		    KSTACK_PAGES * PAGE_SIZE);
-	} else
-		pmap_map_chunk(l1pagetable, kernelstack.pv_va, 
-		    kernelstack.pv_pa, KSTACK_PAGES * PAGE_SIZE,
-		    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 	if (freemem_after + MSGBUF_SIZE < afterkern) {
 		alloc_afterkern(msgbufpv.pv_va, msgbufpv.pv_pa, 
 		    IRQ_STACK_SIZE * PAGE_SIZE);

==== //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_amd.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_amd.c,v 1.3 2005/04/27 05:51:13 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_amd.c,v 1.4 2005/04/28 08:13:18 jkoshy Exp $");
 
 /* Support for the AMD K7 and later processors */
 
@@ -443,6 +443,8 @@
 {
 	struct pmc_hw *phw;
 
+	PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
+
 	KASSERT(cpu >= 0 && cpu < mp_ncpus,
 	    ("[amd,%d] illegal CPU value %d", __LINE__, cpu));
 	KASSERT(ri >= 0 && ri < AMD_NPMCS,
@@ -451,7 +453,8 @@
 	phw = pmc_pcpu[cpu]->pc_hwpmcs[ri];
 
 	KASSERT(pm == NULL || phw->phw_pmc == NULL,
-	    ("[amd,%d] hwpmc not unconfigured before re-config", __LINE__));
+	    ("[amd,%d] pm=%p phw->pm=%p hwpmc not unconfigured",
+		__LINE__, pm, phw->phw_pmc));
 
 	phw->phw_pmc = pm;
 	return 0;
@@ -463,12 +466,17 @@
  */
 
 static int
-amd_switch_in(struct pmc_cpu *pc)
+amd_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
 
-	/* enable the RDPMC instruction */
-	load_cr4(rcr4() | CR4_PCE);
+	PMCDBG(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
+	    (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) != 0);
+
+	/* enable the RDPMC instruction if needed */
+	if (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS)
+		load_cr4(rcr4() | CR4_PCE);
+
 	return 0;
 }
 
@@ -478,12 +486,17 @@
  */
 
 static int
-amd_switch_out(struct pmc_cpu *pc)
+amd_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
+	(void) pp;		/* can be NULL */
+
+	PMCDBG(MDP,SWO,1, "pc=%p pp=%p enable-msr=%d", pc, pp, pp ?
+	    (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) == 1 : 0);
 
-	/* disallow RDPMC instruction */
+	/* always turn off the RDPMC instruction */
 	load_cr4(rcr4() & ~CR4_PCE);
+
 	return 0;
 }
 
@@ -818,7 +831,7 @@
 	KASSERT(ri >= 0 && ri < AMD_NPMCS,
 	    ("[amd,%d] ri %d out of range", __LINE__, ri));
 
-	*msr = amd_pmcdesc[ri].pm_perfctr;
+	*msr = amd_pmcdesc[ri].pm_perfctr - AMD_PMC_PERFCTR_0;
 	return 0;
 }
 

==== //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_mod.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.5 2005/04/27 05:51:13 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.6 2005/04/28 08:13:18 jkoshy Exp $");
 
 #include <sys/param.h>
 #include <sys/eventhandler.h>
@@ -739,8 +739,13 @@
 
 	atomic_store_rel_ptr(&pp->pp_pmcs[ri].pp_pmc, pm);
 
+	if (pm->pm_owner->po_owner == pp->pp_proc)
+		pp->pp_flags |= PMC_FLAG_ENABLE_MSR_ACCESS;
+
 	pp->pp_refcnt++;
 
+	PMCDBG(PRC,TLK,2, "enable-msr %d",
+	    (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) != 0);
 }
 
 /*
@@ -774,6 +779,9 @@
 	pp->pp_pmcs[ri].pp_pmc = NULL;
 	pp->pp_pmcs[ri].pp_pmcval = (pmc_value_t) 0;
 
+	if (pm->pm_owner->po_owner == pp->pp_proc)
+		pp->pp_flags &= ~PMC_FLAG_ENABLE_MSR_ACCESS;
+
 	pp->pp_refcnt--;
 
 	/* Remove the target process from the PMC structure */
@@ -784,7 +792,8 @@
 	KASSERT(ptgt != NULL, ("[pmc,%d] process %p (pp: %p) not found "
 		    "in pmc %p", __LINE__, pp->pp_proc, pp, pm));
 
-	PMCDBG(PRC,TUL,4, "unlink ptgt=%p", ptgt);
+	PMCDBG(PRC,TUL,4, "unlink ptgt=%p, enable-msr=%d", ptgt,
+	    (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) != 0);
 
 	LIST_REMOVE(ptgt, pt_next);
 	FREE(ptgt, M_PMC);
@@ -1159,10 +1168,10 @@
 			    "process-exit proc=%p pmc-process=%p", p, pp);
 
 			/*
-			 * This process could the target of some PMCs.
-			 * Such PMCs will thus be running on currently
-			 * executing CPU at this point in the code
-			 * since we've disallowed context switches.
+			 * The exiting process could the target of
+			 * some PMCs which will be running on
+			 * currently executing CPU.
+			 *
 			 * We need to turn these PMCs off like we
 			 * would do at context switch OUT time.
 			 */
@@ -1219,6 +1228,14 @@
 				atomic_subtract_rel_32(&pm->pm_runcount,1);
 				(void) md->pmd_config_pmc(cpu, ri, NULL);
 			}
+
+			/*
+			 * Inform the MD layer of this pseudo "context switch
+			 * out"
+			 */
+
+			(void) md->pmd_switch_out(pmc_pcpu[cpu], pp);
+
 			critical_exit(); /* ok to be pre-empted now */
 
 			/*
@@ -1475,7 +1492,7 @@
 		 * switch-in actions.
 		 */
 
-		(void) (*md->pmd_switch_in)(pc);
+		(void) (*md->pmd_switch_in)(pc, pp);
 
 		critical_exit();
 
@@ -1614,7 +1631,7 @@
 		 * switch out functions.
 		 */
 
-		(void) (*md->pmd_switch_out)(pc);
+		(void) (*md->pmd_switch_out)(pc, pp);
 
 		critical_exit();
 

==== //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_piv.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.4 2005/04/27 05:51:13 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.5 2005/04/28 08:13:18 jkoshy Exp $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -578,11 +578,19 @@
  */
 
 static int
-p4_switch_in(struct pmc_cpu *pc)
+p4_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
+
+	PMCDBG(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
+	    (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) != 0);
+
 	/* enable the RDPMC instruction */
-	load_cr4(rcr4() | CR4_PCE);
+	if (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS)
+		load_cr4(rcr4() | CR4_PCE);
+
+	PMCDBG(MDP,SWI,2, "cr4=0x%x", rcr4());
+
 	return 0;
 }
 
@@ -591,11 +599,18 @@
  */
 
 static int
-p4_switch_out(struct pmc_cpu *pc)
+p4_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
-	/* disallow RDPMC instruction */
+	(void) pp;		/* can be null */
+
+	PMCDBG(MDP,SWO,1, "pc=%p pp=%p", pc, pp);
+
+	/* always disallow the RDPMC instruction */
 	load_cr4(rcr4() & ~CR4_PCE);
+
+	PMCDBG(MDP,SWO,2, "cr4=0x%x", rcr4());
+
 	return 0;
 }
 
@@ -1419,7 +1434,10 @@
 	KASSERT(ri >= 0 && ri < P4_NPMCS,
 	    ("[p4,%d] ri %d out of range", __LINE__, ri));
 
-	*msr = p4_pmcdesc[ri].pm_pmc_msr;
+	*msr = p4_pmcdesc[ri].pm_pmc_msr - P4_PERFCTR_MSR_FIRST;
+
+	PMCDBG(MDP,OPS, 1, "ri=%d getmsr=0x%x", ri, *msr);
+
 	return 0;
 }
 

==== //depot/projects/trustedbsd/base/sys/dev/hwpmc/hwpmc_ppro.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_ppro.c,v 1.3 2005/04/27 05:51:13 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_ppro.c,v 1.4 2005/04/28 08:13:18 jkoshy Exp $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -332,16 +332,25 @@
 }
 
 static int
-p6_switch_in(struct pmc_cpu *pc)
+p6_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
+
+	/* allow the RDPMC instruction if needed */
+	if (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS)
+		load_cr4(rcr4() | CR4_PCE);
 	return 0;
 }
 
 static int
-p6_switch_out(struct pmc_cpu *pc)
+p6_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
 {
 	(void) pc;
+	(void) pp;		/* can be NULL */
+
+	/* always turn off the RDPMC instruction */
+	load_cr4(rcr4() & ~CR4_PCE);
+
 	return 0;
 }
 

==== //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio.c#7 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$NetBSD: uaudio.c,v 1.91 2004/11/05 17:46:14 kent Exp $	*/
-/*	$FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.13 2005/01/06 01:43:22 imp Exp $ */
+/*	$FreeBSD: src/sys/dev/sound/usb/uaudio.c,v 1.14 2005/04/27 17:16:27 julian Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -72,6 +72,7 @@
 #include <sys/poll.h>
 #if defined(__FreeBSD__)
 #include <sys/sysctl.h>
+#include <sys/sbuf.h>
 #endif
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -83,6 +84,7 @@
 #elif defined(__FreeBSD__)
 #include <dev/sound/pcm/sound.h>	/* XXXXX */
 #include <dev/sound/chip.h>
+#include "feeder_if.h"
 #endif
 
 #include <dev/usb/usb.h>
@@ -234,6 +236,10 @@
 	int		sc_nctls;	/* # of mixer controls */
 	device_ptr_t	sc_audiodev;
 	char		sc_dying;
+#if defined(__FreeBSD__)
+	struct sbuf	uaudio_sndstat;
+	int		uaudio_sndstat_flag;
+#endif
 };
 
 struct terminal_list {
@@ -444,6 +450,7 @@
 #elif defined(__FreeBSD__)
 Static int	audio_attach_mi(device_t);
 Static int	uaudio_init_params(struct uaudio_softc * sc, struct chan *ch, int mode);
+static int 	uaudio_sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose);
 
 /* for NetBSD compatibirity */
 #define	AUMODE_PLAY	0x01
@@ -642,6 +649,9 @@
 {
 	USB_DETACH_START(uaudio, sc);
 
+	sbuf_delete(&(sc->uaudio_sndstat));
+	sc->uaudio_sndstat_flag = 0;
+
 	sc->sc_dying = 1;
 
 #if 0 /* XXX */
@@ -1894,6 +1904,7 @@
 	const char *format_str;
 
 	asid = (const void *)(buf + offs);
+
 	if (asid->bDescriptorType != UDESC_CS_INTERFACE ||
 	    asid->bDescriptorSubtype != AS_GENERAL)
 		return (USBD_INVAL);
@@ -2068,6 +2079,28 @@
 		printf("Hz\n");
 	}
 #endif
+#if defined(__FreeBSD__)
+	if (sc->uaudio_sndstat_flag != 0) {
+		sbuf_printf(&(sc->uaudio_sndstat), "\n\t");
+		sbuf_printf(&(sc->uaudio_sndstat), 
+		    "mode %d:(%s) %dch, %d/%dbit, %s,", 
+		    id->bAlternateSetting,
+		    dir == UE_DIR_IN ? "input" : "output",
+		    chan, prec, asf1d->bSubFrameSize * 8, format_str);
+		if (asf1d->bSamFreqType == UA_SAMP_CONTNUOUS) {
+			sbuf_printf(&(sc->uaudio_sndstat), " %d-%dHz", 
+			    UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d));
+		} else {
+			int r;
+			sbuf_printf(&(sc->uaudio_sndstat), 
+			    " %d", UA_GETSAMP(asf1d, 0));
+			for (r = 1; r < asf1d->bSamFreqType; r++)
+				sbuf_printf(&(sc->uaudio_sndstat), 
+				    ",%d", UA_GETSAMP(asf1d, r));
+			sbuf_printf(&(sc->uaudio_sndstat), "Hz");
+		}
+	}
+#endif
 	ai.alt = id->bAlternateSetting;
 	ai.encoding = enc;
 	ai.attributes = sed->bmAttributes;
@@ -2106,6 +2139,11 @@
 	if (id == NULL)
 		return (USBD_INVAL);
 
+#if defined(__FreeBSD__)
+	sc->uaudio_sndstat_flag = 0;
+	if (sbuf_new(&(sc->uaudio_sndstat), NULL, 4096, SBUF_AUTOEXTEND) != NULL)
+		sc->uaudio_sndstat_flag = 1;
+#endif
 	/* Loop through all the alternate settings. */
 	while (offs <= size) {
 		DPRINTFN(2, ("uaudio_identify: interface=%d offset=%d\n",
@@ -2132,6 +2170,9 @@
 		if (id == NULL)
 			break;
 	}
+#if defined(__FreeBSD__)
+	sbuf_finish(&(sc->uaudio_sndstat));
+#endif
 	if (offs > size)
 		return (USBD_INVAL);
 	DPRINTF(("uaudio_identify_as: %d alts available\n", sc->sc_nalts));
@@ -4171,6 +4212,118 @@
 	return (1 << mc->slctrtype[mc->minval - 1]);
 }
 
+static int
+uaudio_sndstat_prepare_pcm(struct sbuf *s, device_t dev, int verbose)
+{
+    	struct snddev_info *d;
+    	struct snddev_channel *sce;
+	struct pcm_channel *c;
+	struct pcm_feeder *f;
+    	int pc, rc, vc;
+	device_t pa_dev = device_get_parent(dev);
+	struct uaudio_softc *sc = device_get_softc(pa_dev);
+
+	if (verbose < 1)
+		return 0;
+
+	d = device_get_softc(dev);
+	if (!d)
+		return ENXIO;
+
+	snd_mtxlock(d->lock);
+	if (SLIST_EMPTY(&d->channels)) {
+		sbuf_printf(s, " (mixer only)");
+		snd_mtxunlock(d->lock);
+		return 0;
+	}
+	pc = rc = vc = 0;
+	SLIST_FOREACH(sce, &d->channels, link) {
+		c = sce->channel;
+		if (c->direction == PCMDIR_PLAY) {
+			if (c->flags & CHN_F_VIRTUAL)
+				vc++;
+			else
+				pc++;
+		} else
+			rc++;
+	}
+	sbuf_printf(s, " (%dp/%dr/%dv channels%s%s)", 
+			d->playcount, d->reccount, d->vchancount,
+			(d->flags & SD_F_SIMPLEX)? "" : " duplex",
+#ifdef USING_DEVFS
+			(device_get_unit(dev) == snd_unit)? " default" : ""
+#else
+			""
+#endif
+			);
+
+	if (sc->uaudio_sndstat_flag != 0) {
+		sbuf_cat(s, sbuf_data(&(sc->uaudio_sndstat)));
+	}
+
+	if (verbose <= 1) {
+		snd_mtxunlock(d->lock);
+		return 0;
+	}
+
+	SLIST_FOREACH(sce, &d->channels, link) {
+		c = sce->channel;
+		sbuf_printf(s, "\n\t");
+
+		/* it would be better to indent child channels */
+		sbuf_printf(s, "%s[%s]: ", c->parentchannel? c->parentchannel->name : "", c->name);
+		sbuf_printf(s, "spd %d", c->speed);
+		if (c->speed != sndbuf_getspd(c->bufhard))
+			sbuf_printf(s, "/%d", sndbuf_getspd(c->bufhard));
+		sbuf_printf(s, ", fmt 0x%08x", c->format);
+		if (c->format != sndbuf_getfmt(c->bufhard))
+			sbuf_printf(s, "/0x%08x", sndbuf_getfmt(c->bufhard));
+		sbuf_printf(s, ", flags 0x%08x, 0x%08x", c->flags, c->feederflags);
+		if (c->pid != -1)
+			sbuf_printf(s, ", pid %d", c->pid);
+		sbuf_printf(s, "\n\t");
+
+		if (c->bufhard != NULL && c->bufsoft != NULL) {
+			sbuf_printf(s, "interrupts %d, ", c->interrupts);
+			if (c->direction == PCMDIR_REC)
+				sbuf_printf(s, "overruns %d, hfree %d, sfree %d",
+					c->xruns, sndbuf_getfree(c->bufhard), sndbuf_getfree(c->bufsoft));
+			else
+				sbuf_printf(s, "underruns %d, ready %d",
+					c->xruns, sndbuf_getready(c->bufsoft));
+			sbuf_printf(s, "\n\t");
+		}
+
+		sbuf_printf(s, "{%s}", (c->direction == PCMDIR_REC)? "hardware" : "userland");
+		sbuf_printf(s, " -> ");
+		f = c->feeder;
+		while (f->source != NULL)
+			f = f->source;
+		while (f != NULL) {
+			sbuf_printf(s, "%s", f->class->name);
+			if (f->desc->type == FEEDER_FMT)
+				sbuf_printf(s, "(0x%08x -> 0x%08x)", f->desc->in, f->desc->out);
+			if (f->desc->type == FEEDER_RATE)
+				sbuf_printf(s, "(%d -> %d)", FEEDER_GET(f, FEEDRATE_SRC), FEEDER_GET(f, FEEDRATE_DST));
+			if (f->desc->type == FEEDER_ROOT || f->desc->type == FEEDER_MIXER)
+				sbuf_printf(s, "(0x%08x)", f->desc->out);
+			sbuf_printf(s, " -> ");
+			f = f->parent;
+		}
+		sbuf_printf(s, "{%s}", (c->direction == PCMDIR_REC)? "userland" : "hardware");
+	}
+	snd_mtxunlock(d->lock);
+
+	return 0;
+}
+
+void
+uaudio_sndstat_register(device_t dev)
+{
+	struct snddev_info *d = device_get_softc(dev);
+	sndstat_register(dev, d->status, uaudio_sndstat_prepare_pcm);
+}
+	
 Static int
 audio_attach_mi(device_t dev)
 {

==== //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio.h#3 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/sound/usb/uaudio.h,v 1.5 2005/01/06 01:43:22 imp Exp $ */
+/* $FreeBSD: src/sys/dev/sound/usb/uaudio.h,v 1.6 2005/04/27 17:16:27 julian Exp $ */
 
 /*-
  * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu at navi.org>
@@ -50,3 +50,4 @@
 u_int32_t uaudio_query_mix_info(device_t dev);
 u_int32_t uaudio_query_recsrc_info(device_t dev);
 void	uaudio_query_formats(device_t dev, u_int32_t *pfmt, u_int32_t *rfmt);
+void	uaudio_sndstat_register(device_t dev);

==== //depot/projects/trustedbsd/base/sys/dev/sound/usb/uaudio_pcm.c#8 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.14 2005/04/17 16:26:08 matk Exp $ */
+/* $FreeBSD: src/sys/dev/sound/usb/uaudio_pcm.c,v 1.15 2005/04/27 17:16:27 julian Exp $ */
 
 /*-
  * Copyright (c) 2000-2002 Hiroyuki Aizu <aizu at navi.org>
@@ -344,6 +344,9 @@
 		return(ENXIO);
 	}
 
+	sndstat_unregister(dev);
+	uaudio_sndstat_register(dev);
+
 	pcm_addchan(dev, PCMDIR_PLAY, &ua_chan_class, ua);
 #ifndef NO_RECORDING
 	pcm_addchan(dev, PCMDIR_REC, &ua_chan_class, ua);

==== //depot/projects/trustedbsd/base/sys/dev/uart/uart_dev_z8530.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_z8530.c,v 1.11 2005/01/30 09:00:50 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_z8530.c,v 1.12 2005/04/27 21:57:51 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -213,7 +213,7 @@
 z8530_putc(struct uart_bas *bas, int c)
 {
 
-	while (!(uart_getmreg(bas, RR_BES) & BES_TXE))
+	while (!(uart_getreg(bas, REG_CTRL) & BES_TXE))
 		;
 	uart_setreg(bas, REG_DATA, c);
 	uart_barrier(bas);
@@ -223,7 +223,7 @@
 z8530_poll(struct uart_bas *bas)
 {
 
-	if (!(uart_getmreg(bas, RR_BES) & BES_RXA))
+	if (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
 		return (-1);
 	return (uart_getreg(bas, REG_DATA));
 }
@@ -232,7 +232,7 @@
 z8530_getc(struct uart_bas *bas)
 {
 
-	while (!(uart_getmreg(bas, RR_BES) & BES_RXA))
+	while (!(uart_getreg(bas, REG_CTRL) & BES_RXA))
 		;
 	return (uart_getreg(bas, REG_DATA));
 }

==== //depot/projects/trustedbsd/base/sys/i386/include/pmc_mdep.h#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/include/pmc_mdep.h,v 1.2 2005/04/20 20:22:33 marcel Exp $
+ * $FreeBSD: src/sys/i386/include/pmc_mdep.h,v 1.3 2005/04/28 08:13:19 jkoshy Exp $
  */
 
 /* Machine dependent interfaces */
@@ -123,6 +123,9 @@
 
 #define	P4_PERFCTR_MASK			0xFFFFFFFFFFLL /* 40 bits */
 
+#define	P4_CCCR_MSR_FIRST		0x360 /* MSR_BPU_CCCR0 */
+#define	P4_PERFCTR_MSR_FIRST		0x300 /* MSR_BPU_COUNTER0 */
+
 /* Intel PPro, Celeron, P-II, P-III, Pentium-M PMCS */
 
 #define	P6_NPMCS	3		/* 1 TSC + 2 PMCs */

==== //depot/projects/trustedbsd/base/sys/libkern/crc32.c#4 (text+ko) ====

@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/libkern/crc32.c,v 1.3 2005/01/07 00:24:32 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/libkern/crc32.c,v 1.5 2005/04/28 05:50:18 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -94,18 +94,21 @@
 	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
 };
 
-uint32_t
-crc32(const void *buf, size_t size)
-{
-	const uint8_t *p;
-	uint32_t crc;
-
-	p = buf;
-	crc = ~0U;
-
-	while (size--)
-		crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
-
-	return crc ^ ~0U;
-}
-
+/*
+ * A function that calculates the CRC-32 based on the table above is
+ * given below for documentation purposes. An equivalent implementation
+ * of this function that's actually used in the kernel can be found
+ * in sys/libkern.h, where it can be inlined.
+ *
+ *	uint32_t
+ *	crc32(const void *buf, size_t size)
+ *	{
+ *		const uint8_t *p = buf;
+ *		uint32_t crc;
+ *
+ *		crc = ~0U;
+ *		while (size--)
+ *			crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
+ *		return crc ^ ~0U;
+ *	}
+ */

==== //depot/projects/trustedbsd/base/sys/modules/hwpmc/Makefile#2 (text+ko) ====

@@ -1,8 +1,8 @@
 # 
-# $FreeBSD: src/sys/modules/hwpmc/Makefile,v 1.1 2005/04/19 04:01:24 jkoshy Exp $
+# $FreeBSD: src/sys/modules/hwpmc/Makefile,v 1.2 2005/04/28 00:53:45 jkoshy Exp $
 #
 
-.PATH: ${.CURDIR}/../../hwpmc
+.PATH: ${.CURDIR}/../../dev/hwpmc
 
 KMOD=	hwpmc
 

==== //depot/projects/trustedbsd/base/sys/nfsclient/nfs_vfsops.c#38 (text+ko) ====

@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_vfsops.c,v 1.172 2005/03/24 07:37:22 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_vfsops.c,v 1.173 2005/04/27 14:46:02 des Exp $");
 
 #include "opt_bootp.h"
 #include "opt_nfsroot.h"
@@ -513,9 +513,7 @@
 	int maxio;
 
 	s = splnet();
-	if (vfs_getopt(mp->mnt_optnew, "ro", NULL, NULL))
-		mp->mnt_flag &= ~MNT_RDONLY;
-	else
+	if (vfs_getopt(mp->mnt_optnew, "ro", NULL, NULL) == 0)
 		mp->mnt_flag |= MNT_RDONLY;
 	/*
 	 * Silently clear NFSMNT_NOCONN if it's a TCP mount, it makes

==== //depot/projects/trustedbsd/base/sys/sparc64/pci/apb.c#10 (text+ko) ====

@@ -30,7 +30,7 @@
  *

>>> TRUNCATED FOR MAIL (1000 lines) <<<
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list