Permalink
Browse files

Sync with head.

  • Loading branch information...
1 parent 92a8ceb commit 2af75bc0c9f1fbf2c3662a5b77641e2a5fe355b7 mjf committed Jul 11, 2007
Showing 2,464 changed files with 150,110 additions and 114,016 deletions.
View
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_red.c,v 1.25 2007/03/04 05:59:02 christos Exp $ */
+/* $NetBSD: altq_red.c,v 1.25.4.1 2007/07/11 19:57:10 mjf Exp $ */
/* $KAME: altq_red.c,v 1.20 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.25 2007/03/04 05:59:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.25.4.1 2007/07/11 19:57:10 mjf Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: altq_red.c,v 1.25 2007/03/04 05:59:02 christos Exp $
#include <sys/sockio.h>
#include <sys/proc.h>
#include <sys/kernel.h>
-#include <sys/kauth.h>
#ifdef ALTQ_FLOWVALVE
#include <sys/queue.h>
#include <sys/time.h>
View
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_subr.c,v 1.21 2007/03/05 22:50:32 he Exp $ */
+/* $NetBSD: altq_subr.c,v 1.21.4.1 2007/07/11 19:57:11 mjf Exp $ */
/* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.21 2007/03/05 22:50:32 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.21.4.1 2007/07/11 19:57:11 mjf Exp $");
#ifdef _KERNEL_OPT
#include "opt_altq.h"
@@ -91,7 +91,7 @@ __KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.21 2007/03/05 22:50:32 he Exp $");
static void tbr_timeout(void *);
int (*altq_input)(struct mbuf *, int) = NULL;
static int tbr_timer = 0; /* token bucket regulator timer */
-static struct callout tbr_callout = CALLOUT_INITIALIZER;
+static struct callout tbr_callout;
#ifdef ALTQ3_CLFIER_COMPAT
static int extract_ports4(struct mbuf *, struct ip *, struct flowinfo_in *);
@@ -857,6 +857,8 @@ init_machclk(void)
machclk_per_tick = machclk_freq / hz;
+ callout_init(&tbr_callout, 0);
+
#ifdef ALTQ_DEBUG
printf("altq: CPU clock: %uHz\n", machclk_freq);
#endif
View
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_var.h,v 1.10 2006/10/15 13:17:13 peter Exp $ */
+/* $NetBSD: altq_var.h,v 1.10.10.1 2007/07/11 19:57:11 mjf Exp $ */
/* $KAME: altq_var.h,v 1.18 2005/04/13 03:44:25 suz Exp $ */
/*
@@ -165,7 +165,7 @@ typedef u_long ioctlcmd_t;
/* use callout */
#include <sys/callout.h>
-#if (__FreeBSD_version > 500000)
+#if (__FreeBSD_version > 500000) || defined(__NetBSD__)
#define CALLOUT_INIT(c) callout_init((c), 0)
#else
#define CALLOUT_INIT(c) callout_init((c))
View
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.34 2006/12/17 16:08:09 peter Exp $
+# $NetBSD: Makefile,v 1.34.8.1 2007/07/11 19:57:12 mjf Exp $
# For now, we install the machine and arch includes, and symlink 'machine'
# to the location of the machine includes (usually).
@@ -39,15 +39,15 @@ SUBDIR+= xen
# bebox \
# cats cesfic cobalt \
# dreamcast \
-# evbarm evbmips evbppc evbsh3 evbsh5 ews4800mips\
+# evbarm evbmips evbppc evbsh3 ews4800mips\
# hp300 hpc hpcarm hpcmips hpcsh \
# i386 iyonix \
# luna68k \
# m68k mac68k macppc mips mipsco mmeye mvme68k \
# netwinder news68k newsmips next68k \
# ofppc \
# pc532 playstation2 pmax powerpc prep \
-# sandpoint sbmips sgimips sh3 sh5 shark sparc sparc64 sun2 sun3 sun68k \
+# sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
# vax \
# x68k x86_64 xen \
# zaurus
View
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.41 2006/12/17 16:11:56 peter Exp $
+$NetBSD: README,v 1.41.8.1 2007/07/11 19:57:12 mjf Exp $
acorn26: Acorn ARM2- and ARM3-based machines (arm, 20000509)
acorn32: Acorn computers Ltd. ARM 6/7/SA based machines (arm, 20011118)
@@ -18,7 +18,6 @@ evbarm: ARM-based eval boards (arm, 20010905)
evbmips: MIPS-based eval boards (mips, 20020307)
evbppc: PowerPC-based eval boards (powerpc, 20021209)
evbsh3: Hitachi SuperH(TM) sh3 and sh4 eval boards (sh3, 20010206)
-evbsh5: Hitachi SuperH(TM) sh5 eval boards (sh5, 20020705)
ews4800mips: NEC's MIPS based EWS4800 workstations (ews4800mips, 20051229)
hp300: Hewlett Packard 300- and 400-series machines (m68k, 19930512)
hp700: Hewlett Packard 700-series machines (hppa, 20020606)
@@ -42,7 +41,6 @@ news68k: Sony's m68k based NET WORK STATION (m68k, 19991209)
newsmips: Sony's MIPS based NET WORK STATION (mips, 19980218)
next68k: NeXT Computer's cubes and slabs (m68k, 19980609)
ofppc: Open Firmware based PowerPC machines (powerpc, 19980528)
-pdp10: Digital PDP 10 emulators; a 9 bit byte, 36 bit word machine (pdp10, 20030831)
pc532: "PC-532" kit computer, based on NS 32532 CPU (ns32k, 19930909)
playstation2: Sony PlayStation 2 (mips, 20011016)
pmax: Digital Equipment Corp. MIPS based machines (mips, 19931012)
@@ -69,7 +67,6 @@ m68k: Motorola 680x0 CPU based platform files
mips: MIPS CPU based platform files
powerpc: PowerPC CPU based platform files
sh3: Hitachi SuperH(TM) sh3 and sh4 CPU based platform files
-sh5: Hitachi SuperH(TM) sh5 CPU based platform files
sparc: Sun Microsystems SPARC(TM) CPU based platform files
x86: Intel x86 based platform files.
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.c,v 1.10 2007/03/04 05:59:03 christos Exp $ */
+/* $NetBSD: cpuswitch.c,v 1.10.4.1 2007/07/11 19:57:12 mjf Exp $ */
/*
* Copyright (c) 2000 Ben Harris.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpuswitch.c,v 1.10 2007/03/04 05:59:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpuswitch.c,v 1.10.4.1 2007/07/11 19:57:12 mjf Exp $");
#include "opt_lockdebug.h"
@@ -48,100 +48,22 @@ __KERNEL_RCSID(0, "$NetBSD: cpuswitch.c,v 1.10 2007/03/04 05:59:03 christos Exp
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/ras.h>
+#include <sys/cpu.h>
#include <uvm/uvm_extern.h>
#include <machine/frame.h>
#include <machine/machdep.h>
-void idle(void);
-
struct pcb *curpcb;
/*
- * Idle
- */
-void
-idle()
-{
-
- sched_unlock_idle();
- spl0();
- while (sched_whichqs == 0)
- continue;
- splhigh();
- sched_lock_idle();
-}
-
-extern int want_resched; /* XXX should be in <machine/cpu.h> */
-
-/*
- * Find the highest-priority runnable process and switch to it.
- *
- * If l1 is NULL, we're switching away from a dying process. We hope it's
- * safe to run on its stack until the switch.
- */
-int
-cpu_switch(struct lwp *l1, struct lwp *newl)
-{
- int which;
- struct prochd *q;
- struct lwp *l2;
- struct proc *p2;
- struct switchframe *dummy;
- /*
- * We enter here with interrupts blocked and sched_lock held.
- */
-
-#if 0
- printf("cpu_switch: %p ->", l1);
-#endif
- curlwp = NULL;
- curpcb = NULL;
- while (sched_whichqs == 0)
- idle();
- which = ffs(sched_whichqs) - 1;
- q = &sched_qs[which];
- l2 = q->ph_link;
- remrunqueue(l2);
- want_resched = 0;
- sched_unlock_idle();
- /* p->p_cpu initialized in fork1() for single-processor */
- l2->l_stat = LSONPROC;
- curlwp = l2;
- curpcb = &curlwp->l_addr->u_pcb;
-#if 0
- printf(" %p\n", l2);
-#endif
- if (l2 == l1)
- return (0);
- if (l1 != NULL)
- pmap_deactivate(l1);
- pmap_activate(l2);
-
- /* Check for Restartable Atomic Sequences. */
- p2 = l2->l_proc;
- if (!LIST_EMPTY(&p2->p_raslist)) {
- struct trapframe *tf = l2->l_addr->u_pcb.pcb_tf;
- void *pc;
-
- pc = ras_lookup(p2, (void *)(tf->tf_r15 & R15_PC));
- if (pc != (void *) -1)
- tf->tf_r15 = (tf->tf_r15 & ~R15_PC) | (register_t) pc;
- }
-
- cpu_loswitch(l1 ? &l1->l_addr->u_pcb.pcb_sf : &dummy,
- l2->l_addr->u_pcb.pcb_sf);
- /* We only get back here after the other process has run. */
- return (1);
-}
-
-/*
* Switch to the indicated lwp.
*/
-void
-cpu_switchto(struct lwp *old, struct lwp *new)
+lwp_t *
+cpu_switchto(lwp_t *old, lwp_t *new)
{
+ struct proc *p2;
/*
* We enter here with interrupts blocked and sched_lock held.
@@ -150,14 +72,23 @@ cpu_switchto(struct lwp *old, struct lwp *new)
#if 0
printf("cpu_switchto: %p -> %p", old, new);
#endif
- want_resched = 0;
- /* p->p_cpu initialized in fork1() for single-processor */
- new->l_stat = LSONPROC;
+
curlwp = new;
curpcb = &curlwp->l_addr->u_pcb;
- sched_unlock_idle();
- pmap_deactivate(old);
- pmap_activate(new);
- cpu_loswitch(&old->l_addr->u_pcb.pcb_sf, new->l_addr->u_pcb.pcb_sf);
- /* We only get back here after the other process has run. */
+
+ if ((new->l_flag & LW_SYSTEM) == 0) {
+ /* Check for Restartable Atomic Sequences. */
+ p2 = new->l_proc;
+ if (!LIST_EMPTY(&p2->p_raslist)) {
+ struct trapframe *tf = new->l_addr->u_pcb.pcb_tf;
+ void *pc;
+
+ pc = ras_lookup(p2, (void *)(tf->tf_r15 & R15_PC));
+ if (pc != (void *) -1)
+ tf->tf_r15 = (tf->tf_r15 & ~R15_PC) |
+ (register_t) pc;
+ }
+ }
+
+ return cpu_loswitch(old, new);
}
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.7 2006/10/08 12:22:35 bjh21 Exp $
+# $NetBSD: genassym.cf,v 1.7.10.1 2007/07/11 19:57:13 mjf Exp $
#
# Copyright (c) 1999 Ben Harris
# All rights reserved.
@@ -47,6 +47,7 @@ endif
define __PROG26 1
define U_PCB offsetof(struct user, u_pcb)
+define PCB_SF offsetof(struct pcb, pcb_sf)
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
define L_ADDR offsetof(struct lwp, l_addr)
@@ -73,4 +74,3 @@ define EFS_RX_FLAGS offsetof(struct eca_fiqstate, efs_rx_flags)
define EFS_RX_MYADDR offsetof(struct eca_fiqstate, efs_rx_myaddr)
define EFS_TX_CURMBUF offsetof(struct eca_fiqstate, efs_tx_curmbuf)
endif
-
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.11 2007/02/28 23:47:09 bjh21 Exp $ */
+/* $NetBSD: locore.S,v 1.11.4.1 2007/07/11 19:57:13 mjf Exp $ */
/*
* Copyright (c) 1998, 1999, 2000 Ben Harris
* Copyright (C) 1994-1997 Mark Brinicombe
@@ -383,44 +383,62 @@ ENTRY_NP(get_r15)
mov r0, r14
mov r15, lr
- /*
- * Low-level context-switch operation. cpu_switch() is in C -- this
- * just handles the bits that can't be done in C.
- *
- * void cpu_loswitch(struct switchframe **fromp,
- * struct switchframe *to)
- *
- * We leave a switchframe on the stack pointed to by fromp,
- * and return to the context in to. This should be called in
- * splhigh();
- */
-/* LINTSTUB: Func: void cpu_loswitch(struct switchframe **fromp, struct switchframe *to) */
+/*
+ * Low-level context-switch operation. cpu_switchto() is in C -- this
+ * just handles the bits that can't be done in C.
+ *
+ * struct lwp *cpu_loswitch(struct lwp *oldl, struct lwp *newl)
+ *
+ * We leave a switchframe on the stack pointed to by and save this in
+ * oldl's PCB, and return to the context in newl. This should be called at
+ * splhigh();
+ *
+ * r0 and r1 must be left intact as they're needed by lwp_startup in
+ * lwp_trampoline
+ */
+/* LINTSTUB: Func: struct lwp *cpu_loswitch(struct lwp *oldl, struct lwp *newl) */
ENTRY(cpu_loswitch)
+ teq r0, #0x00000000
+ beq Lswitch_exited
+
+ ldr r3, [r0, #(L_ADDR)]
+ add r3, r3, #PCB_SF /* r3 = &old->l_addr->u_pcb.pcb_sf */
+
mov r2, sp /* Temporary stack pointer */
stmfd r2!, {r4-r11, r13-r14} /* Save all relevant registers */
- str r2, [r0] /* Save switchframe pointer */
- ldmfd r1, {r4-r11, r13-r14} /* Restore from old switchframe */
+ str r2, [r3] /* Save switchframe pointer */
+
+Lswitch_exited:
+
+ ldr r2, [r1, #(L_ADDR)]
+ ldr r3, [r2, #(PCB_SF)] /* r3 = new->l_addr->u_pcb.pcb_sf; */
+
+ ldmfd r3, {r4-r11, r13-r14} /* Restore from old switchframe */
mov pc, r14 /* and return */
- /*
- * This funny little routine implements starting a process.
- * It's called by cpu_loswitch returning from a faked
- * switchframe set up by cpu_fork(), and gets
- * the function it's meant to enter passed in R4 with its
- * argument in R5. If that function's NULL, or if it returns,
- * we hope there's a trapframe on the stack that'll take us
- * back to userland.
- */
-ENTRY(proc_trampoline)
+/*
+ * This funny little routine implements starting a process.
+ * It's called by cpu_loswitch returning from a faked
+ * switchframe set up by cpu_lwp_fork(), and gets
+ * the function it's meant to enter passed in R4 with its
+ * argument in R5. If that function's NULL, or if it returns,
+ * we hope there's a trapframe on the stack that'll take us
+ * back to userland.
+ *
+ * cpu_loswitch also ensures that r0 is oldl and r1 is newl
+ * for our call to lwp_startup.
+ */
+ENTRY(lwp_trampoline)
mov fp, #0 /* Tie knot in top of stack */
+ bl _C_LABEL(lwp_startup)
mov r0, #0
- bl _C_LABEL(lowerspl) /* spl0() */
+ bl _C_LABEL(lowerspl) /* spl0() */
cmp r4, #0 /* Function to call? */
- beq Lproc_trampoline_nofunc
+ beq Llwp_trampoline_nofunc
mov r0, r5
mov r14, pc /* Save return address */
mov pc, r4 /* Call function */
-Lproc_trampoline_nofunc:
+Llwp_trampoline_nofunc:
b pull_trapframe
/* LINTSTUB: Func: int setjmp(label_t *l) */
@@ -444,4 +462,4 @@ ENTRY(cpu_Debugger)
ldmfd r13!, {pc}
#endif
-RCSID("$NetBSD: locore.S,v 1.11 2007/02/28 23:47:09 bjh21 Exp $")
+RCSID("$NetBSD: locore.S,v 1.11.4.1 2007/07/11 19:57:13 mjf Exp $")
Oops, something went wrong.

0 comments on commit 2af75bc

Please sign in to comment.