PERFORCE change 147518 for review
Ed Schouten
ed at FreeBSD.org
Sat Aug 16 10:03:34 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=147518
Change 147518 by ed at ed_dull on 2008/08/16 10:03:26
IFC.
Affected files ...
.. //depot/projects/mpsafetty/etc/defaults/rc.conf#4 integrate
.. //depot/projects/mpsafetty/etc/rc.firewall#4 integrate
.. //depot/projects/mpsafetty/lib/librt/sigev_thread.c#2 integrate
.. //depot/projects/mpsafetty/share/man/man4/snp.4#2 integrate
.. //depot/projects/mpsafetty/sys/Makefile#5 integrate
.. //depot/projects/mpsafetty/sys/conf/files#13 integrate
.. //depot/projects/mpsafetty/sys/conf/files.i386#4 integrate
.. //depot/projects/mpsafetty/sys/conf/options.i386#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ata/ata-all.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ata/ata-all.h#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ata/ata-chipset.c#4 integrate
.. //depot/projects/mpsafetty/sys/dev/snp/snp.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/conf/DEFAULTS#2 integrate
.. //depot/projects/mpsafetty/sys/i386/conf/XEN#1 branch
.. //depot/projects/mpsafetty/sys/i386/i386/busdma_machdep.c#3 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/genassym.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/machdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/support.s#3 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/sys_machdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/trap.c#3 integrate
.. //depot/projects/mpsafetty/sys/i386/i386/vm_machdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/asmacros.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/cpufunc.h#3 integrate
.. //depot/projects/mpsafetty/sys/i386/include/pcpu.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/pmap.h#3 integrate
.. //depot/projects/mpsafetty/sys/i386/include/segments.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/trap.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/include/vmparam.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/isa/npx.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/pci/pci_cfgreg.c#2 integrate
.. //depot/projects/mpsafetty/sys/i386/pci/pci_pir.c#2 integrate
.. //depot/projects/mpsafetty/sys/kern/init_main.c#2 integrate
.. //depot/projects/mpsafetty/sys/netinet/udp_usrreq.c#8 integrate
.. //depot/projects/mpsafetty/sys/netinet6/ip6_input.c#2 integrate
.. //depot/projects/mpsafetty/sys/netinet6/ip6_var.h#3 integrate
.. //depot/projects/mpsafetty/sys/xen/features.c#1 branch
.. //depot/projects/mpsafetty/usr.sbin/watch/watch.c#2 integrate
Differences ...
==== //depot/projects/mpsafetty/etc/defaults/rc.conf#4 (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.339 2008/08/09 01:19:00 obrien Exp $
+# $FreeBSD: src/etc/defaults/rc.conf,v 1.341 2008/08/15 19:20:59 jhb Exp $
##############################################################
### Important initial Boot-time options ####################
@@ -115,16 +115,27 @@
firewall_quiet="NO" # Set to YES to suppress rule display
firewall_logging="NO" # Set to YES to enable events logging
firewall_flags="" # Flags passed to ipfw when type is a file
+firewall_client_net="192.0.2.0/24" # Network address for "client" firewall.
+firewall_simple_iif="ed1" # Inside network interface for "simple"
+ # firewall.
+firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple"
+ # firewall.
+firewall_simple_oif="ed0" # Outside network interface for "simple"
+ # firewall.
+firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple"
+ # firewall.
firewall_myservices="" # List of TCP ports on which this host
- # offers services
-firewall_allowservices="" # List of IPs which has access to
- # $firewall_myservices
-firewall_trusted="" # List of IPs which has full access to this host
+ # offers services for "workstation" firewall.
+firewall_allowservices="" # List of IPs which have access to
+ # $firewall_myservices for "workstation"
+ # firewall.
+firewall_trusted="" # List of IPs which have full access to this
+ # host for "workstation" firewall.
firewall_logdeny="NO" # Set to YES to log default denied incoming
- # packets.
+ # packets for "workstation" firewall.
firewall_nologports="135-139,445 1026,1027 1433,1434" # List of TCP/UDP ports
- # for which denied incoming packets are not
- # logged.
+ # for which denied incoming packets are not
+ # logged for "workstation" firewall.
firewall_nat_enable="NO" # Enable kernel NAT (if firewall_enable == YES)
firewall_nat_interface="" # Public interface or IPaddress to use
firewall_nat_flags="" # Additional configuration parameters
==== //depot/projects/mpsafetty/etc/rc.firewall#4 (text+ko) ====
@@ -23,7 +23,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $FreeBSD: src/etc/rc.firewall,v 1.57 2008/08/03 19:01:07 danger Exp $
+# $FreeBSD: src/etc/rc.firewall,v 1.60 2008/08/15 19:20:59 jhb Exp $
#
#
@@ -164,19 +164,20 @@
############
# This is a prototype setup that will protect your system somewhat
# against people from outside your own network.
+ #
+ # Configuration:
+ # firewall_client_net: Network address of local network.
############
- # set these to your network and netmask and ip
- net="192.0.2.0"
- mask="255.255.255.0"
- ip="192.0.2.1"
+ # set this to your local network
+ net="$firewall_client_net"
# Allow limited broadcast traffic from my own net.
- ${fwcmd} add pass all from ${net}:${mask} to 255.255.255.255
+ ${fwcmd} add pass all from ${net} to 255.255.255.255
# Allow any traffic to or from my own net.
- ${fwcmd} add pass all from ${ip} to ${net}:${mask}
- ${fwcmd} add pass all from ${net}:${mask} to ${ip}
+ ${fwcmd} add pass all from me to ${net}
+ ${fwcmd} add pass all from ${net} to me
# Allow TCP through if setup succeeded
${fwcmd} add pass tcp from any to any established
@@ -209,23 +210,25 @@
# This is a prototype setup for a simple firewall. Configure this
# machine as a DNS and NTP server, and point all the machines
# on the inside at this machine for those services.
+ #
+ # Configuration:
+ # firewall_simple_iif: Inside network interface.
+ # firewall_simple_inet: Inside network address.
+ # firewall_simple_oif: Outside network interface.
+ # firewall_simple_onet: Outside network address.
############
- # set these to your outside interface network and netmask and ip
- oif="ed0"
- onet="192.0.2.0"
- omask="255.255.255.240"
- oip="192.0.2.1"
+ # set these to your outside interface network
+ oif="$firewall_simple_oif"
+ onet="$firewall_simple_onet"
- # set these to your inside interface network and netmask and ip
- iif="ed1"
- inet="192.0.2.16"
- imask="255.255.255.240"
- iip="192.0.2.17"
+ # set these to your inside interface network
+ iif="$firewall_simple_iif"
+ inet="$firewall_simple_inet"
# Stop spoofing
- ${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif}
- ${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif}
+ ${fwcmd} add deny all from ${inet} to any in via ${oif}
+ ${fwcmd} add deny all from ${onet} to any in via ${iif}
# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
@@ -277,15 +280,15 @@
${fwcmd} add pass all from any to any frag
# Allow setup of incoming email
- ${fwcmd} add pass tcp from any to ${oip} 25 setup
+ ${fwcmd} add pass tcp from any to me 25 setup
# Allow access to our DNS
- ${fwcmd} add pass tcp from any to ${oip} 53 setup
- ${fwcmd} add pass udp from any to ${oip} 53
- ${fwcmd} add pass udp from ${oip} 53 to any
+ ${fwcmd} add pass tcp from any to me 53 setup
+ ${fwcmd} add pass udp from any to me 53
+ ${fwcmd} add pass udp from me 53 to any
# Allow access to our WWW
- ${fwcmd} add pass tcp from any to ${oip} 80 setup
+ ${fwcmd} add pass tcp from any to me 80 setup
# Reject&Log all setup of incoming connections from the outside
${fwcmd} add deny log tcp from any to any in via ${oif} setup
@@ -294,10 +297,10 @@
${fwcmd} add pass tcp from any to any setup
# Allow DNS queries out in the world
- ${fwcmd} add pass udp from ${oip} to any 53 keep-state
+ ${fwcmd} add pass udp from me to any 53 keep-state
# Allow NTP queries out in the world
- ${fwcmd} add pass udp from ${oip} to any 123 keep-state
+ ${fwcmd} add pass udp from me to any 123 keep-state
# Everything else is denied by default, unless the
# IPFIREWALL_DEFAULT_TO_ACCEPT option is set in your kernel
==== //depot/projects/mpsafetty/lib/librt/sigev_thread.c#2 (text) ====
@@ -23,7 +23,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/lib/librt/sigev_thread.c,v 1.8 2006/03/29 04:20:53 deischen Exp $
+ * $FreeBSD: src/lib/librt/sigev_thread.c,v 1.9 2008/08/15 21:08:48 kmacy Exp $
*
*/
@@ -51,7 +51,7 @@
static struct sigev_list_head sigev_hash[HASH_QUEUES];
static struct sigev_list_head sigev_all;
static LIST_HEAD(,sigev_thread) sigev_threads;
-static int sigev_generation;
+static unsigned int sigev_generation;
static pthread_mutex_t *sigev_list_mtx;
static pthread_once_t sigev_once = PTHREAD_ONCE_INIT;
static pthread_once_t sigev_once_default = PTHREAD_ONCE_INIT;
==== //depot/projects/mpsafetty/share/man/man4/snp.4#2 (text+ko) ====
@@ -1,5 +1,5 @@
.\"
-.\" $FreeBSD: src/share/man/man4/snp.4,v 1.27 2005/09/19 13:48:45 ru Exp $
+.\" $FreeBSD: src/share/man/man4/snp.4,v 1.28 2008/08/15 13:07:07 ed Exp $
.\"
.Dd September 18, 2005
.Dt SNP 4
@@ -16,8 +16,8 @@
.Ft int
.Fn ioctl fd FIONREAD &result
.Sh DESCRIPTION
-.Pa /dev/snp?
-are snoop devices which allow users to attach to any tty
+.Pa /dev/snp
+is a snoop device which allows users to attach to any tty
and watch activities on it.
The kernel must be compiled with
.Cd "device snp" ,
==== //depot/projects/mpsafetty/sys/Makefile#5 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/Makefile,v 1.52 2008/08/08 18:00:33 philip Exp $
+# $FreeBSD: src/sys/Makefile,v 1.53 2008/08/15 14:11:30 philip Exp $
.include <bsd.own.mk>
@@ -46,6 +46,10 @@
# You need the textproc/glimpse ports for this.
glimpse:
+.if !exists(${.CURDIR}/.glimpse_exclude)
+ echo .svn > ${.CURDIR}/.glimpse_exclude
+ echo /compile/ >> ${.CURDIR}/.glimpse_exclude
+.endif
cd ${.CURDIR}; glimpseindex -H . -B -f -o .
glimpse-clean:
==== //depot/projects/mpsafetty/sys/conf/files#13 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1329 2008/08/14 21:26:29 imp Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1330 2008/08/15 20:58:57 kmacy Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -1727,6 +1727,7 @@
libkern/strcat.c standard
libkern/strcmp.c standard
libkern/strcpy.c standard
+libkern/strcspn.c standard
libkern/strdup.c standard
libkern/strlcat.c standard
libkern/strlcpy.c standard
@@ -2341,3 +2342,18 @@
compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs"
gnu/fs/xfs/xfs_behavior.c optional xfs \
compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs"
+
+xen/gnttab.c optional xen
+xen/features.c optional xen
+xen/evtchn/evtchn.c optional xen
+xen/evtchn/evtchn_dev.c optional xen
+xen/xenbus/xenbus_client.c optional xen
+xen/xenbus/xenbus_comms.c optional xen
+xen/xenbus/xenbus_dev.c optional xen
+xen/xenbus/xenbus_probe.c optional xen
+xen/xenbus/xenbus_probe_backend.c optional xen
+xen/xenbus/xenbus_xs.c optional xen
+dev/xen/console/console.c optional xen
+dev/xen/console/xencons_ring.c optional xen
+dev/xen/blkfront/blkfront.c optional xen
+dev/xen/netfront/netfront.c optional xen
==== //depot/projects/mpsafetty/sys/conf/files.i386#4 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.i386,v 1.602 2008/08/09 14:52:31 philip Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.603 2008/08/15 20:58:57 kmacy Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -254,8 +254,8 @@
i386/i386/atomic.c standard \
compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}"
i386/i386/autoconf.c standard
-i386/i386/bios.c standard
-i386/i386/bioscall.s standard
+i386/i386/bios.c optional native
+i386/i386/bioscall.s optional native
i386/i386/bpf_jit_machdep.c optional bpf_jitter
i386/i386/busdma_machdep.c standard
i386/i386/db_disasm.c optional ddb
@@ -264,7 +264,8 @@
i386/i386/dump_machdep.c standard
i386/i386/elan-mmcr.c optional cpu_elan | cpu_soekris
i386/i386/elf_machdep.c standard
-i386/i386/exception.s standard
+i386/i386/exception.s optional native
+i386/xen/exception.s optional xen
i386/i386/gdb_machdep.c optional gdb
i386/i386/geode.c optional cpu_geode
i386/i386/i686_mem.c optional mem
@@ -277,9 +278,11 @@
i386/i386/k6_mem.c optional mem
i386/i386/legacy.c standard
i386/i386/local_apic.c optional apic
-i386/i386/locore.s standard no-obj
+i386/i386/locore.s optional native no-obj
+i386/xen/locore.s optional xen no-obj
i386/i386/longrun.c optional cpu_enable_longrun
i386/i386/machdep.c standard
+i386/xen/xen_machdep.c optional xen
i386/i386/mem.c optional mem
i386/i386/minidump_machdep.c standard
i386/i386/mp_clock.c optional smp
@@ -291,7 +294,8 @@
i386/i386/msi.c optional apic pci
i386/i386/nexus.c standard
i386/i386/perfmon.c optional perfmon
-i386/i386/pmap.c standard
+i386/i386/pmap.c optional native
+i386/xen/pmap.c optional xen
i386/i386/ptrace_machdep.c standard
i386/i386/stack_machdep.c optional ddb | stack
i386/i386/support.s standard
@@ -321,9 +325,10 @@
i386/ibcs2/ibcs2_xenix.c optional ibcs2
i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2
i386/ibcs2/imgact_coff.c optional ibcs2
-i386/isa/atpic.c standard
+i386/isa/atpic.c optional atpic
#i386/isa/atpic_vector.s standard
-i386/isa/clock.c standard
+i386/isa/clock.c optional native
+i386/xen/clock.c optional xen
i386/isa/elcr.c standard
i386/isa/elink.c optional ep | ie
i386/isa/isa.c optional isa
@@ -346,13 +351,13 @@
i386/linux/linux_sysvec.c optional compat_linux
i386/pci/pci_bus.c optional pci
i386/pci/pci_cfgreg.c optional pci
-i386/pci/pci_pir.c optional pci
+i386/pci/pci_pir.c optional pci
i386/svr4/svr4_locore.s optional compat_svr4 \
dependency "svr4_assym.h" \
warning "COMPAT_SVR4 is broken and should be avoided"
i386/svr4/svr4_machdep.c optional compat_svr4
#
-isa/atrtc.c standard
+isa/atrtc.c optional atpic
isa/syscons_isa.c optional sc
isa/vga_isa.c optional vga
kern/imgact_aout.c optional compat_aout
==== //depot/projects/mpsafetty/sys/conf/options.i386#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/options.i386,v 1.242 2008/06/14 12:51:44 wkoszek Exp $
+# $FreeBSD: src/sys/conf/options.i386,v 1.243 2008/08/15 20:58:57 kmacy Exp $
# Options specific to the i386 platform kernels
AUTO_EOI_1 opt_auto_eoi.h
@@ -111,3 +111,6 @@
# BPF just-in-time compiler
BPF_JITTER opt_bpf.h
+
+NATIVE opt_global.h
+XEN opt_global.h
==== //depot/projects/mpsafetty/sys/dev/ata/ata-all.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.289 2008/06/11 06:44:58 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.290 2008/08/15 10:55:11 philip Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -75,6 +75,7 @@
uma_zone_t ata_composite_zone;
int ata_wc = 1;
int ata_setmax = 0;
+int ata_dma_check_80pin = 1;
/* local vars */
static int ata_dma = 1;
@@ -85,6 +86,10 @@
TUNABLE_INT("hw.ata.ata_dma", &ata_dma);
SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma, CTLFLAG_RDTUN, &ata_dma, 0,
"ATA disk DMA mode control");
+TUNABLE_INT("hw.ata.ata_dma_check_80pin", &ata_dma_check_80pin);
+SYSCTL_INT(_hw_ata, OID_AUTO, ata_dma_check_80pin,
+ CTLFLAG_RDTUN, &ata_dma_check_80pin, 1,
+ "Check for 80pin cable before setting ATA DMA mode");
TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma);
SYSCTL_INT(_hw_ata, OID_AUTO, atapi_dma, CTLFLAG_RDTUN, &atapi_dma, 0,
"ATAPI device DMA mode control");
==== //depot/projects/mpsafetty/sys/dev/ata/ata-all.h#2 (text+ko) ====
@@ -23,7 +23,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/sys/dev/ata/ata-all.h,v 1.133 2008/04/17 12:29:35 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.134 2008/08/15 10:55:11 philip Exp $
*/
/* ATA register defines */
@@ -544,7 +544,8 @@
extern devclass_t ata_devclass;
extern int ata_wc;
extern int ata_setmax;
-
+extern int ata_dma_check_80pin;
+
/* public prototypes */
/* ata-all.c: */
int ata_probe(device_t dev);
==== //depot/projects/mpsafetty/sys/dev/ata/ata-chipset.c#4 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.224 2008/07/10 21:36:53 remko Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.225 2008/08/15 10:55:11 philip Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -6392,6 +6392,12 @@
{
struct ata_device *atadev = device_get_softc(dev);
+ if (!ata_dma_check_80pin) {
+ if (bootverbose)
+ device_printf(dev, "Skipping 80pin cable check\n");
+ return mode;
+ }
+
if (mode > ATA_UDMA2 && !(atadev->param.hwres & ATA_CABLE_ID)) {
ata_print_cable(dev, "device");
mode = ATA_UDMA2;
==== //depot/projects/mpsafetty/sys/dev/snp/snp.c#2 (text+ko) ====
@@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/snp/snp.c,v 1.108 2008/06/11 18:55:19 ed Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/snp/snp.c,v 1.109 2008/08/15 13:07:07 ed Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -36,7 +36,6 @@
static l_close_t snplclose;
static l_write_t snplwrite;
static d_open_t snpopen;
-static d_close_t snpclose;
static d_read_t snpread;
static d_write_t snpwrite;
static d_ioctl_t snpioctl;
@@ -46,7 +45,6 @@
.d_version = D_VERSION,
.d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR,
.d_open = snpopen,
- .d_close = snpclose,
.d_read = snpread,
.d_write = snpwrite,
.d_ioctl = snpioctl,
@@ -70,7 +68,6 @@
*/
struct snoop {
LIST_ENTRY(snoop) snp_list; /* List glue. */
- int snp_unit; /* Device number. */
struct cdev *snp_target; /* Target tty device. */
struct tty *snp_tty; /* Target tty pointer. */
u_long snp_len; /* Possible length. */
@@ -111,13 +108,11 @@
* module load time.
*/
static int snooplinedisc;
+static struct cdev *snoopdev;
static LIST_HEAD(, snoop) snp_sclist = LIST_HEAD_INITIALIZER(&snp_sclist);
-static struct clonedevs *snpclones;
static struct tty *snpdevtotty(struct cdev *dev);
-static void snp_clone(void *arg, struct ucred *cred, char *name,
- int namelen, struct cdev **dev);
static void snp_detach(void *arg);
static int snp_down(struct snoop *snp);
static int snp_in(struct snoop *snp, char *buf, int n);
@@ -220,14 +215,17 @@
int error, i, len;
unsigned char c[SNP_INPUT_BUF];
- snp = dev->si_drv1;
+ error = devfs_get_cdevpriv((void **)&snp);
+ if (error != 0)
+ return (error);
+
tp = snp->snp_tty;
if (tp == NULL)
return (EIO);
if ((tp->t_state & TS_SNOOP) && tp->t_line == snooplinedisc)
goto tty_input;
- printf("snp%d: attempt to write to bad tty\n", snp->snp_unit);
+ printf("snp: attempt to write to bad tty\n");
return (EIO);
tty_input:
@@ -255,7 +253,10 @@
caddr_t from;
char *nbuf;
- snp = dev->si_drv1;
+ error = devfs_get_cdevpriv((void **)&snp);
+ if (error != 0)
+ return (error);
+
KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen,
("snoop buffer error"));
@@ -324,12 +325,12 @@
return (0);
if (snp->snp_flags & SNOOP_DOWN) {
- printf("snp%d: more data to down interface\n", snp->snp_unit);
+ printf("snp: more data to down interface\n");
return (0);
}
if (snp->snp_flags & SNOOP_OFLOW) {
- printf("snp%d: buffer overflow\n", snp->snp_unit);
+ printf("snp: buffer overflow\n");
/*
* On overflow we just repeat the standart close
* procedure...yes , this is waste of space but.. Then next
@@ -387,18 +388,30 @@
return (n);
}
+static void
+snp_dtor(void *data)
+{
+ struct snoop *snp = data;
+
+ snp->snp_blen = 0;
+ LIST_REMOVE(snp, snp_list);
+ free(snp->snp_buf, M_SNP);
+ snp->snp_flags &= ~SNOOP_OPEN;
+ snp_detach(snp);
+}
+
static int
snpopen(struct cdev *dev, int flag, int mode, struct thread *td)
{
struct snoop *snp;
+ int error;
- if (dev->si_drv1 == NULL) {
- dev->si_flags &= ~SI_CHEAPCLONE;
- dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP,
- M_WAITOK | M_ZERO);
- snp->snp_unit = dev2unit(dev);
- } else
- return (EBUSY);
+ snp = malloc(sizeof(*snp), M_SNP, M_WAITOK | M_ZERO);
+ error = devfs_set_cdevpriv(snp, snp_dtor);
+ if (error != 0) {
+ free(snp, M_SNP);
+ return (error);
+ }
/*
* We intentionally do not OR flags with SNOOP_OPEN, but set them so
@@ -444,7 +457,7 @@
tp->t_state &= ~TS_SNOOP;
tp->t_line = snp->snp_olddisc;
} else
- printf("snp%d: bad attached tty data\n", snp->snp_unit);
+ printf("snp: bad attached tty data\n");
snp->snp_tty = NULL;
snp->snp_target = NULL;
@@ -456,23 +469,6 @@
}
static int
-snpclose(struct cdev *dev, int flags, int fmt, struct thread *td)
-{
- struct snoop *snp;
-
- snp = dev->si_drv1;
- snp->snp_blen = 0;
- LIST_REMOVE(snp, snp_list);
- free(snp->snp_buf, M_SNP);
- snp->snp_flags &= ~SNOOP_OPEN;
- dev->si_drv1 = NULL;
- snp_detach(snp);
- destroy_dev_sched(dev);
-
- return (0);
-}
-
-static int
snp_down(struct snoop *snp)
{
@@ -495,9 +491,12 @@
struct tty *tp;
struct cdev *tdev;
struct file *fp;
- int s;
+ int error, s;
+
+ error = devfs_get_cdevpriv((void **)&snp);
+ if (error != 0)
+ return (error);
- snp = dev->si_drv1;
switch (cmd) {
case SNPSTTY:
s = *(int *)data;
@@ -587,7 +586,10 @@
struct snoop *snp;
int revents;
- snp = dev->si_drv1;
+ if (devfs_get_cdevpriv((void **)&snp) != 0)
+ return (events &
+ (POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM));
+
revents = 0;
/*
* If snoop is down, we don't want to poll() forever so we return 1.
@@ -603,44 +605,22 @@
return (revents);
}
-static void
-snp_clone(void *arg, struct ucred *cred, char *name, int namelen,
- struct cdev **dev)
-{
- int u, i;
-
- if (*dev != NULL)
- return;
- if (dev_stdclone(name, NULL, "snp", &u) != 1)
- return;
- i = clone_create(&snpclones, &snp_cdevsw, &u, dev, 0);
- if (i)
- *dev = make_dev_credf(MAKEDEV_REF, &snp_cdevsw, unit2minor(u),
- NULL, UID_ROOT, GID_WHEEL, 0600, "snp%d", u);
- if (*dev != NULL) {
- (*dev)->si_flags |= SI_CHEAPCLONE;
- }
-}
-
static int
snp_modevent(module_t mod, int type, void *data)
{
- static eventhandler_tag eh_tag;
switch (type) {
case MOD_LOAD:
- /* XXX error checking. */
- clone_setup(&snpclones);
- eh_tag = EVENTHANDLER_REGISTER(dev_clone, snp_clone, 0, 1000);
snooplinedisc = ldisc_register(LDISC_LOAD, &snpdisc);
+ snoopdev = make_dev(&snp_cdevsw, 0, UID_ROOT, GID_WHEEL,
+ 0600, "snp");
+ /* For compatibility */
+ make_dev_alias(snoopdev, "snp0");
break;
case MOD_UNLOAD:
if (!LIST_EMPTY(&snp_sclist))
return (EBUSY);
- EVENTHANDLER_DEREGISTER(dev_clone, eh_tag);
- drain_dev_clone_events();
- clone_cleanup(&snpclones);
- destroy_dev_drain(&snp_cdevsw);
+ destroy_dev(snoopdev);
ldisc_deregister(snooplinedisc);
break;
default:
==== //depot/projects/mpsafetty/sys/i386/conf/DEFAULTS#2 (text+ko) ====
@@ -1,7 +1,7 @@
#
# DEFAULTS -- Default kernel configuration file for FreeBSD/i386
#
-# $FreeBSD: src/sys/i386/conf/DEFAULTS,v 1.13 2008/03/12 10:11:57 jeff Exp $
+# $FreeBSD: src/sys/i386/conf/DEFAULTS,v 1.14 2008/08/15 20:58:57 kmacy Exp $
machine i386
@@ -22,3 +22,7 @@
# Default partitioning schemes
options GEOM_BSD
options GEOM_MBR
+
+# enable support for native hardware
+options NATIVE
+device atpic
==== //depot/projects/mpsafetty/sys/i386/i386/busdma_machdep.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.93 2008/07/15 03:34:49 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/busdma_machdep.c,v 1.94 2008/08/15 20:51:31 kmacy Exp $");
#include <sys/param.h>
#include <sys/kdb.h>
@@ -144,6 +144,11 @@
int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
bus_size_t buflen, int flags);
+#ifdef XEN
+#undef pmap_kextract
+#define pmap_kextract pmap_kextract_ma
+#endif
+
/*
* Return true if a match is made.
*
==== //depot/projects/mpsafetty/sys/i386/i386/genassym.c#2 (text+ko) ====
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/genassym.c,v 1.162 2008/05/16 13:23:47 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/genassym.c,v 1.163 2008/08/15 20:51:31 kmacy Exp $");
#include "opt_apic.h"
#include "opt_compat.h"
@@ -228,3 +228,9 @@
ASSYM(BUS_SPACE_HANDLE_BASE, offsetof(struct bus_space_handle, bsh_base));
ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(struct bus_space_handle, bsh_iat));
#endif
+
+#ifdef XEN
+#include <machine/xen/hypervisor.h>
+ASSYM(PC_CR3, offsetof(struct pcpu, pc_cr3));
+ASSYM(HYPERVISOR_VIRT_START, __HYPERVISOR_VIRT_START);
+#endif
==== //depot/projects/mpsafetty/sys/i386/i386/machdep.c#2 (text+ko) ====
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.670 2008/04/25 05:18:48 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.671 2008/08/15 20:51:31 kmacy Exp $");
#include "opt_apic.h"
#include "opt_atalk.h"
@@ -141,6 +141,25 @@
uint32_t arch_i386_xbox_memsize = 0;
#endif
+#ifdef XEN
+/* XEN includes */
+#include <machine/xen/xen-os.h>
+#include <machine/xen/hypervisor.h>
+#include <machine/xen/xen-os.h>
+#include <machine/xen/xenvar.h>
+#include <machine/xen/xenfunc.h>
+#include <machine/xen/xen_intr.h>
+
+void Xhypervisor_callback(void);
+void failsafe_callback(void);
+
+extern trap_info_t trap_table[];
+struct proc_ldt default_proc_ldt;
+extern int init_first;
+int running_xen = 1;
+extern unsigned long physfree;
+#endif /* XEN */
+
/* Sanity check for __curthread() */
CTASSERT(offsetof(struct pcpu, pc_curthread) == 0);
@@ -287,8 +306,9 @@
*/
bufinit();
vm_pager_bufferinit();
-
+#ifndef XEN
cpu_setregs();
+#endif
}
/*
@@ -1118,6 +1138,24 @@
return (0);
}
+
+void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */
+
+#ifdef XEN
+
+void
+cpu_halt(void)
+{
+ HYPERVISOR_shutdown(SHUTDOWN_poweroff);
+}
+
+static void
+cpu_idle_hlt(int busy)
+{
+ idle_block();
+}
+
+#else
/*
* Shutdown the CPU as much as possible
*/
@@ -1128,8 +1166,6 @@
__asm__ ("hlt");
}
-void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */
-
static void
cpu_idle_hlt(int busy)
{
@@ -1143,6 +1179,7 @@
else
__asm __volatile("sti; hlt");
}
+#endif
static void
cpu_idle_acpi(int busy)
@@ -1437,10 +1474,16 @@
*/
int _default_ldt;
+
+#ifdef XEN
+union descriptor *gdt;
+union descriptor *ldt;
+#else
union descriptor gdt[NGDT * MAXCPU]; /* global descriptor table */
+union descriptor ldt[NLDT]; /* local descriptor table */
+#endif
static struct gate_descriptor idt0[NIDT];
struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */
-union descriptor ldt[NLDT]; /* local descriptor table */
struct region_descriptor r_gdt, r_idt; /* table descriptors */
struct mtx dt_lock; /* lock for GDT and LDT */
@@ -1542,6 +1585,7 @@
0, 0,
1, /* default 32 vs 16 bit size */
1 /* limit granularity (byte/page units)*/ },
+#ifndef XEN
/* GPROC0_SEL 9 Proc 0 Tss Descriptor */
{
0x0, /* segment base address */
@@ -1633,6 +1677,7 @@
0, 0,
0, /* default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
+#endif /* !XEN */
};
static struct soft_segment_descriptor ldt_segs[] = {
@@ -1870,7 +1915,16 @@
goto physmap_done;
}
#endif
-
+#if defined(XEN)
+ has_smap = 0;
+ Maxmem = xen_start_info->nr_pages - init_first;
+ physmem = Maxmem;
+ basemem = 0;
+ physmap[0] = init_first << PAGE_SHIFT;
+ physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE);
+ physmap_idx = 0;
+ goto physmap_done;
+#endif
hasbrokenint12 = 0;
TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12);
bzero(&vmf, sizeof(vmf));
@@ -2032,7 +2086,7 @@
vmf.vmf_ah = 0x88;
vm86_intcall(0x15, &vmf);
extmem = vmf.vmf_ax;
-#else
+#elif !defined(XEN)
/*
* Prefer the RTC value for extended memory.
*/
@@ -2123,6 +2177,7 @@
getenv_quad("dcons.size", &dcons_size) == 0)
dcons_addr = 0;
+#ifndef XEN
/*
* physmap is in bytes, so when converting to page boundaries,
* round up the start address and round down the end address.
@@ -2240,7 +2295,11 @@
}
*pte = 0;
invltlb();
-
+#else
+ phys_avail[0] = physfree;
+ phys_avail[1] = xen_start_info->nr_pages*PAGE_SIZE;
+#endif
+
/*
* XXX
* The last chunk must contain at least one page plus the message
@@ -2265,6 +2324,246 @@
off);
}
+#ifdef XEN
+#define MTOPSIZE (1<<(14 + PAGE_SHIFT))
+
+void
+init386(first)
+ int first;
+{
+ struct gate_descriptor *gdp;
+ unsigned long gdtmachpfn;
+ int error, gsel_tss, metadata_missing, x;
+ struct pcpu *pc;
+ struct callback_register event = {
+ .type = CALLBACKTYPE_event,
+ .address = {GSEL(GCODE_SEL, SEL_KPL), (unsigned long)Xhypervisor_callback },
+ };
+ struct callback_register failsafe = {
+ .type = CALLBACKTYPE_failsafe,
+ .address = {GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback },
+ };
+
+ thread0.td_kstack = proc0kstack;
+ thread0.td_pcb = (struct pcb *)
+ (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+
+ /*
+ * This may be done better later if it gets more high level
+ * components in it. If so just link td->td_proc here.
+ */
+ proc_linkup0(&proc0, &thread0);
+
+ metadata_missing = 0;
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list