PERFORCE change 146983 for review
Ed Schouten
ed at FreeBSD.org
Sat Aug 9 12:51:27 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146983
Change 146983 by ed at ed_dull on 2008/08/09 12:51:01
IFC.
Affected files ...
.. //depot/projects/mpsafetty/etc/defaults/rc.conf#3 integrate
.. //depot/projects/mpsafetty/etc/freebsd-update.conf#3 integrate
.. //depot/projects/mpsafetty/etc/rc.d/kernel#2 integrate
.. //depot/projects/mpsafetty/lib/libc/stdlib/malloc.c#3 integrate
.. //depot/projects/mpsafetty/lib/libc/sys/setfib.2#3 integrate
.. //depot/projects/mpsafetty/lib/libgeom/geom_xml2tree.c#3 integrate
.. //depot/projects/mpsafetty/sbin/ifconfig/ifconfig.8#4 integrate
.. //depot/projects/mpsafetty/sbin/ifconfig/ifieee80211.c#4 integrate
.. //depot/projects/mpsafetty/sbin/ifconfig/regdomain.c#2 integrate
.. //depot/projects/mpsafetty/share/man/man4/Makefile#4 integrate
.. //depot/projects/mpsafetty/share/man/man4/cpuctl.4#1 branch
.. //depot/projects/mpsafetty/share/man/man5/rc.conf.5#2 integrate
.. //depot/projects/mpsafetty/sys/Makefile#4 integrate
.. //depot/projects/mpsafetty/sys/amd64/amd64/pmap.c#11 integrate
.. //depot/projects/mpsafetty/sys/amd64/amd64/support.S#2 integrate
.. //depot/projects/mpsafetty/sys/amd64/conf/NOTES#3 integrate
.. //depot/projects/mpsafetty/sys/amd64/include/cpufunc.h#2 integrate
.. //depot/projects/mpsafetty/sys/amd64/include/specialreg.h#2 integrate
.. //depot/projects/mpsafetty/sys/boot/i386/boot2/boot2.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/i386/btx/btx/btx.S#2 integrate
.. //depot/projects/mpsafetty/sys/boot/i386/gptboot/gptboot.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/i386/loader/main.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/pc98/loader/main.c#2 integrate
.. //depot/projects/mpsafetty/sys/conf/files.amd64#2 integrate
.. //depot/projects/mpsafetty/sys/conf/files.i386#2 integrate
.. //depot/projects/mpsafetty/sys/dev/acpi_support/acpi_asus.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/cpuctl/cpuctl.c#1 branch
.. //depot/projects/mpsafetty/sys/dev/io/iodev.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/led/led.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/pccbb/pccbb.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/pci/pci.c#4 integrate
.. //depot/projects/mpsafetty/sys/geom/concat/g_concat.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_ccd.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_ctl.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_disk.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_kern.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_slice.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/geom_subr.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/part/g_part.c#2 integrate
.. //depot/projects/mpsafetty/sys/geom/stripe/g_stripe.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/conf/NOTES#3 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/support.s#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/cpufunc.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/specialreg.h#2 integrate
.. //depot/projects/mpsafetty/sys/kern/kern_descrip.c#3 integrate
.. //depot/projects/mpsafetty/sys/kern/subr_sbuf.c#2 integrate
.. //depot/projects/mpsafetty/sys/kern/vfs_mount.c#3 integrate
.. //depot/projects/mpsafetty/sys/modules/Makefile#5 integrate
.. //depot/projects/mpsafetty/sys/modules/cpuctl/Makefile#1 branch
.. //depot/projects/mpsafetty/sys/net80211/ieee80211_ioctl.c#2 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_bsd_addr.c#4 integrate
.. //depot/projects/mpsafetty/sys/security/mac_portacl/mac_portacl.c#2 integrate
.. //depot/projects/mpsafetty/sys/sys/cpuctl.h#1 branch
.. //depot/projects/mpsafetty/sys/sys/param.h#3 integrate
.. //depot/projects/mpsafetty/sys/sys/priv.h#2 integrate
.. //depot/projects/mpsafetty/sys/sys/sbuf.h#2 integrate
.. //depot/projects/mpsafetty/sys/sys/socket.h#3 integrate
.. //depot/projects/mpsafetty/tools/regression/geom/ConfCmp/ConfCmp.c#2 integrate
.. //depot/projects/mpsafetty/tools/regression/geom/MdLoad/MdLoad.c#2 integrate
.. //depot/projects/mpsafetty/tools/tools/nanobsd/nanobsd.sh#3 integrate
.. //depot/projects/mpsafetty/usr.sbin/Makefile#4 integrate
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/Makefile#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/amd.c#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/amd.h#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/cpucontrol.8#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/cpucontrol.c#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/cpucontrol.h#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/intel.c#1 branch
.. //depot/projects/mpsafetty/usr.sbin/cpucontrol/intel.h#1 branch
Differences ...
==== //depot/projects/mpsafetty/etc/defaults/rc.conf#3 (text+ko) ====
@@ -15,7 +15,7 @@
# For a more detailed explanation of all the rc.conf variables, please
# refer to the rc.conf(5) manual page.
#
-# $FreeBSD: src/etc/defaults/rc.conf,v 1.338 2008/08/01 05:15:54 dougb Exp $
+# $FreeBSD: src/etc/defaults/rc.conf,v 1.339 2008/08/09 01:19:00 obrien Exp $
##############################################################
### Important initial Boot-time options ####################
@@ -542,6 +542,7 @@
linux_enable="NO" # Linux binary compatibility loaded at startup (or NO).
svr4_enable="NO" # SysVR4 emulation loaded at startup (or NO).
+kernel_enable="NO" # Symlink kernel directory to /boot/kernel if not exist.
clear_tmp_enable="NO" # Clear /tmp at startup.
clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp
ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks
==== //depot/projects/mpsafetty/etc/freebsd-update.conf#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/freebsd-update.conf,v 1.5 2008/08/02 00:11:43 cperciva Exp $
+# $FreeBSD: src/etc/freebsd-update.conf,v 1.6 2008/08/08 10:36:16 cperciva Exp $
# Trusted keyprint. Changing this is a Bad Idea unless you've received
# a PGP-signed email from <security-officer at FreeBSD.org> telling you to
@@ -24,6 +24,9 @@
# Paths which start with anything matching an entry in an IDSIgnorePaths
# statement will be ignored by "freebsd-update IDS".
IDSIgnorePaths /usr/share/man/cat
+IDSIgnorePaths /usr/share/man/whatis
+IDSIgnorePaths /var/db/locate.database
+IDSIgnorePaths /var/log
# Paths which start with anything matching an entry in an UpdateIfUnmodified
# statement will only be updated if the contents of the file have not been
==== //depot/projects/mpsafetty/etc/rc.d/kernel#2 (text) ====
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $FreeBSD: src/etc/rc.d/kernel,v 1.2 2006/07/30 12:54:37 mckay Exp $
+# $FreeBSD: src/etc/rc.d/kernel,v 1.3 2008/08/09 01:19:00 obrien Exp $
#
# PROVIDE: kernel
@@ -10,6 +10,7 @@
. /etc/rc.subr
name="kernel"
+rcvar=`set_rcvar`
start_cmd="kernel_start"
stop_cmd=":"
==== //depot/projects/mpsafetty/lib/libc/stdlib/malloc.c#3 (text+ko) ====
@@ -128,7 +128,7 @@
#define MALLOC_DSS
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.173 2008/07/18 19:35:44 jasone Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.174 2008/08/08 20:42:42 cperciva Exp $");
#include "libc_private.h"
#ifdef MALLOC_DEBUG
@@ -2312,7 +2312,6 @@
arena_chunk_alloc(arena_t *arena)
{
arena_chunk_t *chunk;
- arena_run_t *run;
size_t i;
if (arena->spare != NULL) {
@@ -2337,8 +2336,6 @@
/*
* Initialize the map to contain one maximal free untouched run.
*/
- run = (arena_run_t *)((uintptr_t)chunk +
- (arena_chunk_header_npages << pagesize_2pow));
for (i = 0; i < arena_chunk_header_npages; i++)
chunk->map[i].bits = 0;
chunk->map[i].bits = arena_maxclass | CHUNK_MAP_ZEROED;
@@ -3536,7 +3533,7 @@
{
unsigned i;
arena_bin_t *bin;
- size_t pow2_size, prev_run_size;
+ size_t prev_run_size;
if (malloc_spin_init(&arena->lock))
return (true);
@@ -3583,7 +3580,6 @@
bin->reg_size = quantum * (i - ntbins + 1);
- pow2_size = pow2_ceil(quantum * (i - ntbins + 1));
prev_run_size = arena_bin_run_size_calc(bin, prev_run_size);
#ifdef MALLOC_STATS
==== //depot/projects/mpsafetty/lib/libc/sys/setfib.2#3 (text+ko) ====
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libc/sys/setfib.2,v 1.3 2008/07/25 01:09:36 julian Exp $
+.\" $FreeBSD: src/lib/libc/sys/setfib.2,v 1.4 2008/08/08 22:40:04 delphij Exp $
.\"
-.Dd May 9, 2008
+.Dd August 8, 2008
.Dt SETFIB 2
.Os
.Sh NAME
@@ -33,6 +33,7 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
+.In sys/socket.h
.Ft int
.Fn setfib "int fib"
.Sh DESCRIPTION
==== //depot/projects/mpsafetty/lib/libgeom/geom_xml2tree.c#3 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libgeom/geom_xml2tree.c,v 1.6 2008/07/08 17:34:50 lulf Exp $
+ * $FreeBSD: src/lib/libgeom/geom_xml2tree.c,v 1.7 2008/08/09 11:14:05 des Exp $
*/
#include <stdio.h>
@@ -68,7 +68,7 @@
mt = userData;
mt->level++;
- mt->sbuf[mt->level] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND);
+ mt->sbuf[mt->level] = sbuf_new_auto();
id = NULL;
ref = NULL;
for (i = 0; attr[i] != NULL; i += 2) {
==== //depot/projects/mpsafetty/sbin/ifconfig/ifconfig.8#4 (text+ko) ====
@@ -26,9 +26,9 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
-.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.150 2008/08/02 18:10:14 sam Exp $
+.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.151 2008/08/09 05:37:22 sam Exp $
.\"
-.Dd July 30, 2008
+.Dd August 8, 2008
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -1233,6 +1233,8 @@
(station supports WME),
.Cm WPA
(station supports WPA),
+.Cm WPS
+(station supports WPS),
.Cm RSN
(station supports 802.11i/RSN),
.Cm HTCAP
==== //depot/projects/mpsafetty/sbin/ifconfig/ifieee80211.c#4 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.55 2008/08/02 18:10:14 sam Exp $
+ * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.56 2008/08/09 05:37:22 sam Exp $
*/
/*-
@@ -2441,6 +2441,79 @@
}
}
+/* XXX move to a public include file */
+#define IEEE80211_WPS_DEV_PASS_ID 0x1012
+#define IEEE80211_WPS_SELECTED_REG 0x1041
+#define IEEE80211_WPS_SETUP_STATE 0x1044
+#define IEEE80211_WPS_UUID_E 0x1047
+#define IEEE80211_WPS_VERSION 0x104a
+
+#define BE_READ_2(p) \
+ ((u_int16_t) \
+ ((((const u_int8_t *)(p))[1] ) | \
+ (((const u_int8_t *)(p))[0] << 8)))
+
+static void
+printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+{
+#define N(a) (sizeof(a) / sizeof(a[0]))
+ u_int8_t len = ie[1];
+
+ printf("%s", tag);
+ if (verbose) {
+ static const char *dev_pass_id[] = {
+ "D", /* Default (PIN) */
+ "U", /* User-specified */
+ "M", /* Machine-specified */
+ "K", /* Rekey */
+ "P", /* PushButton */
+ "R" /* Registrar-specified */
+ };
+ int n;
+
+ ie +=6, len -= 4; /* NB: len is payload only */
+
+ /* WPS IE in Beacon and Probe Resp frames have different fields */
+ printf("<");
+ while (len) {
+ uint16_t tlv_type = BE_READ_2(ie);
+ uint16_t tlv_len = BE_READ_2(ie + 2);
+
+ ie += 4, len -= 4;
+
+ switch (tlv_type) {
+ case IEEE80211_WPS_VERSION:
+ printf("v:%d.%d", *ie >> 4, *ie & 0xf);
+ break;
+ case IEEE80211_WPS_SETUP_STATE:
+ /* Only 1 and 2 are valid */
+ if (*ie == 0 || *ie >= 3)
+ printf(" state:B");
+ else
+ printf(" st:%s", *ie == 1 ? "N" : "C");
+ break;
+ case IEEE80211_WPS_SELECTED_REG:
+ printf(" sel:%s", *ie ? "T" : "F");
+ break;
+ case IEEE80211_WPS_DEV_PASS_ID:
+ n = LE_READ_2(ie);
+ if (n < N(dev_pass_id))
+ printf(" dpi:%s", dev_pass_id[n]);
+ break;
+ case IEEE80211_WPS_UUID_E:
+ printf(" uuid-e:");
+ for (n = 0; n < (tlv_len - 1); n++)
+ printf("%02x-", ie[n]);
+ printf("%02x", ie[n]);
+ break;
+ }
+ ie += tlv_len, len -= tlv_len;
+ }
+ printf(">");
+ }
+#undef N
+}
+
/*
* Copy the ssid string contents into buf, truncating to fit. If the
* ssid is entirely printable then just copy intact. Otherwise convert
@@ -2563,6 +2636,12 @@
return frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);
}
+static __inline int
+iswpsoui(const uint8_t *frm)
+{
+ return frm[1] > 3 && LE_READ_4(frm+2) == ((WPS_OUI_TYPE<<24)|WPA_OUI);
+}
+
static const char *
iename(int elemid)
{
@@ -2624,6 +2703,8 @@
printwmeparam(" WME", vp, 2+vp[1], maxcols);
else if (isatherosoui(vp))
printathie(" ATH", vp, 2+vp[1], maxcols);
+ else if (iswpsoui(vp))
+ printwpsie(" WPS", vp, 2+vp[1], maxcols);
else if (verbose)
printie(" VEN", vp, 2+vp[1], maxcols);
break;
==== //depot/projects/mpsafetty/sbin/ifconfig/regdomain.c#2 (text+ko) ====
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef lint
-static const char rcsid[] = "$FreeBSD: src/sbin/ifconfig/regdomain.c,v 1.2 2008/05/08 14:01:42 cokane Exp $";
+static const char rcsid[] = "$FreeBSD: src/sbin/ifconfig/regdomain.c,v 1.3 2008/08/09 11:14:05 des Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -78,7 +78,7 @@
/* XXX force parser to abort */
return;
}
- mt->sbuf[mt->level] = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND);
+ mt->sbuf[mt->level] = sbuf_new_auto();
id = ref = mode = NULL;
for (i = 0; attr[i] != NULL; i += 2) {
if (iseq(attr[i], "id")) {
==== //depot/projects/mpsafetty/share/man/man4/Makefile#4 (text+ko) ====
@@ -1,5 +1,5 @@
# @(#)Makefile 8.1 (Berkeley) 6/18/93
-# $FreeBSD: src/share/man/man4/Makefile,v 1.422 2008/07/14 18:15:43 brueffer Exp $
+# $FreeBSD: src/share/man/man4/Makefile,v 1.423 2008/08/08 16:26:53 stas Exp $
MAN= aac.4 \
acpi.4 \
@@ -52,6 +52,7 @@
cmx.4 \
coda.4 \
${_coretemp.4} \
+ ${_cpuctl.4} \
cpufreq.4 \
crypto.4 \
cue.4 \
@@ -552,6 +553,7 @@
_amdsmb.4= amdsmb.4
_asmc.4= asmc.4
_coretemp.4= coretemp.4
+_cpuctl.4= cpuctl.4
_hptiop.4= hptiop.4
_hptmv.4= hptmv.4
_hptrr.4= hptrr.4
==== //depot/projects/mpsafetty/share/man/man5/rc.conf.5#2 (text+ko) ====
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.343 2008/06/21 13:53:35 simon Exp $
+.\" $FreeBSD: src/share/man/man5/rc.conf.5,v 1.344 2008/08/09 06:35:19 obrien Exp $
.\"
.Dd June 21, 2008
.Dt RC.CONF 5
@@ -3116,6 +3116,16 @@
If set to
.Dq Li YES ,
load System V IPC primitives at boot time.
+.It Va kernel_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to symlink
+.Pa /boot/kernel
+to the directory that contains the kernel you booted from,
+unless
+.Pa /boot/kernel
+already exists and is not a symlink.
.It Va clear_tmp_enable
.Pq Vt bool
Set to
@@ -3888,7 +3898,7 @@
.It Va bthidd_hids
.Pq Vt str
Path to a file, where
-.Xr bthidd 8
+.Xr bthidd 8
will store information about known HID devices.
Default
.Pa /var/db/bthidd.hids .
==== //depot/projects/mpsafetty/sys/Makefile#4 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/Makefile,v 1.51 2008/07/20 09:16:00 maxim Exp $
+# $FreeBSD: src/sys/Makefile,v 1.52 2008/08/08 18:00:33 philip Exp $
.include <bsd.own.mk>
@@ -44,4 +44,11 @@
rm -f ${.CURDIR}/TAGS
cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
+# You need the textproc/glimpse ports for this.
+glimpse:
+ cd ${.CURDIR}; glimpseindex -H . -B -f -o .
+
+glimpse-clean:
+ cd ${.CURDIR}; rm -f .glimpse_*
+
.include <bsd.subdir.mk>
==== //depot/projects/mpsafetty/sys/amd64/amd64/pmap.c#11 (text+ko) ====
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.644 2008/08/07 04:56:29 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.645 2008/08/09 05:46:13 alc Exp $");
/*
* Manages physical address maps.
@@ -4417,6 +4417,25 @@
return (TRUE);
}
+/*
+ * Changes the specified virtual address range's memory type to that given by
+ * the parameter "mode". The specified virtual address range must be
+ * completely contained within either the direct map or the kernel map. If
+ * the virtual address range is contained within the kernel map, then the
+ * memory type for each of the corresponding ranges of the direct map is also
+ * changed. (The corresponding ranges of the direct map are those ranges that
+ * map the same physical pages as the specified virtual address range.) These
+ * changes to the direct map are necessary because Intel describes the
+ * behavior of their processors as "undefined" if two or more mappings to the
+ * same physical page have different memory types.
+ *
+ * Returns zero if the change completed successfully, and either EINVAL or
+ * ENOMEM if the change failed. Specifically, EINVAL is returned if some part
+ * of the virtual address range was not mapped, and ENOMEM is returned if
+ * there was insufficient memory available to complete the change. In the
+ * latter case, the memory type may have been changed on some part of the
+ * virtual address range or the direct map.
+ */
int
pmap_change_attr(vm_offset_t va, vm_size_t size, int mode)
{
@@ -4432,10 +4451,11 @@
pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode)
{
vm_offset_t base, offset, tmpva;
+ vm_paddr_t pa_start, pa_end;
pdp_entry_t *pdpe;
pd_entry_t *pde;
pt_entry_t *pte;
- int cache_bits_pte, cache_bits_pde;
+ int cache_bits_pte, cache_bits_pde, error;
boolean_t changed;
PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED);
@@ -4521,11 +4541,13 @@
return (EINVAL);
tmpva += PAGE_SIZE;
}
+ error = 0;
/*
* Ok, all the pages exist, so run through them updating their
* cache mode if required.
*/
+ pa_start = pa_end = 0;
for (tmpva = base; tmpva < base + size; ) {
pdpe = pmap_pdpe(kernel_pmap, tmpva);
if (*pdpe & PG_PS) {
@@ -4536,6 +4558,25 @@
if (!changed)
changed = TRUE;
}
+ if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+ if (pa_start == pa_end) {
+ /* Start physical address run. */
+ pa_start = *pdpe & PG_PS_FRAME;
+ pa_end = pa_start + NBPDP;
+ } else if (pa_end == (*pdpe & PG_PS_FRAME))
+ pa_end += NBPDP;
+ else {
+ /* Run ended, update direct map. */
+ error = pmap_change_attr_locked(
+ PHYS_TO_DMAP(pa_start),
+ pa_end - pa_start, mode);
+ if (error != 0)
+ break;
+ /* Start physical address run. */
+ pa_start = *pdpe & PG_PS_FRAME;
+ pa_end = pa_start + NBPDP;
+ }
+ }
tmpva = trunc_1gpage(tmpva) + NBPDP;
continue;
}
@@ -4548,6 +4589,25 @@
if (!changed)
changed = TRUE;
}
+ if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+ if (pa_start == pa_end) {
+ /* Start physical address run. */
+ pa_start = *pde & PG_PS_FRAME;
+ pa_end = pa_start + NBPDR;
+ } else if (pa_end == (*pde & PG_PS_FRAME))
+ pa_end += NBPDR;
+ else {
+ /* Run ended, update direct map. */
+ error = pmap_change_attr_locked(
+ PHYS_TO_DMAP(pa_start),
+ pa_end - pa_start, mode);
+ if (error != 0)
+ break;
+ /* Start physical address run. */
+ pa_start = *pde & PG_PS_FRAME;
+ pa_end = pa_start + NBPDR;
+ }
+ }
tmpva = trunc_2mpage(tmpva) + NBPDR;
} else {
if (cache_bits_pte < 0)
@@ -4558,9 +4618,31 @@
if (!changed)
changed = TRUE;
}
+ if (tmpva >= VM_MIN_KERNEL_ADDRESS) {
+ if (pa_start == pa_end) {
+ /* Start physical address run. */
+ pa_start = *pte & PG_FRAME;
+ pa_end = pa_start + PAGE_SIZE;
+ } else if (pa_end == (*pte & PG_FRAME))
+ pa_end += PAGE_SIZE;
+ else {
+ /* Run ended, update direct map. */
+ error = pmap_change_attr_locked(
+ PHYS_TO_DMAP(pa_start),
+ pa_end - pa_start, mode);
+ if (error != 0)
+ break;
+ /* Start physical address run. */
+ pa_start = *pte & PG_FRAME;
+ pa_end = pa_start + PAGE_SIZE;
+ }
+ }
tmpva += PAGE_SIZE;
}
}
+ if (error == 0 && pa_start != pa_end)
+ error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start),
+ pa_end - pa_start, mode);
/*
* Flush CPU caches if required to make sure any data isn't cached that
@@ -4570,7 +4652,7 @@
pmap_invalidate_range(kernel_pmap, base, tmpva);
pmap_invalidate_cache();
}
- return (0);
+ return (error);
}
/*
==== //depot/projects/mpsafetty/sys/amd64/amd64/support.S#2 (text+ko) ====
@@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.128 2007/08/22 05:06:14 jkoshy Exp $
+ * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.129 2008/08/08 16:26:53 stas Exp $
*/
#include "opt_ddb.h"
@@ -716,3 +716,47 @@
movq %rax,32(%rdi)
movq %rdi,bbhead
NON_GPROF_RET
+
+/*
+ * Support for reading MSRs in the safe manner.
+ */
+ENTRY(rdmsr_safe)
+/* int rdmsr_safe(u_int msr, uint64_t *data) */
+ movq PCPU(CURPCB),%r8
+ movq $msr_onfault,PCB_ONFAULT(%r8)
+ movl %edi,%ecx
+ rdmsr /* Read MSR pointed by %ecx. Returns
+ hi byte in edx, lo in %eax */
+ salq $32,%rdx /* sign-shift %rdx left */
+ cltq /* sign-extend %eax -> %rax */
+ orq %rdx,%rax
+ movq %rax,(%rsi)
+ xorq %rax,%rax
+ movq %rax,PCB_ONFAULT(%r8)
+ ret
+
+/*
+ * Support for writing MSRs in the safe manner.
+ */
+ENTRY(wrmsr_safe)
+/* int wrmsr_safe(u_int msr, uint64_t data) */
+ movq PCPU(CURPCB),%r8
+ movq $msr_onfault,PCB_ONFAULT(%r8)
+ movl %edi,%ecx
+ movl %esi,%eax
+ sarq $32,%rsi
+ movl %esi,%edx
+ wrmsr /* Write MSR pointed by %ecx. Accepts
+ hi byte in edx, lo in %eax. */
+ xorq %rax,%rax
+ movq %rax,PCB_ONFAULT(%r8)
+ ret
+
+/*
+ * MSR operations fault handler
+ */
+ ALIGN_TEXT
+msr_onfault:
+ movq $0,PCB_ONFAULT(%r8)
+ movl $EFAULT,%eax
+ ret
==== //depot/projects/mpsafetty/sys/amd64/conf/NOTES#3 (text+ko) ====
@@ -4,7 +4,7 @@
# This file contains machine dependent kernel configuration notes. For
# machine independent notes, look in /sys/conf/NOTES.
#
-# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.81 2008/08/03 10:32:17 ed Exp $
+# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.82 2008/08/08 16:26:53 stas Exp $
#
#
@@ -401,6 +401,12 @@
device k8temp
#
+# CPU control pseudo-device. Provides access to MSRs, CPUID info and
+# microcode update feature.
+#
+device cpuctl
+
+#
# System Management Bus (SMB)
#
options ENABLE_ALART # Control alarm on Intel intpm driver
==== //depot/projects/mpsafetty/sys/amd64/include/cpufunc.h#2 (text+ko) ====
@@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/cpufunc.h,v 1.149 2008/04/18 05:47:56 jeff Exp $
+ * $FreeBSD: src/sys/amd64/include/cpufunc.h,v 1.150 2008/08/08 16:26:53 stas Exp $
*/
/*
@@ -790,4 +790,9 @@
void reset_dbregs(void);
+#ifdef _KERNEL
+int rdmsr_safe(u_int msr, uint64_t *val);
+int wrmsr_safe(u_int msr, uint64_t newval);
+#endif
+
#endif /* !_MACHINE_CPUFUNC_H_ */
==== //depot/projects/mpsafetty/sys/amd64/include/specialreg.h#2 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* from: @(#)specialreg.h 7.1 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.45 2008/03/12 22:09:19 jhb Exp $
+ * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.46 2008/08/08 16:26:53 stas Exp $
*/
#ifndef _MACHINE_SPECIALREG_H_
@@ -166,6 +166,12 @@
#define AMDID_CMP_CORES 0x000000ff
/*
+ * CPUID manufacturers identifiers
+ */
+#define INTEL_VENDOR_ID "GenuineIntel"
+#define AMD_VENDOR_ID "AuthenticAMD"
+
+/*
* Model-specific registers for the i386 family
*/
#define MSR_P5_MC_ADDR 0x000
@@ -414,5 +420,6 @@
#define MSR_IORRMASK1 0xc0010019
#define MSR_TOP_MEM 0xc001001a /* boundary for ram below 4G */
#define MSR_TOP_MEM2 0xc001001d /* boundary for ram above 4G */
+#define MSR_K8_UCODE_UPDATE 0xc0010020 /* update microcode */
#endif /* !_MACHINE_SPECIALREG_H_ */
==== //depot/projects/mpsafetty/sys/boot/i386/boot2/boot2.c#2 (text+ko) ====
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.87 2008/07/01 11:18:51 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.88 2008/08/08 19:41:20 jhb Exp $");
#include <sys/param.h>
#include <sys/disklabel.h>
@@ -24,6 +24,7 @@
#include <machine/bootinfo.h>
#include <machine/elf.h>
+#include <machine/psl.h>
#include <stdarg.h>
@@ -83,8 +84,8 @@
#define NDEV 3
#define MEM_BASE 0x12
#define MEM_EXT 0x15
-#define V86_CY(x) ((x) & 1)
-#define V86_ZR(x) ((x) & 0x40)
+#define V86_CY(x) ((x) & PSL_C)
+#define V86_ZR(x) ((x) & PSL_Z)
#define DRV_HARD 0x80
#define DRV_MASK 0x7f
@@ -237,6 +238,7 @@
dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
v86.ctl = V86_FLAGS;
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
dsk.drive = *(uint8_t *)PTOV(ARGS);
dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
dsk.unit = dsk.drive & DRV_MASK;
==== //depot/projects/mpsafetty/sys/boot/i386/btx/btx/btx.S#2 (text+ko) ====
@@ -12,7 +12,7 @@
* warranties of merchantability and fitness for a particular
* purpose.
*
- * $FreeBSD: src/sys/boot/i386/btx/btx/btx.S,v 1.46 2008/03/10 21:43:31 jhb Exp $
+ * $FreeBSD: src/sys/boot/i386/btx/btx/btx.S,v 1.47 2008/08/08 19:39:11 jhb Exp $
*/
/*
@@ -34,6 +34,13 @@
.set PAG_SIZ,0x1000 # Page size
.set PAG_CNT,0x1000 # Pages to map
/*
+ * Fields in %eflags.
+ */
+ .set PSL_T,0x00000100 # Trap flag
+ .set PSL_I,0x00000200 # Interrupt enable flag
+ .set PSL_VM,0x00020000 # Virtual 8086 mode flag
+ .set PSL_AC,0x00040000 # Alignment check flag
+/*
* Segment selectors.
*/
.set SEL_SCODE,0x8 # Supervisor code
@@ -369,7 +376,7 @@
je except.3 # Yes
cmpb $0x1,(%esp,1) # Debug?
jne except.2a # No
- testl $0x100,0x10(%esp,1) # Trap flag set?
+ testl $PSL_T,0x10(%esp,1) # Trap flag set?
jnz except.3 # Yes
except.2a: jmp exit # Exit
except.3: leal 0x8(%esp,1),%esp # Discard err, int no
@@ -473,16 +480,13 @@
movl (%ebx),%ebp # btx_v86 pointer
addl %ebp,%edx # Flatten btx_v86 ptr
movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr
- movl -0x08(%esi),%ebx # Pass user flags to
- movw %bx,MEM_ESPR-0x12 # real mode target
movl V86_ADDR(%edx),%eax # Get int no/address
movl V86_CTL(%edx),%edx # Get control flags
jmp intusr.3 # Skip hardware interrupt
/*
* Hardware interrupts store a NULL btx_v86 pointer and use the address
* (interrupt number) from the stack with empty flags. Also, we clear
- * the segment registers for the interrupt handler and ensure interrupts
- * are disabled when the interrupt handler is invoked.
+ * the segment registers for the interrupt handler.
*/
intusr.2: xorl %edx,%edx # Control flags
movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr
@@ -490,17 +494,22 @@
movl %edx,-0x3c(%esi) # Real mode %fs of 0
movl %edx,-0x40(%esi) # Real mode %ds of 0
movl %edx,-0x44(%esi) # Real mode %es of 0
- movl -0x08(%esi),%ebx # Pass user flags with
- andl $~0x200,%ebx # interrupts disabled
- movw %bx,MEM_ESPR-0x12 # to real mode target
/*
* %eax now holds either the interrupt number or segment:offset of function.
* %edx now holds the V86F_* flags.
+ *
+ * For interrupt handler invocations (either hardware interrupts or VM86
+ * INTx requests) we also disable interrupts, tracing, and alignment checking
+ * while the handler runs.
*/
-intusr.3: testl $V86F_ADDR,%edx # Segment:offset?
+intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx
+ testl $V86F_ADDR,%edx # Segment:offset?
jnz intusr.4 # Yes
shll $0x2,%eax # Scale
movl (%eax),%eax # Load int vector
+ andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing,
+ # and alignment checking for
+ # interrupt handler
jmp intusr.5 # Skip CALLF test
intusr.4: testl $V86F_CALLF,%edx # Far call?
jnz intusr.5 # Ok
@@ -513,10 +522,12 @@
popl %gs
popal # Restore gp regs
jmp ex_noc # Panic
+intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode
+ # target
/*
* If this is a v86 call, copy the seg regs out of the btx_v86 structure.
*/
-intusr.5: movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr
+ movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr
jecxz intusr.6 # Skip for hardware ints
leal -0x44(%esi),%edi # %edi => kernel stack seg regs
pushl %esi # Save
@@ -696,7 +707,7 @@
dump.2: testb $DMP_MEM,%ch # Dump memory?
jz dump.8 # No
pushl %ds # Save
- testb $0x2,0x52(%ebx) # V86 mode?
+ testl $PSL_VM,0x50(%ebx) # V86 mode?
jnz dump.3 # Yes
verr 0x4(%esi) # Readable selector?
jnz dump.3 # No
==== //depot/projects/mpsafetty/sys/boot/i386/gptboot/gptboot.c#2 (text+ko) ====
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/gptboot/gptboot.c,v 1.87 2008/02/28 17:08:05 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/gptboot/gptboot.c,v 1.88 2008/08/08 19:41:20 jhb Exp $");
#include <sys/param.h>
#include <sys/gpt.h>
@@ -23,6 +23,7 @@
#include <machine/bootinfo.h>
#include <machine/elf.h>
+#include <machine/psl.h>
#include <stdarg.h>
@@ -81,8 +82,8 @@
#define NDEV 3
#define MEM_BASE 0x12
#define MEM_EXT 0x15
-#define V86_CY(x) ((x) & 1)
-#define V86_ZR(x) ((x) & 0x40)
+#define V86_CY(x) ((x) & PSL_C)
+#define V86_ZR(x) ((x) & PSL_Z)
#define DRV_HARD 0x80
#define DRV_MASK 0x7f
@@ -235,6 +236,7 @@
dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base);
v86.ctl = V86_FLAGS;
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
dsk.drive = *(uint8_t *)PTOV(ARGS);
dsk.type = dsk.drive & DRV_HARD ? TYPE_AD : TYPE_FD;
dsk.unit = dsk.drive & DRV_MASK;
==== //depot/projects/mpsafetty/sys/boot/i386/loader/main.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.41 2007/10/24 04:03:25 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.42 2008/08/08 19:41:20 jhb Exp $");
/*
* MD bootstrap main() and assorted miscellaneous
@@ -35,6 +35,7 @@
#include <stand.h>
#include <string.h>
#include <machine/bootinfo.h>
+#include <machine/psl.h>
#include <sys/reboot.h>
#include "bootstrap.h"
@@ -86,6 +87,10 @@
initial_bootdev = kargs->bootdev;
initial_bootinfo = kargs->bootinfo ? (struct bootinfo *)PTOV(kargs->bootinfo) : NULL;
+ /* Initialize the v86 register set to a known-good state. */
+ bzero(&v86, sizeof(v86));
+ v86.efl = PSL_RESERVED_DEFAULT | PSL_I;
+
/*
* Initialise the heap as early as possible. Once this is done, malloc() is usable.
*/
==== //depot/projects/mpsafetty/sys/boot/pc98/loader/main.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/pc98/loader/main.c,v 1.25 2007/10/24 11:54:04 nyan Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/pc98/loader/main.c,v 1.26 2008/08/08 19:41:20 jhb Exp $");
/*
* MD bootstrap main() and assorted miscellaneous
@@ -35,6 +35,7 @@
#include <stand.h>
#include <string.h>
#include <machine/bootinfo.h>
+#include <machine/psl.h>
#include <sys/reboot.h>
#include "bootstrap.h"
@@ -86,6 +87,10 @@
initial_bootdev = kargs->bootdev;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list