svn commit: r202912 - in user/kmacy/releng_8_rump/lib/libunet: . include include/amd64 include/amd64/include include/sys test unet_sys

Kip Macy kmacy at FreeBSD.org
Sun Jan 24 09:02:38 UTC 2010


Author: kmacy
Date: Sun Jan 24 09:02:38 2010
New Revision: 202912
URL: http://svn.freebsd.org/changeset/base/202912

Log:
  - do pcpu initialization
  - make curthread work
  - skip module registration

Added:
  user/kmacy/releng_8_rump/lib/libunet/include/amd64/
  user/kmacy/releng_8_rump/lib/libunet/include/amd64/include/
  user/kmacy/releng_8_rump/lib/libunet/include/amd64/include/pcpu.h   (contents, props changed)
  user/kmacy/releng_8_rump/lib/libunet/include/machine   (contents, props changed)
  user/kmacy/releng_8_rump/lib/libunet/include/sys/pcpu.h   (contents, props changed)
Modified:
  user/kmacy/releng_8_rump/lib/libunet/Makefile
  user/kmacy/releng_8_rump/lib/libunet/test/init.c
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_glue.c
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c
  user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_synch.c

Modified: user/kmacy/releng_8_rump/lib/libunet/Makefile
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/Makefile	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/Makefile	Sun Jan 24 09:02:38 2010	(r202912)
@@ -13,11 +13,11 @@ LIB=	unet
 UNET_KERN_COMMON_OBJS +=	\
 	kern_environment.o	\
 	kern_mbuf.o		\
-	kern_module.o		\
 	kern_mtxpool.o		\
 	kern_sysctl.o		\
 	md5c.o			\
 	subr_eventhandler.o	\
+	subr_kobj.o		\
 	subr_lock.o		\
 	subr_param.o		\
 	subr_pcpu.o		\
@@ -89,7 +89,7 @@ UNET_OTHER_COMMON_OBJS =	\
 UNET_GLUE_COMMON_OBJS =		\
 	unet_compat.o		\
 	unet_glue.o		\
-	unet_in_cksum.o	\
+	unet_in_cksum.o		\
 	unet_init_main.o	\
 	unet_lock.o		\
 	unet_kern_condvar.o	\

Added: user/kmacy/releng_8_rump/lib/libunet/include/amd64/include/pcpu.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/kmacy/releng_8_rump/lib/libunet/include/amd64/include/pcpu.h	Sun Jan 24 09:02:38 2010	(r202912)
@@ -0,0 +1,236 @@
+/*-
+ * Copyright (c) Peter Wemm <peter at netplex.com.au>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (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$
+ */
+
+#ifndef _MACHINE_PCPU_H_
+#define	_MACHINE_PCPU_H_
+
+#ifndef _SYS_CDEFS_H_
+#error "sys/cdefs.h is a prerequisite for this file"
+#endif
+
+#if defined(XEN) || defined(XENHVM)
+#ifndef NR_VIRQS
+#define	NR_VIRQS	24
+#endif
+#ifndef NR_IPIS
+#define	NR_IPIS		2
+#endif
+#endif
+
+#ifdef XENHVM
+#define PCPU_XEN_FIELDS							\
+	;								\
+	unsigned int pc_last_processed_l1i;				\
+	unsigned int pc_last_processed_l2i
+#else
+#define PCPU_XEN_FIELDS
+#endif
+
+/*
+ * The SMP parts are setup in pmap.c and locore.s for the BSP, and
+ * mp_machdep.c sets up the data for the AP's to "see" when they awake.
+ * The reason for doing it via a struct is so that an array of pointers
+ * to each CPU's data can be set up for things like "check curproc on all
+ * other processors"
+ */
+#define	PCPU_MD_FIELDS							\
+	char	pc_monitorbuf[128] __aligned(128); /* cache line */	\
+	struct	pcpu *pc_prvspace;	/* Self-reference */		\
+	struct	pmap *pc_curpmap;					\
+	struct	amd64tss *pc_tssp;	/* TSS segment active on CPU */	\
+	struct	amd64tss *pc_commontssp;/* Common TSS for the CPU */	\
+	register_t pc_rsp0;						\
+	register_t pc_scratch_rsp;	/* User %rsp in syscall */	\
+	u_int	pc_apic_id;						\
+	u_int   pc_acpi_id;		/* ACPI CPU id */		\
+	/* Pointer to the CPU %fs descriptor */				\
+	struct user_segment_descriptor	*pc_fs32p;			\
+	/* Pointer to the CPU %gs descriptor */				\
+	struct user_segment_descriptor	*pc_gs32p;			\
+	/* Pointer to the CPU LDT descriptor */				\
+	struct system_segment_descriptor *pc_ldt;			\
+	/* Pointer to the CPU TSS descriptor */				\
+	struct system_segment_descriptor *pc_tss			\
+	PCPU_XEN_FIELDS
+
+#ifdef _KERNEL
+
+#ifdef lint
+
+extern struct pcpu *pcpup;
+
+#define	PCPU_GET(member)	(pcpup->pc_ ## member)
+#define	PCPU_ADD(member, val)	(pcpup->pc_ ## member += (val))
+#define	PCPU_INC(member)	PCPU_ADD(member, 1)
+#define	PCPU_PTR(member)	(&pcpup->pc_ ## member)
+#define	PCPU_SET(member, val)	(pcpup->pc_ ## member = (val))
+
+#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF)
+
+/*
+ * Evaluates to the byte offset of the per-cpu variable name.
+ */
+#define	__pcpu_offset(name)						\
+	__offsetof(struct pcpu, name)
+
+/*
+ * Evaluates to the type of the per-cpu variable name.
+ */
+#define	__pcpu_type(name)						\
+	__typeof(((struct pcpu *)0)->name)
+
+/*
+ * Evaluates to the address of the per-cpu variable name.
+ */
+#define	__PCPU_PTR(name) __extension__ ({				\
+	__pcpu_type(name) *__p;						\
+									\
+	__asm __volatile("movq %%gs:%1,%0; addq %2,%0"			\
+	    : "=r" (__p)						\
+	    : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),	\
+	      "i" (__pcpu_offset(name)));				\
+									\
+	__p;								\
+})
+
+/*
+ * Evaluates to the value of the per-cpu variable name.
+ */
+#define	__PCPU_GET(name) __extension__ ({				\
+	__pcpu_type(name) __res;					\
+	struct __s {							\
+		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\
+	} __s;								\
+									\
+	if (sizeof(__res) == 1 || sizeof(__res) == 2 ||			\
+	    sizeof(__res) == 4 || sizeof(__res) == 8) {			\
+		__asm __volatile("mov %%gs:%1,%0"			\
+		    : "=r" (__s)					\
+		    : "m" (*(struct __s *)(__pcpu_offset(name))));	\
+		*(struct __s *)(void *)&__res = __s;			\
+	} else {							\
+		__res = *__PCPU_PTR(name);				\
+	}								\
+	__res;								\
+})
+
+/*
+ * Adds the value to the per-cpu counter name.  The implementation
+ * must be atomic with respect to interrupts.
+ */
+#define	__PCPU_ADD(name, val) do {					\
+	__pcpu_type(name) __val;					\
+	struct __s {							\
+		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\
+	} __s;								\
+									\
+	__val = (val);							\
+	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\
+	    sizeof(__val) == 4 || sizeof(__val) == 8) {			\
+		__s = *(struct __s *)(void *)&__val;			\
+		__asm __volatile("add %1,%%gs:%0"			\
+		    : "=m" (*(struct __s *)(__pcpu_offset(name)))	\
+		    : "r" (__s));					\
+	} else								\
+		*__PCPU_PTR(name) += __val;				\
+} while (0)
+
+/*
+ * Increments the value of the per-cpu counter name.  The implementation
+ * must be atomic with respect to interrupts.
+ */
+#define	__PCPU_INC(name) do {						\
+	CTASSERT(sizeof(__pcpu_type(name)) == 1 ||			\
+	    sizeof(__pcpu_type(name)) == 2 ||				\
+	    sizeof(__pcpu_type(name)) == 4 ||				\
+	    sizeof(__pcpu_type(name)) == 8);				\
+	if (sizeof(__pcpu_type(name)) == 1) {				\
+		__asm __volatile("incb %%gs:%0"				\
+		    : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\
+		    : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\
+	} else if (sizeof(__pcpu_type(name)) == 2) {			\
+		__asm __volatile("incw %%gs:%0"				\
+		    : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\
+		    : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\
+	} else if (sizeof(__pcpu_type(name)) == 4) {			\
+		__asm __volatile("incl %%gs:%0"				\
+		    : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\
+		    : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\
+	} else if (sizeof(__pcpu_type(name)) == 8) {			\
+		__asm __volatile("incq %%gs:%0"				\
+		    : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\
+		    : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\
+	}								\
+} while (0)
+
+/*
+ * Sets the value of the per-cpu variable name to value val.
+ */
+#define	__PCPU_SET(name, val) {						\
+	__pcpu_type(name) __val;					\
+	struct __s {							\
+		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\
+	} __s;								\
+									\
+	__val = (val);							\
+	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\
+	    sizeof(__val) == 4 || sizeof(__val) == 8) {			\
+		__s = *(struct __s *)(void *)&__val;			\
+		__asm __volatile("mov %1,%%gs:%0"			\
+		    : "=m" (*(struct __s *)(__pcpu_offset(name)))	\
+		    : "r" (__s));					\
+	} else {							\
+		*__PCPU_PTR(name) = __val;				\
+	}								\
+}
+
+#define	PCPU_GET(member)	__PCPU_GET(pc_ ## member)
+#define	PCPU_ADD(member, val)	__PCPU_ADD(pc_ ## member, val)
+#define	PCPU_INC(member)	__PCPU_INC(pc_ ## member)
+#define	PCPU_PTR(member)	__PCPU_PTR(pc_ ## member)
+#define	PCPU_SET(member, val)	__PCPU_SET(pc_ ## member, val)
+
+extern __thread struct thread *pcurthread;
+
+static __inline struct thread *
+__curthread(void)
+{
+
+	return (pcurthread);
+}
+#define	curthread		(__curthread())
+
+#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */
+
+#error "this file needs to be ported to your compiler"
+
+#endif /* lint, etc. */
+
+#endif /* _KERNEL */
+
+#endif /* !_MACHINE_PCPU_H_ */

Added: user/kmacy/releng_8_rump/lib/libunet/include/machine
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/kmacy/releng_8_rump/lib/libunet/include/machine	Sun Jan 24 09:02:38 2010	(r202912)
@@ -0,0 +1 @@
+link amd64/include
\ No newline at end of file

Added: user/kmacy/releng_8_rump/lib/libunet/include/sys/pcpu.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/kmacy/releng_8_rump/lib/libunet/include/sys/pcpu.h	Sun Jan 24 09:02:38 2010	(r202912)
@@ -0,0 +1,213 @@
+/*-
+ * Copyright (c) 2001 Wind River Systems, Inc.
+ * All rights reserved.
+ * Written by: John Baldwin <jhb at FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (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$
+ */
+
+#ifndef _SYS_PCPU_H_
+#define	_SYS_PCPU_H_
+
+#ifdef LOCORE
+#error "no assembler-serviceable parts inside"
+#endif
+
+#include <sys/queue.h>
+#include <sys/vmmeter.h>
+#include <sys/resource.h>
+#include <machine/pcpu.h>
+
+struct pcb;
+struct thread;
+
+/*
+ * Define a set for pcpu data.
+ * 
+ * We don't use SET_DECLARE because it defines the set as 'a' when we
+ * want 'aw'.  GCC considers uninitialized data in a seperate section
+ * writable and there is no generic zero initializer that works for
+ * structs and scalars.
+ */
+extern uintptr_t *__start_set_pcpu;
+extern uintptr_t *__stop_set_pcpu;
+
+__asm__(
+#if defined(__arm__)
+	".section set_pcpu, \"aw\", %progbits\n"
+#else
+	".section set_pcpu, \"aw\", @progbits\n"
+#endif
+	"\t.p2align " __XSTRING(CACHE_LINE_SHIFT) "\n"
+	"\t.previous");
+
+/*
+ * Array of dynamic pcpu base offsets.  Indexed by id.
+ */
+extern uintptr_t dpcpu_off[];
+
+/*
+ * Convenience defines.
+ */
+#define	DPCPU_START		(uintptr_t)&__start_set_pcpu
+#define	DPCPU_STOP		(uintptr_t)&__stop_set_pcpu
+#define	DPCPU_BYTES		(DPCPU_STOP - DPCPU_START)
+#define	DPCPU_MODMIN		2048
+#define	DPCPU_SIZE		roundup2(DPCPU_BYTES, PAGE_SIZE)
+#define	DPCPU_MODSIZE		(DPCPU_SIZE - (DPCPU_BYTES - DPCPU_MODMIN))
+
+/*
+ * Declaration and definition.
+ */
+#define	DPCPU_NAME(n)		pcpu_entry_##n
+#define	DPCPU_DECLARE(t, n)	extern t DPCPU_NAME(n)
+#define	DPCPU_DEFINE(t, n)	t DPCPU_NAME(n) __section("set_pcpu") __used
+
+/*
+ * Accessors with a given base.
+ */
+#define	_DPCPU_PTR(b, n)						\
+    (__typeof(DPCPU_NAME(n))*)((b) + (uintptr_t)&DPCPU_NAME(n))
+#define	_DPCPU_GET(b, n)	(*_DPCPU_PTR(b, n))
+#define	_DPCPU_SET(b, n, v)	(*_DPCPU_PTR(b, n) = v)
+
+/*
+ * Accessors for the current cpu.
+ */
+#define	DPCPU_PTR(n)		_DPCPU_PTR(PCPU_GET(dynamic), n)
+#define	DPCPU_GET(n)		(*DPCPU_PTR(n))
+#define	DPCPU_SET(n, v)		(*DPCPU_PTR(n) = v)
+
+/*
+ * Accessors for remote cpus.
+ */
+#define	DPCPU_ID_PTR(i, n)	_DPCPU_PTR(dpcpu_off[(i)], n)
+#define	DPCPU_ID_GET(i, n)	(*DPCPU_ID_PTR(i, n))
+#define	DPCPU_ID_SET(i, n, v)	(*DPCPU_ID_PTR(i, n) = v)
+
+/* 
+ * XXXUPS remove as soon as we have per cpu variable
+ * linker sets and  can define rm_queue in _rm_lock.h
+*/
+struct rm_queue {
+	struct rm_queue* volatile rmq_next;
+	struct rm_queue* volatile rmq_prev;
+};
+
+#define	PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU) + 1))
+
+
+/*
+ * This structure maps out the global data that needs to be kept on a
+ * per-cpu basis.  The members are accessed via the PCPU_GET/SET/PTR
+ * macros defined in <machine/pcpu.h>.  Machine dependent fields are
+ * defined in the PCPU_MD_FIELDS macro defined in <machine/pcpu.h>.
+ */
+struct pcpu {
+	struct thread	*pc_curthread;		/* Current thread */
+	struct thread	*pc_idlethread;		/* Idle thread */
+	struct thread	*pc_fpcurthread;	/* Fp state owner */
+	struct thread	*pc_deadthread;		/* Zombie thread or NULL */
+	struct pcb	*pc_curpcb;		/* Current pcb */
+	uint64_t	pc_switchtime;
+	int		pc_switchticks;
+	u_int		pc_cpuid;		/* This cpu number */
+	cpumask_t	pc_cpumask;		/* This cpu mask */
+	cpumask_t	pc_other_cpus;		/* Mask of all other cpus */
+	SLIST_ENTRY(pcpu) pc_allcpu;
+	struct lock_list_entry *pc_spinlocks;
+#ifdef KTR
+	char		pc_name[PCPU_NAME_LEN];	/* String name for KTR. */
+#endif
+	struct vmmeter	pc_cnt;			/* VM stats counters */
+	long		pc_cp_time[CPUSTATES];	/* statclock ticks */
+	struct device	*pc_device;
+	void		*pc_netisr;		/* netisr SWI cookie. */
+
+	/* 
+	 * Stuff for read mostly lock
+	 * 
+	 * XXXUPS remove as soon as we have per cpu variable
+	 * linker sets.
+	 */
+	struct rm_queue  pc_rm_queue; 
+
+	/*
+	 * Dynamic per-cpu data area.
+	 */
+	uintptr_t	pc_dynamic;
+
+	/*
+	 * Keep MD fields last, so that CPU-specific variations on a
+	 * single architecture don't result in offset variations of
+	 * the machine-independent fields of the pcpu. Even though
+	 * the pcpu structure is private to the kernel, some ports
+	 * (e.g. lsof, part of gtop) define _KERNEL and include this
+	 * header. While strictly speaking this is wrong, there's no
+	 * reason not to keep the offsets of the MI fields contants.
+	 * If only to make kernel debugging easier...
+	 */
+	PCPU_MD_FIELDS;
+} __aligned(128);
+
+#ifdef _KERNEL
+
+SLIST_HEAD(cpuhead, pcpu);
+
+extern struct cpuhead cpuhead;
+
+#define	curcpu		0
+#define	curproc		(curthread->td_proc)
+#ifndef curthread
+#define	curthread	PCPU_GET(curthread)
+#endif
+#define	curvidata	PCPU_GET(vidata)
+
+/*
+ * Machine dependent callouts.  cpu_pcpu_init() is responsible for
+ * initializing machine dependent fields of struct pcpu, and
+ * db_show_mdpcpu() is responsible for handling machine dependent
+ * fields for the DDB 'show pcpu' command.
+ */
+
+extern struct pcpu *cpuid_to_pcpu[MAXCPU];
+
+
+void	cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
+void	db_show_mdpcpu(struct pcpu *pcpu);
+
+void	pcpu_destroy(struct pcpu *pcpu);
+struct	pcpu *pcpu_find(u_int cpuid);
+void	pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
+void	*dpcpu_alloc(int size);
+void	dpcpu_copy(void *s, int size);
+void	dpcpu_free(void *s, int size);
+void	dpcpu_init(void *dpcpu, int cpuid);
+
+#endif	/* _KERNEL */
+
+#endif /* !_SYS_PCPU_H_ */

Modified: user/kmacy/releng_8_rump/lib/libunet/test/init.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/test/init.c	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/test/init.c	Sun Jan 24 09:02:38 2010	(r202912)
@@ -1,6 +1,7 @@
 #include <sys/cdefs.h>
 #include <sys/param.h>
 #include <stdlib.h>
+#include <sys/pcpu.h>
 
 extern void mi_startup(void);
 extern void uma_startup(void *, int);
@@ -12,13 +13,16 @@ extern int ncallout;
 int
 main(void)
 {
+	struct pcpu *pc;
+
 	/* vm_init bits */
 	ncallout = 64;
+	pc = malloc(sizeof(struct pcpu));
+	pcpu_init(pc, 0, sizeof(struct pcpu));
 	kern_timeout_callwheel_alloc(malloc(512*1024));
 	kern_timeout_callwheel_init();
 	uma_startup(NULL, 0);
 
-
 	mi_startup();
 
 }

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_compat.c	Sun Jan 24 09:02:38 2010	(r202912)
@@ -98,6 +98,25 @@ getmicrotime(struct timeval *tvp)
 	gettimeofday(&tv, NULL);
 }
 
+__thread struct thread *pcurthread;
+
+struct pthread_start_args 
+{
+	struct thread *psa_td;
+	void (*psa_start_routine)(void *);
+	void *psa_arg;
+};
+
+static void *
+pthread_start_routine(void *arg)
+{
+	struct pthread_start_args *psa = arg;
+
+	pcurthread = psa->psa_td;
+	psa->psa_start_routine(psa->psa_arg);
+	free(psa);
+}
+
 int
 kproc_kthread_add(void (*start_routine)(void *), void *arg,
     struct proc **p,  struct thread **td,
@@ -107,11 +126,16 @@ kproc_kthread_add(void (*start_routine)(
 	int error;
 	pthread_t thread;
 	pthread_attr_t attr;
+	struct pthread_start_args *psa;
 
 	*td = malloc(sizeof(struct thread));
-	pthread_attr_init(&attr);
+	psa = malloc(sizeof(struct pthread_start_args));
+	psa->psa_start_routine = start_routine;
+	psa->psa_arg = arg;
+	psa->psa_td = *td;
 	
-	error = pthread_create(&thread, &attr, start_routine, arg);
+	pthread_attr_init(&attr); 
+	error = pthread_create(&thread, &attr, pthread_start_routine, psa);
 
 	return (error);
 }

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_glue.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_glue.c	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_glue.c	Sun Jan 24 09:02:38 2010	(r202912)
@@ -23,6 +23,9 @@
 #include <vm/vm_map.h>
 #include <vm/vm_extern.h>
 
+int bootverbose;
+struct prison prison0;
+
 SYSCTL_NODE(, 0,	  sysctl, CTLFLAG_RW, 0,
 	"Sysctl internal magic");
 
@@ -755,3 +758,9 @@ knlist_init_mtx(struct knlist *knl, stru
 {
 	
 }
+
+void
+module_register_init(void *arg)
+{
+	printf("skipped module registration");
+}

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_intr.c	Sun Jan 24 09:02:38 2010	(r202912)
@@ -850,6 +850,7 @@ swi_add(struct intr_event **eventp, cons
 	    (pri * RQ_PPQ) + PI_SOFT, flags, cookiep);
 	if (error)
 		return (error);
+#if 0
 	if (pri == SWI_CLOCK) {
 		struct proc *p;
 		p = ie->ie_thread->it_thread->td_proc;
@@ -857,6 +858,7 @@ swi_add(struct intr_event **eventp, cons
 		p->p_flag |= P_NOLOAD;
 		PROC_UNLOCK(p);
 	}
+#endif	
 	return (0);
 }
 

Modified: user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_synch.c
==============================================================================
--- user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_synch.c	Sun Jan 24 08:59:33 2010	(r202911)
+++ user/kmacy/releng_8_rump/lib/libunet/unet_sys/unet_kern_synch.c	Sun Jan 24 09:02:38 2010	(r202912)
@@ -40,7 +40,7 @@ typedef struct sleep_entry {
 } *sleep_entry_t;
 
 static void synch_setup(void *dummy);
-SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup,
+SYSINIT(synch_setup, SI_SUB_INTR, SI_ORDER_FIRST, synch_setup,
     NULL);
 
 static struct se_head *se_active;


More information about the svn-src-user mailing list