Module Name:    src
Committed By:   cherry
Date:           Thu Feb 14 08:18:26 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: locore.S machdep.c spl.S vector.S
        src/sys/arch/amd64/include: frame.h
        src/sys/arch/i386/i386: machdep.c vector.S
        src/sys/arch/i386/include: frame.h frameasm.h
        src/sys/arch/x86/include: cpu.h intr.h
        src/sys/arch/x86/x86: cpu.c intr.c mainbus.c pmap.c x86_machdep.c
        src/sys/arch/xen/conf: files.xen
        src/sys/arch/xen/x86: xen_intr.c xen_mainbus.c
        src/sys/arch/xen/xen: hypervisor.c if_xennet_xenbus.c
Added Files:
        src/sys/arch/amd64/conf: XEN3_PVHVM
        src/sys/arch/i386/conf: XEN3PAE_PVHVM

Log Message:
Welcome XENPVHVM mode.

It is UP only, has xbd(4) and xennet(4) as PV drivers.

The console is com0 at isa and the native portion is very
rudimentary AT architecture, so is probably suboptimal to
run without PV support.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.325 -r1.326 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/conf/XEN3_PVHVM
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/conf/XEN3PAE_PVHVM
cvs rdiff -u -r1.815 -r1.816 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/mainbus.c
cvs rdiff -u -r1.322 -r1.323 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.177 -r1.178 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/xen_mainbus.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/xen/if_xennet_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.177 src/sys/arch/amd64/amd64/locore.S:1.178
--- src/sys/arch/amd64/amd64/locore.S:1.177	Wed Feb 13 05:36:59 2019
+++ src/sys/arch/amd64/amd64/locore.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.177 2019/02/13 05:36:59 cherry Exp $	*/
+/*	$NetBSD: locore.S,v 1.178 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1112,7 +1112,7 @@ ENTRY(cpu_switchto)
 .Lskip_svs:
 #endif
 
-#ifndef XENPV
+#ifndef XEN
 	movq	%r13,%rdi
 	movq	%r12,%rsi
 	callq	_C_LABEL(speculation_barrier)

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.325 src/sys/arch/amd64/amd64/machdep.c:1.326
--- src/sys/arch/amd64/amd64/machdep.c:1.325	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.325 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -193,7 +193,9 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include <xen/xen.h>
 #include <xen/hypervisor.h>
 #include <xen/evtchn.h>
-#endif
+#include <xen/include/public/version.h>
+#include <xen/include/public/vcpu.h>
+#endif /* XEN */
 
 #ifdef DDB
 #include <machine/db_machdep.h>
@@ -1693,7 +1695,7 @@ init_x86_64(paddr_t first_avail)
 	svs_init();
 #endif
 	cpu_init_msrs(&cpu_info_primary, true);
-#ifndef XENPV
+#ifndef XEN
 	cpu_speculation_init(&cpu_info_primary);
 #endif
 
@@ -1905,6 +1907,7 @@ init_x86_64(paddr_t first_avail)
 	    (unsigned long) Xsyscall))
 		panic("HYPERVISOR_set_callbacks() failed");
 #endif /* XENPV */
+
 	cpu_init_idt();
 
 	init_x86_64_ksyms();

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.39 src/sys/arch/amd64/amd64/spl.S:1.40
--- src/sys/arch/amd64/amd64/spl.S:1.39	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/amd64/spl.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.39 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.40 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -211,7 +211,9 @@ IDTVEC(resume_preempt)
 	cli
 	jmp	*%r13			/* back to Xdoreti */
 IDTVEC_END(resume_preempt)
+#endif /* XEN */
 
+#ifndef XENPV
 /*
  * void spllower(int s);
  *
@@ -279,7 +281,7 @@ LABEL(cx8_spllower_patch)
 END(cx8_spllower_patch)
 END(cx8_spllower)
 LABEL(cx8_spllower_end)
-#endif /* !XEN */
+#endif /* !XENPV */
 
 /*
  * void Xspllower(int s);

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.67 src/sys/arch/amd64/amd64/vector.S:1.68
--- src/sys/arch/amd64/amd64/vector.S:1.67	Wed Feb 13 05:01:57 2019
+++ src/sys/arch/amd64/amd64/vector.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.67 2019/02/13 05:01:57 cherry Exp $	*/
+/*	$NetBSD: vector.S,v 1.68 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -771,7 +771,7 @@ IDTVEC(hypervisor_pvhvm_callback)
 	INTRFASTEXIT
 IDTVEC_END(hypervisor_pvhvm_callback)
 END(hypervisor_callback)
-#endif
+#endif /* XEN */
 
 #ifdef XENPV
 /* Panic? */

Index: src/sys/arch/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.21 src/sys/arch/amd64/include/frame.h:1.22
--- src/sys/arch/amd64/include/frame.h:1.21	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/amd64/include/frame.h	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.21 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: frame.h,v 1.22 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@ struct intrframe {
 	struct trapframe if_tf;
 };
 
-#ifdef XENPV
+#ifdef XEN
 /*
  * Need arch independany way to access IP and CS from intrframe
  */

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.815 src/sys/arch/i386/i386/machdep.c:1.816
--- src/sys/arch/i386/i386/machdep.c:1.815	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/machdep.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.815 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.816 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.815 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.816 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -1044,7 +1044,7 @@ initgdt(union descriptor *tgdt)
 #endif /* !XENPV */
 }
 
-#ifndef XENPV
+#if !defined(XENPV)  && NBIOSCALL > 0
 static void
 init386_pte0(void)
 {
@@ -1155,7 +1155,7 @@ init386(paddr_t first_avail)
 
 	cpu_probe(&cpu_info_primary);
 	cpu_init_msrs(&cpu_info_primary, true);
-#ifndef XENPV
+#ifndef XEN
 	cpu_speculation_init(&cpu_info_primary);
 #endif
 

Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.81 src/sys/arch/i386/i386/vector.S:1.82
--- src/sys/arch/i386/i386/vector.S:1.81	Wed Feb 13 05:01:58 2019
+++ src/sys/arch/i386/i386/vector.S	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.81 2019/02/13 05:01:58 cherry Exp $	*/
+/*	$NetBSD: vector.S,v 1.82 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.81 2019/02/13 05:01:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.82 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1092,7 +1092,8 @@ critical_region_fixup:
 IDTVEC_END(hypervisor_pvhvm_callback)
 END(hypervisor_callback)
 
-
+#endif /* XEN */
+#ifdef XENPV	
 /*
  * Hypervisor uses this for application faults while it executes.
  */
@@ -1105,4 +1106,4 @@ ENTRY(failsafe_callback)
 	iret
 END(failsafe_callback)
 
-#endif /* XEN */
+#endif /* XENPV */

Index: src/sys/arch/i386/include/frame.h
diff -u src/sys/arch/i386/include/frame.h:1.39 src/sys/arch/i386/include/frame.h:1.40
--- src/sys/arch/i386/include/frame.h:1.39	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/include/frame.h	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.39 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: frame.h,v 1.40 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -129,7 +129,7 @@ struct intrframe {
 	int	if_ss;
 };
 
-#ifdef XENPV
+#ifdef XEN
 /*
  * need arch independant way to access ip and cs from intrframe
  */

Index: src/sys/arch/i386/include/frameasm.h
diff -u src/sys/arch/i386/include/frameasm.h:1.27 src/sys/arch/i386/include/frameasm.h:1.28
--- src/sys/arch/i386/include/frameasm.h:1.27	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/include/frameasm.h	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.27 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.28 2019/02/14 08:18:25 cherry Exp $	*/
 
 #ifndef _I386_FRAMEASM_H_
 #define _I386_FRAMEASM_H_
@@ -8,16 +8,16 @@
 #include "opt_xen.h"
 #endif
 
-#if !defined(XENPV)
-#define CLI(reg)	cli
-#define STI(reg)	sti
-#else
+
+#ifdef XEN
 /* XXX assym.h */
 #define TRAP_INSTR	int	$0x82
 #define XEN_BLOCK_EVENTS(reg)	movb	$1,EVTCHN_UPCALL_MASK(reg)
 #define XEN_UNBLOCK_EVENTS(reg)	movb	$0,EVTCHN_UPCALL_MASK(reg)
 #define XEN_TEST_PENDING(reg)	testb	$0xFF,EVTCHN_UPCALL_PENDING(reg)
+#endif /* XEN */
 
+#if defined(XENPV)
 #define CLI(reg)	movl	CPUVAR(VCPU),reg ;  \
 			XEN_BLOCK_EVENTS(reg)
 #define STI(reg)	movl	CPUVAR(VCPU),reg ;  \
@@ -25,7 +25,17 @@
 #define STIC(reg)	movl	CPUVAR(VCPU),reg ;  \
 			XEN_UNBLOCK_EVENTS(reg)  ; \
 			testb	$0xff,EVTCHN_UPCALL_PENDING(reg)
-#endif
+#else
+#define CLI(reg)	cli
+#define STI(reg)	sti
+#ifdef XENPVHVM
+#define STIC(reg)	sti ; \
+			movl	CPUVAR(VCPU),reg ; \
+			XEN_UNBLOCK_EVENTS(reg)  ; \
+			testb	$0xff,EVTCHN_UPCALL_PENDING(reg)
+#endif /* XENPVHVM */
+
+#endif /* XENPV */
 
 #define HP_NAME_CLAC		1
 #define HP_NAME_STAC		2

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.103 src/sys/arch/x86/include/cpu.h:1.104
--- src/sys/arch/x86/include/cpu.h:1.103	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/x86/include/cpu.h	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.103 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: cpu.h,v 1.104 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -138,7 +138,9 @@ struct cpu_info {
 	uint64_t ci_scratch;
 	uintptr_t ci_pmap_data[128 / sizeof(uintptr_t)];
 
+#ifndef XENPV
 	struct intrsource *ci_isources[MAX_INTR_SOURCES];
+#endif
 #if defined(XEN)
 	struct intrsource *ci_xsources[NIPL];
 	uint32_t	ci_xmask[NIPL];
@@ -271,6 +273,8 @@ struct cpu_info {
 #endif	/* defined(__x86_64__) */
 
 	size_t		ci_xpq_idx;
+#endif /* XENPV */
+
 	/* Xen raw system time at which we last ran hardclock.  */
 	uint64_t	ci_xen_hardclock_systime_ns;
 
@@ -304,7 +308,6 @@ struct cpu_info {
 	struct evcnt	ci_xen_raw_systime_backwards_evcnt;
 	struct evcnt	ci_xen_systime_backwards_hardclock_evcnt;
 	struct evcnt	ci_xen_missed_hardclock_evcnt;
-#endif /* XENPV */
 #else   /* XEN */
 	struct evcnt ci_ipi_events[X86_NIPI];
 #endif	/* XEN */
@@ -482,6 +485,7 @@ typedef enum vm_guest {
 	VM_GUEST_NO = 0,
 	VM_GUEST_VM,
 	VM_GUEST_XEN,
+	VM_GUEST_XENPVHVM,
 	VM_GUEST_HV,
 	VM_GUEST_VMWARE,
 	VM_GUEST_KVM,
@@ -502,20 +506,19 @@ void	lgdt_finish(void);
 struct pcb;
 void	savectx(struct pcb *);
 void	lwp_trampoline(void);
-#ifdef XENPV
-void	startrtclock(void);
+#ifdef XEN
+void	xen_startrtclock(void);
 void	xen_delay(unsigned int);
 void	xen_initclocks(void);
 void	xen_suspendclocks(struct cpu_info *);
 void	xen_resumeclocks(struct cpu_info *);
-#else
+#endif /* XEN */
 /* clock.c */
 void	initrtclock(u_long);
 void	startrtclock(void);
 void	i8254_delay(unsigned int);
 void	i8254_microtime(struct timeval *);
 void	i8254_initclocks(void);
-#endif
 
 /* cpu.c */
 void	cpu_probe_features(struct cpu_info *);

Index: src/sys/arch/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.59 src/sys/arch/x86/include/intr.h:1.60
--- src/sys/arch/x86/include/intr.h:1.59	Wed Feb 13 05:28:50 2019
+++ src/sys/arch/x86/include/intr.h	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.59 2019/02/13 05:28:50 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.60 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -117,9 +117,10 @@ struct intrsource {
  */
 
 struct intrhand {
-#if defined(XENPV)
+#if defined(XEN)
 	/*
 	 * Note: This is transitional and will go away.
+	 * The only current consumer is xen_intr_disestablish()
 	 *
 	 * We ought to use a union here, but too much effort.
 	 * We use this field to tear down the cookie handed to us

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.165 src/sys/arch/x86/x86/cpu.c:1.166
--- src/sys/arch/x86/x86/cpu.c:1.165	Thu Feb 14 07:12:40 2019
+++ src/sys/arch/x86/x86/cpu.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.166 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.165 2019/02/14 07:12:40 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.166 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -691,8 +691,10 @@ cpu_boot_secondary_processors(void)
 	kcpuset_t *cpus;
 	u_long i;
 
+#ifndef XEN
 	/* Now that we know the number of CPUs, patch the text segment. */
 	x86_patch(false);
+#endif
 
 	kcpuset_create(&cpus, true);
 	kcpuset_set(cpus, cpu_index(curcpu()));

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.142 src/sys/arch/x86/x86/intr.c:1.143
--- src/sys/arch/x86/x86/intr.c:1.142	Tue Feb 12 03:13:50 2019
+++ src/sys/arch/x86/x86/intr.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.142 2019/02/12 03:13:50 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.143 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.142 2019/02/12 03:13:50 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.143 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1256,6 +1256,13 @@ cpu_intr_init(struct cpu_info *ci)
 #endif
 
 	ci->ci_idepth = -1;
+
+#ifdef XENPVHVM
+	ci->ci_xunmask[0] = 0xfffffffe;
+	for (int i = 1; i < NIPL; i++)
+		ci->ci_xunmask[i] = ci->ci_xunmask[i - 1] & ~(1 << i);
+#endif
+
 }
 
 #if defined(INTRDEBUG) || defined(DDB)

Index: src/sys/arch/x86/x86/mainbus.c
diff -u src/sys/arch/x86/x86/mainbus.c:1.2 src/sys/arch/x86/x86/mainbus.c:1.3
--- src/sys/arch/x86/x86/mainbus.c:1.2	Sat Dec 22 08:35:04 2018
+++ src/sys/arch/x86/x86/mainbus.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.2 2018/12/22 08:35:04 maxv Exp $ */
+/* $NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $ */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.2 2018/12/22 08:35:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2019/02/14 08:18:25 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,13 +86,13 @@ CFATTACH_DECL2_NEW(mainbus, sizeof(struc
     NULL, NULL,
     mainbus_rescan, mainbus_childdetached);
 
-#if defined(__i386__) && !defined(XEN)
+#if defined(__i386__) && !defined(XENPV)
 void i386_mainbus_childdetached(device_t, device_t);
 int  i386_mainbus_rescan(device_t, const char *, const int *);
 void i386_mainbus_attach(device_t, device_t, void *);
 #endif
 
-#if defined(__x86_64__) && !defined(XEN)
+#if defined(__x86_64__) && !defined(XENPV)
 void amd64_mainbus_attach(device_t, device_t, void *);
 #endif
 
@@ -220,18 +220,20 @@ mainbus_attach(device_t parent, device_t
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-#if defined(XEN)
+#if defined(XENPV)
 	if (xendomain_is_dom0()) {
-#endif
+#endif /* XENPV */
 		x86_cpubus_attach(self);
 
-#if defined(__i386__) && !defined(XEN)
+#if defined(__i386__) && !defined(XENPV)
 		i386_mainbus_attach(parent, self, aux);
-#elif defined(__x86_64__) && !defined(XEN)
+#elif defined(__x86_64__) && !defined(XENPV)
 		amd64_mainbus_attach(parent, self, aux);
 #endif
-#if defined(XEN)
+#if defined(XENPV)
 	}
+#endif /* XENPV */
+#if defined(XEN)
 	xen_mainbus_attach(parent, self, aux);
 #endif
 }

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.322 src/sys/arch/x86/x86/pmap.c:1.323
--- src/sys/arch/x86/x86/pmap.c:1.322	Wed Feb 13 08:38:25 2019
+++ src/sys/arch/x86/x86/pmap.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.322 2019/02/13 08:38:25 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.323 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.322 2019/02/13 08:38:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.323 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1233,6 +1233,17 @@ pmap_bootstrap(vaddr_t kva_start)
 	pentium_idt_vaddr = pmap_bootstrap_valloc(1);
 #endif
 
+#if defined(XENPVHVM)
+	/* XXX: move to hypervisor.c with appropriate API adjustments */
+	extern paddr_t HYPERVISOR_shared_info_pa;
+	extern volatile struct xencons_interface *xencons_interface; /* XXX */
+	extern struct xenstore_domain_interface *xenstore_interface; /* XXX */
+
+	HYPERVISOR_shared_info = (void *) pmap_bootstrap_valloc(1);
+	HYPERVISOR_shared_info_pa = pmap_bootstrap_palloc(1);
+	xencons_interface = (void *) pmap_bootstrap_valloc(1);
+	xenstore_interface = (void *) pmap_bootstrap_valloc(1);
+#endif
 	/*
 	 * Now we reserve some VM for mapping pages when doing a crash dump.
 	 */

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.122 src/sys/arch/x86/x86/x86_machdep.c:1.123
--- src/sys/arch/x86/x86/x86_machdep.c:1.122	Mon Feb 11 14:59:33 2019
+++ src/sys/arch/x86/x86/x86_machdep.c	Thu Feb 14 08:18:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.122 2019/02/11 14:59:33 cherry Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.123 2019/02/14 08:18:25 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.122 2019/02/11 14:59:33 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.123 2019/02/14 08:18:25 cherry Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -1271,12 +1271,12 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		       CTL_CREATE, CTL_EOL);
 #endif
 
-#ifndef XENPV
+#ifndef XEN
 	void sysctl_speculation_init(struct sysctllog **);
 	sysctl_speculation_init(clog);
 #endif
 
-#ifndef XENPV
+#ifndef XEN
 	void sysctl_eagerfpu_init(struct sysctllog **);
 	sysctl_eagerfpu_init(clog);
 #endif

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.177 src/sys/arch/xen/conf/files.xen:1.178
--- src/sys/arch/xen/conf/files.xen:1.177	Thu Feb 14 06:59:24 2019
+++ src/sys/arch/xen/conf/files.xen	Thu Feb 14 08:18:26 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.177 2019/02/14 06:59:24 cherry Exp $
+#	$NetBSD: files.xen,v 1.178 2019/02/14 08:18:26 cherry Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -38,7 +38,9 @@ defparam		PCI_CONF_MODE
 
 file	arch/xen/x86/autoconf.c		xenpv
 ifdef i386
+file	arch/i386/i386/autoconf.c	xenpvhvm
 file	arch/i386/i386/aout_machdep.c	exec_aout
+file	arch/i386/i386/i386func.S	machdep & xenpvhvm
 file	arch/i386/i386/busfunc.S
 file	arch/i386/i386/cpufunc.S
 file	arch/i386/i386/cpu_in_cksum.S   (inet | inet6) & cpu_in_cksum
@@ -62,6 +64,8 @@ file	crypto/blowfish/arch/i386/bf_enc.S	
 file	crypto/blowfish/arch/i386/bf_cbc.S	blowfish
 
 elifdef amd64
+file	arch/amd64/amd64/autoconf.c		xenpvhvm
+file	arch/amd64/amd64/amd64func.S		machdep & xenpvhvm
 file	arch/amd64/amd64/busfunc.S
 file	arch/amd64/amd64/cpufunc.S
 file	arch/amd64/amd64/cpu_in_cksum.S		(inet | inet6) & cpu_in_cksum
@@ -80,11 +84,13 @@ file	kern/subr_disk_mbr.c		disk
 file	uvm/pmap/pmap_pvt.c
 file	arch/x86/x86/db_memrw.c		ddb | kgdb
 file	arch/x86/x86/db_trace.c		ddb
+file	arch/x86/x86/efi.c		machdep
+file	arch/x86/x86/errata.c		machdep
 file	arch/x86/x86/fpu.c
 file	arch/x86/x86/dbregs.c
 file	arch/xen/x86/hypervisor_machdep.c
 file	arch/x86/x86/kgdb_machdep.c	kgdb
-# file 	arch/x86/x86/mtrr_i686.c	mtrr
+file 	arch/x86/x86/mtrr_i686.c	mtrr & (dom0ops | xenpvhvm)
 file	arch/x86/x86/syscall.c
 file	arch/xen/x86/x86_xpmap.c	xenpv
 file	arch/xen/x86/xen_pmap.c		xenpv
@@ -97,10 +103,11 @@ file	arch/x86/x86/cpu_ucode_intel.c	dom0
 file	arch/x86/x86/compat_60_cpu_ucode.c      compat_60 & dom0ops & cpu_ucode
 
 
-file	arch/xen/xen/xen_machdep.c	xenpv
+file	arch/xen/xen/xen_machdep.c
 
 file	arch/xen/xen/clock.c		xenpv
-file	arch/x86/isa/rtc.c		dom0ops
+file	arch/x86/isa/clock.c		xenpvhvm
+file	arch/x86/isa/rtc.c		dom0ops | xenpvhvm
 file	arch/xen/xen/evtchn.c
 
 file	arch/xen/xen/xengnt.c
@@ -136,16 +143,20 @@ file	arch/x86/x86/core_machdep.c	coredum
 file	arch/xen/x86/xen_bus_dma.c	machdep & xenpv
 file	arch/x86/x86/bus_space.c	machdep
 file	arch/xen/x86/consinit.c		machdep & xenpv
+file	arch/x86/x86/consinit.c		machdep & xenpvhvm
 file	arch/x86/x86/identcpu.c		machdep
 file	arch/xen/x86/pintr.c		machdep & dom0ops & xenpv
 file	arch/xen/x86/xen_ipi.c		multiprocessor & xenpv
 file	arch/x86/x86/idt.c		machdep
+file	arch/x86/x86/intr.c		machdep & xenpvhvm
+file	arch/x86/x86/ipi.c		xenpvhvm
 file	arch/x86/x86/pmap.c		machdep
 file	arch/x86/x86/x86_tlb.c		machdep
 file	arch/x86/x86/procfs_machdep.c	procfs
 file	arch/x86/x86/sys_machdep.c	machdep
 file	arch/x86/x86/tsc.c		machdep
 file	arch/x86/x86/vm_machdep.c	machdep
+file	arch/x86/x86/x86_autoconf.c	machdep & xenpvhvm
 file	arch/x86/x86/x86_machdep.c	machdep
 file	arch/x86/x86/cpu_topology.c	machdep
 file	arch/x86/x86/platform.c		machdep
@@ -169,9 +180,15 @@ define xendevbus {}
 # System bus types
 #
 
-device mainbus: cpubus, ioapicbus, hypervisorbus, bios32, ipmibus, acpibus
+device mainbus: isabus, pcibus, cpubus, ioapicbus, hypervisorbus, bios32, ipmibus, acpibus
 attach	mainbus at root
 file	arch/xen/x86/xen_mainbus.c		mainbus
+ifdef  	amd64
+file	arch/amd64/amd64/amd64_mainbus.c	mainbus & xenpvhvm
+elifdef i386
+file	arch/i386/i386/i386_mainbus.c		mainbus & xenpvhvm
+file	dev/eisa/eisabusprint.c			xenpvhvm
+endif
 file	arch/x86/x86/mainbus.c			mainbus
 
 # Xen hypervisor
@@ -255,7 +272,7 @@ include "dev/apm/files.apm"
 include "dev/acpi/files.acpi"
 file	arch/xen/xen/xen_acpi_machdep.c	acpi & xenpv
 file	arch/x86/x86/mpacpi.c		acpi
-file	arch/x86/x86/i8259.c		dom0ops
+file	arch/x86/x86/i8259.c		xenpvhvm | dom0ops
 
 # Stubs for x86 routines not included in the system
 file	arch/x86/x86/x86_stub.c
@@ -290,6 +307,7 @@ attach cpu at cpubus
 device vcpu
 attach vcpu at xendevbus
 file	arch/xen/x86/cpu.c		xenpv & vcpu
+file 	arch/x86/x86/cpu.c			xenpvhvm
 
 # CPU features
 #
@@ -376,10 +394,12 @@ include	"dev/pcmcia/files.pcmcia"
 defflag	opt_xen.h			DOM0OPS
 file	arch/xen/xen/privcmd.c		dom0ops
 file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
-file	arch/x86/pci/pci_machdep.c	hypervisor & pci & dom0ops
-file	arch/x86/pci/pci_intr_machdep.c	hypervisor & pci
-file	arch/x86/isa/isa_machdep.c	hypervisor & dom0ops
-file	arch/xen/xen/xenevt.c		xenevt & dom0ops
+file	arch/x86/pci/pci_machdep.c	(xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm )
+file	arch/x86/pci/pci_intr_machdep.c	(xenpvhvm | hypervisor) & pci
+file	arch/x86/pci/pci_msi_machdep.c	hypervisor & xenpvhvm & pci & ! no_pci_msi_msix
+file	arch/x86/pci/msipic.c		hypervisor & xenpvhvm & pci & ! no_pci_msi_msix
+file	arch/x86/isa/isa_machdep.c	(xenpvhvm | hypervisor) & ( dom0ops | xenpvhvm )
+file	arch/xen/xen/xenevt.c		xenevt & (dom0ops | xenpvhvm)
 file	arch/xen/xen/xennetback_xenbus.c xvif
 file	arch/xen/xen/xennet_checksum.c	xvif | xennet
 file	arch/xen/xen/xbdback_xenbus.c xbdback

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.14 src/sys/arch/xen/x86/xen_intr.c:1.15
--- src/sys/arch/xen/x86/xen_intr.c:1.14	Tue Feb 12 08:04:53 2019
+++ src/sys/arch/xen/x86/xen_intr.c	Thu Feb 14 08:18:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.15 2019/02/14 08:18:26 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.14 2019/02/12 08:04:53 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.15 2019/02/14 08:18:26 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v
 #include <sys/cpu.h>
 
 #include <xen/evtchn.h>
+#include <xen/xenfunc.h>
 
 #include <uvm/uvm.h>
 

Index: src/sys/arch/xen/x86/xen_mainbus.c
diff -u src/sys/arch/xen/x86/xen_mainbus.c:1.5 src/sys/arch/xen/x86/xen_mainbus.c:1.6
--- src/sys/arch/xen/x86/xen_mainbus.c:1.5	Wed Feb 13 09:57:46 2019
+++ src/sys/arch/xen/x86/xen_mainbus.c	Thu Feb 14 08:18:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $	*/
+/*	$NetBSD: xen_mainbus.c,v 1.6 2019/02/14 08:18:26 cherry Exp $	*/
 /*	NetBSD: mainbus.c,v 1.19 2017/05/23 08:54:39 nonaka Exp 	*/
 /*	NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp 	*/
 
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.5 2019/02/13 09:57:46 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_mainbus.c,v 1.6 2019/02/14 08:18:26 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,7 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_mainbus.
 #endif
 #endif
 
-#if defined(MPBIOS) || NACPICA > 0
+#if defined(XENPV) && (defined(MPBIOS) || NACPICA > 0)
 struct mp_bus *mp_busses;
 int mp_nbus;
 struct mp_intr_map *mp_intrs;

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.71 src/sys/arch/xen/xen/hypervisor.c:1.72
--- src/sys/arch/xen/xen/hypervisor.c:1.71	Wed Feb 13 06:52:43 2019
+++ src/sys/arch/xen/xen/hypervisor.c	Thu Feb 14 08:18:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.71 2019/02/13 06:52:43 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,6 +162,30 @@ struct  x86_isa_chipset x86_isa_chipset;
 #endif
 #endif
 
+#if defined(XENPVHVM)
+#include <xen/include/public/arch-x86/cpuid.h>
+#include <xen/include/public/hvm/hvm_op.h>
+#include <xen/include/public/hvm/params.h>
+#include <xen/include/public/vcpu.h>
+
+#include <x86/bootinfo.h>
+
+#define	IDTVEC(name)	__CONCAT(X, name)
+typedef void (vector)(void);
+extern vector IDTVEC(syscall);
+extern vector IDTVEC(syscall32);
+extern vector IDTVEC(osyscall);
+extern vector *x86_exceptions[];
+
+extern vector IDTVEC(hypervisor_pvhvm_callback);
+extern volatile struct xencons_interface *xencons_interface; /* XXX */
+extern struct xenstore_domain_interface *xenstore_interface; /* XXX */
+
+volatile shared_info_t *HYPERVISOR_shared_info __read_mostly;
+paddr_t HYPERVISOR_shared_info_pa;
+union start_info_union start_info_union __aligned(PAGE_SIZE);
+#endif
+
 int xen_version;
 
 /* power management, for save/restore */
@@ -176,9 +200,245 @@ hypervisor_match(device_t parent, cfdata
 {
 	struct hypervisor_attach_args *haa = aux;
 
-	if (strncmp(haa->haa_busname, "hypervisor", sizeof("hypervisor")) == 0)
-		return 1;
-	return 0;
+	/* Attach path sanity check */
+	if (strncmp(haa->haa_busname, "hypervisor", sizeof("hypervisor")) != 0)
+		return 0;
+
+#if defined(XENPVHVM)
+	/*
+	 * The strategy here is to setup hypercall and all PVHVM
+	 * interfaces on match, or fail to match.
+	 * Ideally this should happen under attach, but it's too late
+	 * then and there's no way to bailout.
+	 *
+	 * If match fails, hypervisor does not attach, and the domain
+	 * can boot with the minimal PC AT ISA configuration just
+	 * enough to attach wd(4) and mount the rootfs.
+	 */
+	int vec;
+	extern vaddr_t hypercall_page;
+
+	if (vm_guest == VM_GUEST_XEN) {
+		aprint_normal("%s: Identified Guest XEN in HVM mode.\n",
+		    haa->haa_busname);
+
+		u_int descs[4];
+		x86_cpuid(XEN_CPUID_LEAF(2), descs);
+
+		/* 
+		 * Given 32 bytes per hypercall stub, and an optimistic number
+		 * of 100 hypercalls ( the current max is 55), there shouldn't
+		 * be any reason to spill over the arbitrary number of 1
+		 * hypercall page. This is what we allocate in locore.S
+		 * anyway. Make sure the allocation matches the registration.
+		 */
+
+		KASSERT(descs[0] == 1);
+
+		/* XXX: vtophys(&hypercall_page) */
+		wrmsr(descs[1], (uintptr_t)&hypercall_page - KERNBASE);
+
+		vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */
+
+	} else {
+		aprint_normal("%s: Xen HVM mode not identified. Exiting.\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	if (-1 != HYPERVISOR_xen_version(XENVER_version, NULL)) {
+		printf("%s: detected functional hypercall page.\n",
+		    haa->haa_busname);
+
+		xen_init_features();
+	}
+
+	/* Init various preset boot time data structures  */
+
+	/* XEN xenstore shared page address, event channel */
+	struct xen_hvm_param xen_hvm_param;
+
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_STORE_PFN;
+	
+	if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+		aprint_error("%s: Unable to obtain xenstore page address\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/* Re-use PV field */
+	xen_start_info.store_mfn = xen_hvm_param.value;
+
+	pmap_kenter_pa((vaddr_t) xenstore_interface, ptoa(xen_start_info.store_mfn),
+	    VM_PROT_READ|VM_PROT_WRITE, 0);
+
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_STORE_EVTCHN;
+
+	if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+		aprint_error("%s: Unable to obtain xenstore event channel\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	xen_start_info.store_evtchn = xen_hvm_param.value;
+
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_CONSOLE_PFN;
+	
+	if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+		aprint_error("%s: Unable to obtain xencons page address\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/* Re-use PV field */
+	xen_start_info.console.domU.mfn = xen_hvm_param.value;
+
+	pmap_kenter_pa((vaddr_t) xencons_interface, ptoa(xen_start_info.console.domU.mfn),
+	    VM_PROT_READ|VM_PROT_WRITE, 0);
+
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_CONSOLE_EVTCHN;
+
+	if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+		aprint_error("%s: Unable to obtain xencons event channel\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	xen_start_info.console.domU.evtchn = xen_hvm_param.value;
+
+	/* HYPERVISOR_shared_info */
+	struct xen_add_to_physmap xmap = {
+		.domid = DOMID_SELF,
+		.space = XENMAPSPACE_shared_info,
+		.idx = 0, /* Important - XEN checks for this */
+		.gpfn = atop(HYPERVISOR_shared_info_pa)
+	};
+
+	if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xmap) < 0) {
+		aprint_error("%s: Unable to register HYPERVISOR_shared_info\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/* HYPERVISOR_shared_info va,pa has been allocated in pmap_bootstrap() */
+	pmap_kenter_pa((vaddr_t) HYPERVISOR_shared_info,
+	    HYPERVISOR_shared_info_pa, VM_PROT_READ|VM_PROT_WRITE, 0);
+
+	cpu_info_primary.ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[0];
+
+	/*
+	 * First register callback: here's why
+	 * http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=7b5b8ca7dffde866d851f0b87b994e0b13e5b867
+	 */
+
+	/*
+	 * Check for XENFEAT_hvm_callback_vector. Can't proceed
+	 * without it.
+	 */
+	if (!xen_feature(XENFEAT_hvm_callback_vector)) {
+		aprint_error("%s: XENFEAT_hvm_callback_vector"
+		    "not available, cannot proceed", haa->haa_busname);
+		
+		return 0;
+	}
+
+	/* Register event callback handler. */
+
+	/* We don't really care where it is, as long as it's free */
+	vec = idt_vec_alloc(129, 255);
+
+	idt_vec_set(vec, &IDTVEC(hypervisor_pvhvm_callback));
+
+	cpu_init_idt(); /* XXX remove and use only native one below ? */
+
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_CALLBACK_IRQ;
+
+	/* val[63:56] = 2, val[7:0] = vec */
+	xen_hvm_param.value = ((int64_t)0x2 << 56) | vec;
+
+	if (HYPERVISOR_hvm_op(HVMOP_set_param, &xen_hvm_param) < 0) {
+		aprint_error("%s: Unable to register event callback vector\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/* Print out value. */
+	xen_hvm_param.domid = DOMID_SELF;
+	xen_hvm_param.index = HVM_PARAM_CALLBACK_IRQ;
+	xen_hvm_param.value = 0;
+
+	if (HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+		printf("%s: Unable to get event callback vector\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/*
+	 * Afterwards vector callback is done, register VCPU info
+	 * page. Here's why:
+	 * http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=7b5b8ca7dffde866d851f0b87b994e0b13e5b867
+	 * XXX: Ideally this should happen at vcpu attach.
+	 */
+	struct vcpu_register_vcpu_info vrvi;
+
+	paddr_t vcpu_info_pa = HYPERVISOR_shared_info_pa +
+	    offsetof(struct shared_info, vcpu_info);
+	
+	vrvi.mfn = atop(vcpu_info_pa);
+	vrvi.offset = vcpu_info_pa - trunc_page(vcpu_info_pa);
+
+	if (HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, curcpu()->ci_cpuid /* VCPU0 */,
+		&vrvi) < 0) {
+		aprint_error("%s: Unable to register vcpu info page\n",
+		    haa->haa_busname);
+		return 0;
+	}
+
+	/*
+	 * Set the boot device to xbd0a.
+	 * We claim this is a reasonable default which is picked up
+	 * later as the rootfs device.
+	 *
+	 * We need to do this because the HVM domain loader uses the
+	 * regular BIOS based native boot(8) procedure, which sets the
+	 * boot device to the native driver/partition of whatever was
+	 * detected by the native bootloader.
+	 */
+
+	struct btinfo_rootdevice bi;
+	snprintf(bi.devname, 6, "xbd0a");
+	bi.common.type = BTINFO_ROOTDEVICE;
+	bi.common.len = sizeof(struct btinfo_rootdevice);
+
+	/* From i386/multiboot.c */
+	/*	$NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $	*/
+	int i, len;
+	vaddr_t data;
+	extern struct bootinfo	bootinfo;
+	struct bootinfo *bip = (struct bootinfo *)&bootinfo;
+	len = bi.common.len;
+
+	data = (vaddr_t)&bip->bi_data;
+	for (i = 0; i < bip->bi_nentries; i++) {
+		struct btinfo_common *tmp;
+
+		tmp = (struct btinfo_common *)data;
+		data += tmp->len;
+	}
+	if (data + len < (vaddr_t)&bip->bi_data + sizeof(bip->bi_data)) {
+		memcpy((void *)data, &bi, len);
+		bip->bi_nentries++;
+	}
+
+#endif /* XENPVHVM */
+
+	/* If we got here, it must mean we matched */
+	return 1;
 }
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.84 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.85
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.84	Tue Feb  5 06:17:02 2019
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu Feb 14 08:18:26 2019
@@ -1,4 +1,4 @@
-/*      $NetBSD: if_xennet_xenbus.c,v 1.84 2019/02/05 06:17:02 msaitoh Exp $      */
+/*      $NetBSD: if_xennet_xenbus.c,v 1.85 2019/02/14 08:18:26 cherry Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.84 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.85 2019/02/14 08:18:26 cherry Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -146,6 +146,19 @@ int xennet_debug = 0xff;
 #define DPRINTFN(n,x)
 #endif
 
+#ifdef XENPVHVM
+/* Glue for p2m table stuff. Should be removed eventually */
+#define xpmap_mtop_masked(mpa) (mpa & ~PAGE_MASK)
+#define xpmap_mtop(mpa) (mpa & ~PG_FRAME)
+#define xpmap_ptom_masked(mpa) (mpa & ~PAGE_MASK)
+#define xpmap_ptom(mpa) (mpa & ~PG_FRAME)
+#define xpmap_ptom_map(ppa, mpa)
+#define xpmap_ptom_unmap(ppa)
+#define xpmap_ptom_isvalid 1 /* XXX: valid PA check */
+#define xpmap_pg_nx pmap_pg_nx /* We use the native setting */
+#define xpq_flush_queue() tlbflush()
+#endif /* XENPVHVM */
+
 extern pt_entry_t xpmap_pg_nx;
 
 #define GRANT_INVALID_REF -1 /* entry is free */

Added files:

Index: src/sys/arch/amd64/conf/XEN3_PVHVM
diff -u /dev/null src/sys/arch/amd64/conf/XEN3_PVHVM:1.1
--- /dev/null	Thu Feb 14 08:18:26 2019
+++ src/sys/arch/amd64/conf/XEN3_PVHVM	Thu Feb 14 08:18:25 2019
@@ -0,0 +1,202 @@
+# $NetBSD: XEN3_PVHVM,v 1.1 2019/02/14 08:18:25 cherry Exp $
+
+include 	"arch/amd64/conf/std.xen"
+
+options		XENPVHVM
+
+#options 	MULTIPROCESSOR	# Not yet.
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#options 	UVMHIST
+#options 	UVMHIST_PRINT
+#options 	SYSCALL_DEBUG
+
+#ident		"XEN3_PVHVM-$Revision: 1.1 $"
+
+maxusers	32		# estimated number of users
+options 	MAXPHYS=32768	#xbd doesn't handle 64k transfers
+
+# boot messages with MPBIOS, acpi and ioapic can be quite large
+options 	MSGBUFSIZE=24576
+
+#options 	USER_LDT	# user-settable LDT; used by WINE
+
+#options 	MTRR		# memory-type range register syscall support
+
+#options 	CONSDEVNAME="\"xencons\""
+#options 	CONS_OVERRIDE
+
+options 	INSECURE	# disable kernel security levels - X needs this
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+
+options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+options 	MODULAR		# new style module(7) framework
+options 	USERCONF	# userconf(4) support
+options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+options 	DDB		# in-kernel debugger
+options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	KGDB		# remote debugger
+#options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
+#makeoptions	DEBUG="-g"	# compile full symbol table
+makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
+options DDB_COMMANDONENTER="show registers"
+
+# Compatibility options
+#include 	"conf/compat_netbsd15.config"
+options 	COMPAT_NETBSD32
+options 	COMPAT_LINUX
+options 	COMPAT_LINUX32	# req. COMPAT_LINUX and COMPAT_NETBSD32
+options 	EXEC_ELF32
+
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+options 	DKWEDGE_METHOD_APPLE	# Support Apple partitions as wedges
+#options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
+
+# File systems
+file-system	FFS		# UFS
+file-system	EXT2FS		# second extended file system (linux)
+file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network File System client
+file-system	NTFS		# Windows/NT file system (experimental)
+file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+file-system	NULLFS		# loopback file system
+file-system	OVERLAY		# overlay file system
+file-system	PROCFS		# /proc
+file-system	UMAPFS		# NULLFS + uid and gid remapping
+file-system	UNION		# union file system
+
+# File system options
+options 	QUOTA		# legacy UFS quotas
+options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	DISKLABEL_EI	# disklabel Endian Independent support
+#options 	FFS_EI		# FFS Endian Independent support
+options 	WAPBL		# File system journaling support
+#options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
+options 	NFSSERVER	# Network File System server
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+options 	UFS_EXTATTR	# Extended attribute support for UFS1
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+				# immutable) behave as system flags.
+
+# Networking options
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+
+#
+# wscons options
+#
+# builtin terminal emulations
+#options 	WSEMUL_SUN		# sun terminal emulation
+options 	WSEMUL_VT100		# VT100 / VT220 emulation
+# different kernel output - see dev/wscons/wsdisplayvar.h
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+# compatibility to other console drivers
+options 	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls
+options 	WSDISPLAY_COMPAT_SYSCONS	# emulate some ioctls
+options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
+# console scrolling support.
+options 	WSDISPLAY_SCROLLSUPPORT
+
+config		netbsd	root on ? type ?
+#config		netbsd	root on wd0a type ffs
+#config		netbsd	root on xbd0a type ffs
+#config		netbsd	root on xennet0 type nfs
+
+mainbus0	at root
+
+cpu*		at mainbus?
+
+hypervisor*	at mainbus?		# Xen hypervisor
+#vcpu*		at hypervisor?		# Xen virtual CPUs
+xenbus* 	at hypervisor?		# Xen virtual bus
+xencons*	at hypervisor?		# Xen virtual console
+xennet* 	at xenbus?		# Xen virtual network interface
+xbd*		at xenbus?		# Xen virtual block device
+#balloon*	at xenbus?		# Xen balloon device
+
+# PCI pass-through support:
+#xpci* at xenbus ?			#Xen3 PCI front end driver
+#pci* at xpci ?
+# you then need to add your PCI devices drivers below.
+
+cinclude "arch/amd64/conf/GENERIC.local"
+cinclude "arch/amd64/conf/XEN3_DOMU.local"
+
+# ISA bus support
+isa0	at mainbus?
+
+# Serial Devices
+
+# ISA serial interfaces
+#options 	COM_HAYESP		# adds Hayes ESP serial board support
+# If a com port is used as Xen console it can't be used by the domain0 kernel
+# and there's no easy way to detect this yet. Leave com0 out as it's the
+# port usually used for serial console
+com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports
+com1	at isa? port 0x2f8 irq 3
+#com2	at isa? port 0x3e8 irq 5
+#com3	at isa? port 0x2e8 irq 9
+
+# ATA (IDE) bus support
+# ISA ST506, ESDI, and IDE controllers
+# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
+# fall back to 16bits I/O if 32bits I/O are not functional).
+# Some controllers pass the initial 32bit test, but will fail later.
+wdc0	at isa? port 0x1f0 irq 14 flags 0x00
+wdc1	at isa? port 0x170 irq 15 flags 0x00
+
+# IDE drives
+# Flags are used only with controllers that support DMA operations
+# and mode settings (e.g. some pciide controllers)
+# The lowest order four bits (rightmost digit) of the flags define the PIO
+# mode to use, the next set of four bits the DMA mode and the third set the
+# UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
+# to use, and the last bit must be 1 for this setting to be used.
+# For DMA and UDMA, 0xf (1111) means 'disable'.
+# 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
+# (0xc=1100, 0xa=1010, 0xf=1111)
+# 0x0000 means "use whatever the drive claims to support".
+atabus* at ata?
+wd*	at atabus? drive ? flags 0x0000
+
+
+
+# Pseudo-Devices
+pseudo-device	pty			# pseudo-terminals
+
+# network pseudo-devices
+pseudo-device	bpfilter		# Berkeley packet filter
+pseudo-device	loop			# network loopback
+
+# userland interface to drivers, including autoconf and properties retrieval
+pseudo-device	drvctl
+
+options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
+options 	PAX_ASLR=0		# PaX Address Space Layout Randomization

Index: src/sys/arch/i386/conf/XEN3PAE_PVHVM
diff -u /dev/null src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.1
--- /dev/null	Thu Feb 14 08:18:26 2019
+++ src/sys/arch/i386/conf/XEN3PAE_PVHVM	Thu Feb 14 08:18:25 2019
@@ -0,0 +1,185 @@
+# $NetBSD: XEN3PAE_PVHVM,v 1.1 2019/02/14 08:18:25 cherry Exp $
+
+include 	"arch/xen/conf/std.xen"
+
+options		XENPVHVM		# PVHVM domU support
+
+#options 	MULTIPROCESSOR	# Not yet.
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#options 	UVMHIST
+#options 	UVMHIST_PRINT
+#options 	SYSCALL_DEBUG
+
+maxusers	32		# estimated number of users
+
+#
+options 	XEN
+options 	PAE
+
+makeoptions	CPUFLAGS="-march=i686"
+
+#options 	USER_LDT	# user-settable LDT; used by WINE
+
+#options 	MTRR		# memory-type range register syscall support
+
+#options 	CONSDEVNAME="\"xencons\""
+#options 	CONS_OVERRIDE
+
+options 	INSECURE	# disable kernel security levels - X needs this
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+options 	NTP		# NTP phase/frequency locked loop
+
+options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+options 	MODULAR		# new style module(7) framework
+options 	USERCONF	# userconf(4) support
+options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Alternate buffer queue strategies for better responsiveness under high
+# disk I/O load.
+#options 	BUFQ_READPRIO
+options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+options 	DIAGNOSTIC	# inexpensive kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+options 	DDB		# in-kernel debugger
+options 	DDB_ONPANIC=1	# see also sysctl(7): `ddb.onpanic'
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	KGDB		# remote debugger
+#options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
+#makeoptions	DEBUG="-g"	# compile full symbol table
+options DDB_COMMANDONENTER="trace;show registers"
+
+# Compatibility options
+include 	"conf/compat_netbsd09.config"
+options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
+options 	COMPAT_LINUX	# binary compatibility with Linux
+
+# Wedge support
+options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances
+options 	DKWEDGE_METHOD_GPT	# Supports GPT partitions as wedges
+#options 	DKWEDGE_METHOD_BSDLABEL	# Support disklabel entries as wedges
+#options 	DKWEDGE_METHOD_MBR	# Support MBR partitions as wedges
+options 	DKWEDGE_METHOD_APPLE	# Support Apple partitions as wedges
+#options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
+
+# File systems
+file-system	FFS		# UFS
+file-system	EXT2FS		# second extended file system (linux)
+file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network File System client
+file-system	NTFS		# Windows/NT file system (experimental)
+file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+file-system	FDESC		# /dev/fd
+file-system	KERNFS		# /kern
+file-system	NULLFS		# loopback file system
+file-system	OVERLAY		# overlay file system
+file-system	PROCFS		# /proc
+file-system	UMAPFS		# NULLFS + uid and gid remapping
+file-system	UNION		# union file system
+
+# File system options
+options 	QUOTA		# legacy UFS quotas
+options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	DISKLABEL_EI	# disklabel Endian Independent support
+#options 	FFS_EI		# FFS Endian Independent support
+options 	WAPBL		# File system journaling support
+#options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
+options 	NFSSERVER	# Network File System server
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+options 	UFS_EXTATTR	# Extended attribute support for UFS1
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+				# immutable) behave as system flags.
+#options 	V7FS_EI		# V7FS Endian Independent support
+
+# Networking options
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPv6
+
+options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
+#options 	NFS_BOOT_BOOTSTATIC
+#options 	NFS_BOOTSTATIC_MYIP="\"169.254.1.2\""
+#options 	NFS_BOOTSTATIC_GWIP="\"169.254.1.1\""
+#options 	NFS_BOOTSTATIC_MASK="\"255.255.255.0\""
+#options 	NFS_BOOTSTATIC_SERVADDR="\"169.254.1.1\""
+#options 	NFS_BOOTSTATIC_SERVER="\"server:/path/to/root\""
+
+options 	MAXPHYS=32768	#xbd doesn't handle 64k transfers
+
+config		netbsd	root on ? type ?
+#config		netbsd	root on wd0a type ffs
+#config		netbsd	root on xbd0a type ffs
+#config		netbsd	root on xennet0 type nfs
+
+mainbus0	at root
+
+# Native pathways.
+cpu*		at mainbus?
+
+hypervisor*	at mainbus?		# Xen hypervisor
+#vcpu*		at hypervisor?		# Xen virtual CPUs
+xenbus* 	at hypervisor?		# Xen virtual bus
+xencons*	at hypervisor?		# Xen virtual console
+#xennet* 	at xenbus?		# Xen virtual network interface
+xbd*		at xenbus?		# Xen virtual block device
+#balloon*	at xenbus?		# Xen balloon device
+
+# PCI pass-through support:
+#xpci* at xenbus ?			#Xen3 PCI front end driver
+#pci* at xpci ?
+# you then need to add your PCI devices drivers below.
+
+cinclude "arch/i386/conf/GENERIC.local"
+cinclude "arch/i386/conf/XEN3_DOMU.local"
+
+# ISA bus support
+isa0	at mainbus?
+
+# Serial Devices
+
+# ISA serial interfaces
+#options 	COM_HAYESP		# adds Hayes ESP serial board support
+# If a com port is used as Xen console it can't be used by the domain0 kernel
+# and there's no easy way to detect this yet. Leave com0 out as it's the
+# port usually used for serial console
+com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports
+com1	at isa? port 0x2f8 irq 3
+#com2	at isa? port 0x3e8 irq 5
+#com3	at isa? port 0x2e8 irq 9
+
+# ATA (IDE) bus support
+# ISA ST506, ESDI, and IDE controllers
+# Use flags 0x01 if you want to try to use 32bits data I/O (the driver will
+# fall back to 16bits I/O if 32bits I/O are not functional).
+# Some controllers pass the initial 32bit test, but will fail later.
+#wdc0	at isa? port 0x1f0 irq 14 flags 0x00
+#wdc1	at isa? port 0x170 irq 15 flags 0x00
+
+# ATA (IDE) bus support
+#atabus* at ata?
+#wd*	at atabus? drive ? flags 0x0000
+
+# Pseudo-Devices
+pseudo-device	pty			# pseudo-terminals
+
+# network pseudo-devices
+pseudo-device	bpfilter		# Berkeley packet filter
+pseudo-device	loop			# network loopback
+
+# userland interface to drivers, including autoconf and properties retrieval
+pseudo-device	drvctl
+
+options 	PAX_MPROTECT=0		# PaX mprotect(2) restrictions
+options 	PAX_ASLR=0		# PaX Address Space Layout Randomization
+

Reply via email to