freebsd-dev/usr.sbin
David Malone b0f4bb511e Make the MTRR code a bit more defensive - this should help people
trying to run X on some Athlon systems where the BIOS does odd things
(mines an ASUS A7A266, but it seems to also help on other systems).

Here's a description of the problem and my fix:

        The problem with the old MTRR code is that it only expects
        to find documented values in the bytes of MTRR registers.
        To convert the MTRR byte into a FreeBSD "Memory Range Type"
        (mrt) it uses the byte value and looks it up in an array.
        If the value is not in range then the mrt value ends up
        containing random junk.

        This isn't an immediate problem. The mrt value is only used
        later when rewriting the MTRR registers. When we finally
        go to write a value back again, the function i686_mtrrtype()
        searches for the junk value and returns -1 when it fails
        to find it. This is converted to a byte (0xff) and written
        back to the register, causing a GPF as 0xff is an illegal
        value for a MTRR byte.

	To work around this problem I've added a new mrt flag
	MDF_UNKNOWN.  We set this when we read a MTRR byte which
	we do not understand.  If we try to convert a MDF_UNKNOWN
	back into a MTRR value, then the new function, i686_mrt2mtrr,
	just returns the old value of the MTRR byte. This leaves
	the memory range type unchanged.

I have seen one side effect of the fix, which is that ACPI calls
after X has been run seem to hang my machine. As running X would
previously panic the machine, this is still an improvement ;-)

I'd like to MFC this before the 4.6 code freeze - please let me
know if it causes any problems.

PR:		28418, 25958
Tested by:	jkh, Christopher Masto <chris@netmonger.net>
MFC after:	2 weeks
2002-04-14 20:19:13 +00:00
..
ac I've been meaning to do this for a while. Add an underscore to the 2002-01-19 23:20:02 +00:00
accton Fix typo: to examining -> to examine. 2002-03-08 01:29:06 +00:00
acpi Fix bug on method local named object related panic and Bankfield 2002-03-02 15:05:26 +00:00
adduser Found a single point where rmuser(8) wasn't robust to strange 2002-02-11 15:26:20 +00:00
amd Stop "make depend" from attempting to delete non-existent .depend. 2002-04-11 12:30:20 +00:00
ancontrol Fix typo: capablities -> capabilities. 2002-03-08 01:59:52 +00:00
apm Minor grammar fix: 2002-03-08 12:48:05 +00:00
apmd Handle snprintf() returning < 0 (not just -1) 2001-08-20 15:09:34 +00:00
arp GCC 3.1 cleanup - add a break after default: at the end of a switch 2002-04-07 12:05:05 +00:00
atm Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
boot0cfg WARNS=2 cleanup. 2001-12-11 06:44:29 +00:00
boot98cfg Fix typo: s/secotor/sector/. 2002-03-08 13:50:28 +00:00
bootparamd can not -> cannot 2001-08-08 18:32:06 +00:00
btxld mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
burncd Dont quit prematurely when writing from stdin... 2002-04-05 19:35:41 +00:00
cdcontrol o Move NTOHL() and associated macros into <sys/param.h>. These are 2002-02-18 20:35:27 +00:00
chkgrp Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
chown chown(8) was not describing symlinks correctly, fixed. 2002-04-09 20:24:23 +00:00
chroot Pedantry to satisfy the bin/34159 author. 2002-03-15 12:24:44 +00:00
ckdist mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
config Add a hint about -DNO_WERROR 2002-02-25 21:59:57 +00:00
cron Only remove the '\n' at the end of a line if there is one. 2002-04-10 22:01:37 +00:00
crunch Add a "special progname lib xxx ..." command to crunchgen 2002-03-30 16:48:30 +00:00
ctm Modernize my email address. 2002-03-25 14:12:49 +00:00
daemon mdoc(7) police: minor formatting tweaks. 2001-08-31 12:52:50 +00:00
dev_mkdb o remove __P 2002-03-18 07:23:41 +00:00
devinfo Reorder WARNS line for style. 2001-12-10 21:13:36 +00:00
digictl Reorder WARNS line for style. 2001-12-10 21:13:36 +00:00
editmap Add editmap, a new utility which comes with sendmail 8.12 for editing maps in 2002-02-17 22:02:59 +00:00
edquota Reorder WARNS line for style. 2001-12-10 21:13:36 +00:00
elf2aout Utility to create a.out [kernels] from an ELF one. 2002-03-28 02:17:27 +00:00
elf2exe mdoc(7) police: simplify literal display block. 2001-08-20 08:29:55 +00:00
extattrctl Simplify and optimize. This speeds up 'initattr' enormously for small 2002-04-06 05:02:54 +00:00
faithd s/sysctl -w/sysctl/ 2001-12-11 08:29:10 +00:00
fdcontrol mdoc(7) police: tidy up the markup. 2002-01-10 17:41:22 +00:00
fdformat Include <string.h> for some prototypes, rather than depending on 2002-04-01 21:13:17 +00:00
fdread Long promised major enhancement set for the floppy disk driver: 2001-12-15 19:09:04 +00:00
fdwrite Modernize my email address. 2002-03-25 14:12:49 +00:00
getextattr NAI DBA update. 2002-03-14 21:58:58 +00:00
gifconfig mdoc(7) police: fix markup, remove stray .Xr. 2001-12-21 08:10:28 +00:00
i4b Add support for Q.931 subaddresses. 2002-03-26 15:13:54 +00:00
ifmcstat Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
inetd Introduce a version field to `struct xucred' in place of one of the 2002-02-27 04:45:37 +00:00
iostat Redo patch in 1.22 such that the header printing is reset when the 2001-09-26 19:35:03 +00:00
ipftest * ipftest now compiles with IPFILTER_LOG and needs ip_log.c to be able to 2002-03-20 08:57:10 +00:00
ipresend Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
ipsend Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
iptest Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
IPXrouted o Move NTOHL() and associated macros into <sys/param.h>. These are 2002-02-18 20:35:27 +00:00
jail - Attempt to help declutter kern. sysctl by moving security out from 2002-01-16 06:55:30 +00:00
kbdcontrol FreeBSD 4.1 bootstrapping aid (HALT and PDWN are not defined there). 2002-02-08 09:37:12 +00:00
kbdmap mdoc(7) police: s/vidmap/vidfont/, don't xref to itself. 2001-09-04 13:10:28 +00:00
kernbb Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
keyadmin Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
keyserv Readded the svc_create() and the registering of the local transport, 2002-02-06 19:15:34 +00:00
kgmon Update kgmon.8 to refer to /boot/kernel/kernel on -CURRENT, rather than 2002-03-28 00:16:49 +00:00
kgzip mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
kldxref Make kldxref work for Elf64 (which has 32 bit hash tables) 2002-04-11 09:30:15 +00:00
lastlogin I've been meaning to do this for a while. Add an underscore to the 2002-01-19 23:20:02 +00:00
lpr A variable had been unnecessarily assigned a bogus value because gcc was 2002-04-07 08:12:39 +00:00
lptcontrol Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
mailstats Update build infrastructure for sendmail 8.12. 2002-02-17 22:05:07 +00:00
mailwrapper Add the missing hoststat and purgestat commands. These are normally 2002-04-05 04:25:14 +00:00
makemap Update build infrastructure for sendmail 8.12. 2002-02-17 22:05:07 +00:00
manctl Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
memcontrol Make the MTRR code a bit more defensive - this should help people 2002-04-14 20:19:13 +00:00
mergemaster Solve the problem of spuriously comparing files that were created 2002-04-08 10:30:44 +00:00
mixer Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
mld6query Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
mlxcontrol Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
mount_nwfs Default to WARNS=2. 2001-12-04 02:19:58 +00:00
mount_portalfs o __P removed 2002-03-21 13:14:21 +00:00
mount_smbfs Add bmake glue for src/contrib/smbfs and connect userland smbfs 2001-12-14 11:41:22 +00:00
mountd o __P removed 2002-03-21 13:14:21 +00:00
moused Minor changes: 2002-03-24 03:07:07 +00:00
mptable - Backout botched attempt to introduce MANSECT feature. 2001-03-26 14:42:20 +00:00
mrouted Set BINOWN=root explicitly for setuid root binaries. 2001-09-13 06:48:18 +00:00
mtest Include missing header files which define functions for which gcc has 2001-06-24 20:25:23 +00:00
mtree Only compile with strtofflags.c from libc if bootstrapping. 2001-09-24 15:38:38 +00:00
named Don't define NOADDITIONAL in CFLAGS again, it is already in named.h 2002-02-21 04:20:47 +00:00
named.reload Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
named.restart Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
ndc Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
ndp Do not delete 'goto ours' routes when using -c option. 2001-08-09 19:40:35 +00:00
newsyslog Close a very small window during which new (empty) instances of rotated log 2002-04-10 10:38:44 +00:00
nfsd Fix problem in macro definition breaking compiles with -DDEBUG. 2002-03-26 17:37:59 +00:00
ngctl Add ngctl "write" command. 2002-01-22 22:01:25 +00:00
nghook mdoc(7) police: protect trailing full stops of abbreviations 2001-08-10 13:45:36 +00:00
nologin Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
nslookup Install files via FILES. 2001-12-17 16:21:59 +00:00
nsupdate Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
ntp Various fixes, mostly for problems introduced by my mdoc transcription, 2002-04-02 08:55:49 +00:00
pccard Correct a typo. 2002-03-24 02:34:59 +00:00
pciconf When asked to print bytes (-b option) do that and put 16 on a line. 2002-02-26 10:40:42 +00:00
pcvt Install files via FILES. 2001-12-17 16:21:59 +00:00
periodic mdoc(7) police: fix markup in revision 1.25. 2001-12-08 16:15:44 +00:00
pim6dd Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
pim6sd Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
pkg_install DTRT for packages read from STDIN: 2002-04-02 12:47:10 +00:00
pnpinfo Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
ppp Get tun P2P address from the local pool if RADIUS server returned 2002-04-04 08:43:00 +00:00
pppctl *** empty log message *** 2001-10-01 08:43:58 +00:00
pppd Unbreak PAP-only authentication. 2002-03-05 10:50:55 +00:00
pppstats Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
praliases Update build infrastructure for sendmail 8.12. 2002-02-17 22:05:07 +00:00
prefix Sync with latest KAME's manpage of prefix(8). 2002-03-01 08:45:24 +00:00
procctl Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
pstat Change the vnode list under the mount point from a LIST to a TAILQ 2001-10-23 01:21:29 +00:00
pw In the words of the submitter: 2002-04-05 08:39:31 +00:00
pwd_mkdb When reporting that a line is too long, include the line number in the 2002-03-09 03:52:14 +00:00
quot Reorder WARNS line for style. 2001-12-10 21:13:36 +00:00
quotaon Remove a duplicate word. 2001-11-19 08:20:24 +00:00
rarpd Grammatical fixes over previous commit. 2001-11-20 16:33:55 +00:00
raycontrol Whack this code with the Blessed Wand of Stack Protection. 2001-08-08 22:27:02 +00:00
repquota #include <time.h> for the definition of time functions instead of 2002-02-25 07:39:34 +00:00
rip6query Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
rmt atol -> strtoll, for file offset 2001-09-05 17:05:31 +00:00
route6d mdoc(7) police: 2001-08-07 15:48:51 +00:00
rpc.lockd When binding to transports if getnetconfigent() fails then actually 2002-04-11 07:19:30 +00:00
rpc.statd rename 'enum res' and 'struct status' to 'enum sm_res' and 'struct sm_status' 2002-03-22 19:43:21 +00:00
rpc.umntall Don't ignore SIGINT and SIGQUIT. The comment said "Ignore SIGINT 2001-12-09 20:18:36 +00:00
rpc.yppasswdd ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
rpc.ypupdated Unbogotify the comment containing the RCS Id. 2002-02-15 00:46:32 +00:00
rpc.ypxfrd ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
rpcbind Capitalize the first word in sentences, and put periods at the end of 2001-08-20 00:03:01 +00:00
rrenumd mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
rtadvd mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
rtprio Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
rtsold typo. netbsd PR 16055 2002-03-29 04:43:07 +00:00
rwhod I've been meaning to do this for a while. Add an underscore to the 2002-01-19 23:20:02 +00:00
sa Fixed divots that I created when I moved prototypes of group_from_gid 2002-02-19 00:05:59 +00:00
sade Add the concept of a volume to the device and package structures. If 2002-04-13 12:43:07 +00:00
sendmail Update build infrastructure for sendmail 8.12. 2002-02-17 22:06:20 +00:00
setextattr Update userland tools to reflect extattr API changes. 2002-02-10 04:48:26 +00:00
setkey mdoc(7) police: protect trailing full stops of abbreviations 2001-08-10 13:45:36 +00:00
sgsc - Backout botched attempt to introduce MANSECT feature. 2001-03-26 14:42:20 +00:00
sicontrol Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
sliplogin Set BINOWN=root explicitly for setuid root binaries. 2001-09-13 06:48:18 +00:00
slstat The interface index space may be sparsely populated (e.g. when an 2001-10-17 04:12:29 +00:00
spkrtest mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
spray Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
stallion Comment in the man page and warning in stlload (when stlload fails) to make 2002-02-11 02:34:25 +00:00
sysinstall Add support for an additional field to the packages/INDEX file. If 2002-04-13 13:00:42 +00:00
syslogd Remove spaces between (void) and function calls. Use TAILQ_FOREACH 2002-03-24 06:02:10 +00:00
tcpdchk Don't clobber CFLAGS. 2001-08-04 21:48:18 +00:00
tcpdmatch Don't clobber the default for CFLAGS. 2001-08-31 11:05:24 +00:00
tcpdump I've been meaning to do this for a while. Add an underscore to the 2002-01-19 23:20:02 +00:00
timed timed(8) manual page has some incorrect grammer 2002-04-09 20:47:17 +00:00
traceroute Set BINOWN=root explicitly for setuid root binaries. 2001-09-13 06:48:18 +00:00
traceroute6 Don't override BINGRP -- this binary is not ``setgid bin''. 2001-09-13 06:52:42 +00:00
trpt SECURITY: Drop `setgid kmem' bit as early as possible. 2001-08-31 16:26:37 +00:00
tzsetup Default to UTC on sparc64 also. 2002-03-06 06:18:21 +00:00
usbd Prefix structure members to protect them against clashes with eg. 2002-02-20 20:47:21 +00:00
usbdevs mdoc(7) police: fix list width. 2002-03-15 17:06:19 +00:00
vidcontrol Fix typo: s/forth/fourth/ 2002-03-21 20:10:10 +00:00
vipw ANSIfy and constify. 2002-02-05 06:49:11 +00:00
vnconfig Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
watch #include <time.h> for the definition of time functions instead of 2002-02-25 05:31:49 +00:00
wicontrol Change typo, 2347 -> 2047. 2002-04-09 17:29:30 +00:00
wlconfig mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
xten Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
yp_mkdb ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
ypbind o Move NTOHL() and associated macros into <sys/param.h>. These are 2002-02-18 20:35:27 +00:00
yppoll ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
yppush ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
ypserv Sort out the documentation WRT TCP_WRAPPERs, which is now enabled. 2002-02-06 20:48:03 +00:00
ypset ANSIfy and remove some dead code. 2002-02-06 15:26:07 +00:00
zic Perform a major cleanup of the usr.sbin Makefiles. 2001-07-20 06:20:32 +00:00
Makefile Reactivate sysinstall, it does work on ia64. 2002-04-08 23:08:48 +00:00
Makefile.inc - Backout botched attempt to introduce MANSECT feature. 2001-03-26 14:42:20 +00:00