CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:36:53 UTC 2022 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c diff -u src/sys/arch/usermode/dev/if_veth.c:1.15 src/sys/arch/usermode/dev/if_veth.c:1.16 --- src/sys/arch/usermode/dev/if_veth.c:1.15 Wed Jun 16 00:21:18 2021 +++ src/sys/arch/usermode/dev/if_veth.c Sun Sep 18 13:36:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_veth.c,v 1.15 2021/06/16 00:21:18 riastradh Exp $ */ +/* $NetBSD: if_veth.c,v 1.16 2022/09/18 13:36:53 thorpej Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.15 2021/06/16 00:21:18 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.16 2022/09/18 13:36:53 thorpej Exp $"); #include #include @@ -181,7 +181,6 @@ veth_init(struct ifnet *ifp) veth_stop(ifp, 0); ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; return 0; } @@ -247,11 +246,6 @@ veth_softtx(void *priv) struct ifnet *ifp = >sc_ec.ec_if; int s; - if (ifp->if_flags & IFF_OACTIVE) { - if (thunk_pollout_tap(sc->sc_tapfd, 0) == 1) - ifp->if_flags &= ~IFF_OACTIVE; - } - s = splnet(); veth_start(ifp); splx(s); @@ -266,7 +260,7 @@ veth_start(struct ifnet *ifp) vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags); - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0) return; for (;;) { @@ -276,7 +270,6 @@ veth_start(struct ifnet *ifp) if (thunk_pollout_tap(sc->sc_tapfd, 0) != 1) { printf("queue full\n"); - ifp->if_flags |= IFF_OACTIVE; break; } @@ -302,7 +295,7 @@ veth_stop(struct ifnet *ifp, int disable { vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags); ifp->if_timer = 0; - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; } static void
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:36:53 UTC 2022 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/dev/if_veth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: skrll Date: Wed Feb 5 07:18:16 UTC 2020 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c diff -u src/sys/arch/usermode/dev/if_veth.c:1.13 src/sys/arch/usermode/dev/if_veth.c:1.14 --- src/sys/arch/usermode/dev/if_veth.c:1.13 Wed May 29 10:07:29 2019 +++ src/sys/arch/usermode/dev/if_veth.c Wed Feb 5 07:18:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_veth.c,v 1.13 2019/05/29 10:07:29 msaitoh Exp $ */ +/* $NetBSD: if_veth.c,v 1.14 2020/02/05 07:18:16 skrll Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.13 2019/05/29 10:07:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.14 2020/02/05 07:18:16 skrll Exp $"); #include #include @@ -225,14 +225,14 @@ veth_softrx(void *priv) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { vethprintf("MGETHDR failed (input error)\n"); - ++ifp->if_ierrors; + if_statinc(ifp, if_ierrors); continue; } if (len > MHLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); -++ifp->if_ierrors; +if_statinc(ifp, if_ierrors); vethprintf("M_EXT not set (input error)\n"); continue; } @@ -297,9 +297,9 @@ veth_start(struct ifnet *ifp) m0->m_pkthdr.len); vethprintf("write returned %d\n", len); if (len > 0) - ++ifp->if_opackets; + if_statinc(ifp, if_opackets); else - ++ifp->if_oerrors; + if_statinc(ifp, if_oerrors); m_freem(m0); } } @@ -316,7 +316,7 @@ static void veth_watchdog(struct ifnet *ifp) { vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags); - ++ifp->if_oerrors; + if_statinc(ifp, if_oerrors); veth_init(ifp); }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: skrll Date: Wed Feb 5 07:18:16 UTC 2020 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/if_veth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jun 13 19:59:14 UTC 2018 Modified Files: src/sys/arch/usermode/dev: vatapi.c Log Message: Split out error reporting and make it compile without SCSIVERBOSE To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vatapi.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/usermode/dev/vatapi.c diff -u src/sys/arch/usermode/dev/vatapi.c:1.1 src/sys/arch/usermode/dev/vatapi.c:1.2 --- src/sys/arch/usermode/dev/vatapi.c:1.1 Tue Jun 5 20:02:43 2018 +++ src/sys/arch/usermode/dev/vatapi.c Wed Jun 13 19:59:14 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vatapi.c,v 1.1 2018/06/05 20:02:43 reinoud Exp $ */ +/* $NetBSD: vatapi.c,v 1.2 2018/06/13 19:59:14 reinoud Exp $ */ /*- * Copyright (c) 2018 Reinoud Zandijk @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vatapi.c,v 1.1 2018/06/05 20:02:43 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vatapi.c,v 1.2 2018/06/13 19:59:14 reinoud Exp $"); #include #include @@ -48,6 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: vatapi.c,v 1 #include #include +#include "opt_scsi.h" + /* parameter? */ #define VDEV_ATAPI_DRIVE 0 #define MAX_SIZE ((1<<16)) @@ -68,7 +70,9 @@ static void vatapi_probe_device(struct a static void vatapi_complete(void *arg); /* for debugging */ +#ifdef SCSIVERBOSE void scsipi_print_sense_data_real(struct scsi_sense_data *sense, int verbosity); +#endif /* Note its one vdev, one adapter, one channel for now */ @@ -279,6 +283,21 @@ vatapi_scsipi_request(struct scsipi_chan static void +vatapi_report_problem(scsireq_t *kreq) +{ +#ifdef SCSIVERBOSE + printf("vatapi cmd failed: "); + for (int i = 0; i < kreq->cmdlen; i++) { + printf("%02x ", kreq->cmd[i]); + } + printf("\n"); + scsipi_print_sense_data_real( + (struct scsi_sense_data *) kreq->sense, 1); +#endif +} + + +static void vatapi_complete(void *arg) { struct vatapi_softc *sc = arg; @@ -316,8 +335,7 @@ vatapi_complete(void *arg) xs->error = XS_SHORTSENSE; /* ATAPI */ memcpy(>sense.scsi_sense, kreq.sense, sizeof(struct scsi_sense_data)); -// scsipi_print_sense_data_real( -//(struct scsi_sense_data *) kreq.sense, 1); + vatapi_report_problem(); break; default: thunk_printf("unhandled/unknown retstst %d\n", kreq.retsts);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jun 13 19:59:14 UTC 2018 Modified Files: src/sys/arch/usermode/dev: vatapi.c Log Message: Split out error reporting and make it compile without SCSIVERBOSE To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vatapi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jun 4 20:06:52 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Its a hack, but make sure the pages are paged in To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jun 4 20:06:52 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Its a hack, but make sure the pages are paged in To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.32 src/sys/arch/usermode/dev/ld_thunkbus.c:1.33 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.32 Sat Jan 13 10:27:58 2018 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Mon Jun 4 20:06:52 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.32 2018/01/13 10:27:58 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.33 2018/06/04 20:06:52 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.32 2018/01/13 10:27:58 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.33 2018/06/04 20:06:52 reinoud Exp $"); #include #include @@ -271,6 +271,9 @@ ld_thunkbus_complete(void *arg) //bp->b_flags & B_READ ? "read" : "write", //(unsigned int)bp->b_bcount, (long long)offset, bp->b_data, bp->b_flags); + /* this is silly, but better make sure */ + thunk_assert_presence((vaddr_t) bp->b_data, (size_t) bp->b_bcount); + /* read/write the request */ if (bp->b_flags & B_READ) { ret = thunk_pread(sc->sc_fd, bp->b_data, bp->b_bcount, offset); @@ -285,6 +288,7 @@ ld_thunkbus_complete(void *arg) if ((ret >= 0) && (ret == bp->b_bcount)) { bp->b_resid = 0; } else { + // printf("ret = %d, errno %d?\n",(int) ret, thunk_geterrno()); bp->b_error = thunk_geterrno(); bp->b_resid = bp->b_bcount; }
Re: CVS commit: src/sys/arch/usermode/dev
In article <20180601072615.462e4f...@cvs.netbsd.org>, Reinoud Zandijk wrote: >-=-=-=-=-=- > >Module Name: src >Committed By: reinoud >Date: Fri Jun 1 07:26:15 UTC 2018 > >Modified Files: > src/sys/arch/usermode/dev: cpu.c > >Log Message: >Pass the address of the array, this fixes issues with i386 compilation If you remove & from both is probably better (if they are both arrays) :-) christos
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Fri Jun 1 07:26:15 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Pass the address of the array, this fixes issues with i386 compilation To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.79 src/sys/arch/usermode/dev/cpu.c:1.80 --- src/sys/arch/usermode/dev/cpu.c:1.79 Tue May 29 09:25:01 2018 +++ src/sys/arch/usermode/dev/cpu.c Fri Jun 1 07:26:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.80 2018/06/01 07:26:15 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.80 2018/06/01 07:26:15 reinoud Exp $"); #include #include @@ -353,9 +353,9 @@ cpu_setmcontext(struct lwp *l, const mco thunk_printf_debug("cpu_setmcontext\n"); #endif if ((flags & _UC_CPU) != 0) - memcpy(>uc_mcontext.__gregs, mcp->__gregs, sizeof(__gregset_t)); + memcpy(>uc_mcontext.__gregs, >__gregs, sizeof(__gregset_t)); if ((flags & _UC_FPU) != 0) - memcpy(>uc_mcontext.__fpregs, mcp->__fpregs, sizeof(__fpregset_t)); + memcpy(>uc_mcontext.__fpregs, >__fpregs, sizeof(__fpregset_t)); if ((flags & _UC_TLSBASE) != 0) lwp_setprivate(l, (void *) (uintptr_t) mcp->_mc_tlsbase);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Fri Jun 1 07:26:15 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Pass the address of the array, this fixes issues with i386 compilation To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 09:25:01 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only report the things we've passed in the mcontext and leave out flags that are not reported in the mcontext anyway! To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.78 src/sys/arch/usermode/dev/cpu.c:1.79 --- src/sys/arch/usermode/dev/cpu.c:1.78 Tue May 29 07:35:40 2018 +++ src/sys/arch/usermode/dev/cpu.c Tue May 29 09:25:01 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.78 2018/05/29 07:35:40 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.79 2018/05/29 09:25:01 reinoud Exp $"); #include #include @@ -322,9 +322,9 @@ cpu_getmcontext(struct lwp *l, mcontext_ #endif memcpy(mcp, >uc_mcontext, sizeof(mcontext_t)); - /* XXX be overzealous and provide all */ + /* report we have the CPU FPU and TLSBASE registers */ mcp->_mc_tlsbase = (uintptr_t) l->l_private; - *flags = _UC_CPU | _UC_STACK | _UC_SIGMASK | _UC_FPU | _UC_TLSBASE; + *flags = _UC_CPU | _UC_FPU | _UC_TLSBASE; return; } @@ -338,7 +338,7 @@ cpu_mcontext_validate(struct lwp *l, con */ /* XXX NO CHECKING! XXX */ #ifdef CPU_DEBUG - thunk_printf("cpu_mcontext_validate\n"); + thunk_printf_debug("cpu_mcontext_validate\n"); #endif return 0; }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 09:25:01 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only report the things we've passed in the mcontext and leave out flags that are not reported in the mcontext anyway! To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 07:09:22 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only set requested parts of the mcontext in cpu_setmcontext() Make the atomic switcher `atomic' by using splhigh() To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue May 29 07:09:22 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Only set requested parts of the mcontext in cpu_setmcontext() Make the atomic switcher `atomic' by using splhigh() To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.76 src/sys/arch/usermode/dev/cpu.c:1.77 --- src/sys/arch/usermode/dev/cpu.c:1.76 Thu May 24 19:39:04 2018 +++ src/sys/arch/usermode/dev/cpu.c Tue May 29 07:09:21 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.77 2018/05/29 07:09:21 reinoud Exp $"); #include #include @@ -194,7 +194,6 @@ cpu_need_proftick(struct lwp *l) } -/* XXX make sure this is atomic? */ static void cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp) @@ -202,19 +201,22 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t struct pcb *oldpcb; struct pcb *newpcb; struct cpu_info *ci; + int s; oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; newpcb = lwp_getpcb(newlwp); ci = curcpu(); - ci->ci_stash = oldlwp; + s = splhigh(); + ci->ci_stash = oldlwp; if (oldpcb) oldpcb->pcb_errno = thunk_geterrno(); thunk_seterrno(newpcb->pcb_errno); /* set both ucontexts up for TLS just in case */ + newpcb->pcb_ucp.uc_mcontext._mc_tlsbase = (uintptr_t) newlwp->l_private; newpcb->pcb_ucp.uc_flags |= _UC_TLSBASE; @@ -224,8 +226,11 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t newpcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE; curlwp = newlwp; + splx(s); + if (thunk_setcontext(>pcb_ucp)) panic("setcontext failed"); + /* not reached */ } @@ -341,11 +346,28 @@ cpu_setmcontext(struct lwp *l, const mco #ifdef CPU_DEBUG thunk_printf_debug("cpu_setmcontext\n"); #endif - ucp->uc_flags = flags; - memcpy(>uc_mcontext, mcp, sizeof(mcontext_t)); + if ((flags & _UC_CPU) != 0) + memcpy(>uc_mcontext.__gregs, mcp->__gregs, sizeof(__gregset_t)); + if ((flags & _UC_FPU) != 0) + memcpy(>uc_mcontext.__fpregs, mcp->__fpregs, sizeof(__fpregset_t)); + if ((flags & _UC_TLSBASE) != 0) + lwp_setprivate(l, (void *) (uintptr_t) mcp->_mc_tlsbase); - /* update our private, it might be altered in userland */ - l->l_private = (void *) ucp->uc_mcontext._mc_tlsbase; +#if 0 + /* + * XXX we ignore the set and clear stack since signals are done + * slightly differently. + */ +thunk_printf("%s: flags %x\n", __func__, flags); + mutex_enter(l->l_proc->p_lock); + if (flags & _UC_SETSTACK) + l->l_sigstk.ss_flags |= SS_ONSTACK; + if (flags & _UC_CLRSTACK) + l->l_sigstk.ss_flags &= ~SS_ONSTACK; + mutex_exit(l->l_proc->p_lock); +#endif + + ucp->uc_flags |= (flags & (_UC_CPU | _UC_FPU | _UC_TLSBASE)); return 0; } @@ -410,7 +432,6 @@ cpu_lwp_fork(struct lwp *l1, struct lwp l2 ? l2->l_name : "none", l2, stack, (int)stacksize); #endif - if (stack) panic("%s: stack passed, can't handle\n", __func__);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu May 24 19:39:04 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: First try at TLS support and getcontext/setcontext/swapcontext support. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.75 src/sys/arch/usermode/dev/cpu.c:1.76 --- src/sys/arch/usermode/dev/cpu.c:1.75 Thu May 17 19:00:39 2018 +++ src/sys/arch/usermode/dev/cpu.c Thu May 24 19:39:04 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill@@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.76 2018/05/24 19:39:04 reinoud Exp $"); #include #include @@ -66,6 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 static int cpu_match(device_t, cfdata_t, void *); static void cpu_attach(device_t, device_t, void *); +/* XXX */ +//extern void *_lwp_getprivate(void); +//extern int _lwp_setprivate(void *); + + struct cpu_info cpu_info_primary = { .ci_dev = 0, .ci_self = _info_primary, @@ -130,7 +135,6 @@ cpu_configure(void) if (config_rootfound("mainbus", NULL) == NULL) panic("configure: mainbus not configured"); - spl0(); } @@ -189,6 +193,8 @@ cpu_need_proftick(struct lwp *l) { } + +/* XXX make sure this is atomic? */ static void cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp) @@ -208,12 +214,22 @@ cpu_switchto_atomic(lwp_t *oldlwp, lwp_t thunk_seterrno(newpcb->pcb_errno); + /* set both ucontexts up for TLS just in case */ + newpcb->pcb_ucp.uc_mcontext._mc_tlsbase = + (uintptr_t) newlwp->l_private; + newpcb->pcb_ucp.uc_flags |= _UC_TLSBASE; + + newpcb->pcb_userret_ucp.uc_mcontext._mc_tlsbase = + (uintptr_t) newlwp->l_private; + newpcb->pcb_userret_ucp.uc_flags |= _UC_TLSBASE; + curlwp = newlwp; if (thunk_setcontext(>pcb_ucp)) panic("setcontext failed"); /* not reached */ } + lwp_t * cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning) { @@ -232,17 +248,23 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw newlwp ? newlwp->l_lid : -1); if (oldpcb) { thunk_printf_debug("oldpcb uc_link=%p, uc_stack.ss_sp=%p, " - "uc_stack.ss_size=%d\n", + "uc_stack.ss_size=%d, l_private %p, uc_mcontext._mc_tlsbase=%p(%s)\n", oldpcb->pcb_ucp.uc_link, oldpcb->pcb_ucp.uc_stack.ss_sp, - (int)oldpcb->pcb_ucp.uc_stack.ss_size); + (int)oldpcb->pcb_ucp.uc_stack.ss_size, + (void *) oldlwp->l_private, + (void *) oldpcb->pcb_ucp.uc_mcontext._mc_tlsbase, + oldpcb->pcb_ucp.uc_flags & _UC_TLSBASE? "ON":"off"); } if (newpcb) { - thunk_printf_debug("newpcb uc_link=%p, uc_stack.ss_sp=%p, " - "uc_stack.ss_size=%d\n", + thunk_printf_debug("newpewcb uc_link=%p, uc_stack.ss_sp=%p, " + "uc_stack.ss_size=%d, l_private %p, uc_mcontext._mc_tlsbase=%p(%s)\n", newpcb->pcb_ucp.uc_link, newpcb->pcb_ucp.uc_stack.ss_sp, - (int)newpcb->pcb_ucp.uc_stack.ss_size); + (int)newpcb->pcb_ucp.uc_stack.ss_size, + (void *) newlwp->l_private, + (void *) newpcb->pcb_ucp.uc_mcontext._mc_tlsbase, + newpcb->pcb_ucp.uc_flags & _UC_TLSBASE? "ON":"off"); } #endif /* !CPU_DEBUG */ @@ -250,7 +272,6 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw KASSERT(newlwp); thunk_makecontext(>sc_ucp, (void (*)(void)) cpu_switchto_atomic, 2, oldlwp, newlwp, NULL, NULL); - KASSERT(sc); if (oldpcb) { thunk_swapcontext(>pcb_ucp, >sc_ucp); @@ -284,11 +305,16 @@ cpu_getmcontext(struct lwp *l, mcontext_ { struct pcb *pcb = lwp_getpcb(l); ucontext_t *ucp = >pcb_userret_ucp; - + #ifdef CPU_DEBUG thunk_printf_debug("cpu_getmcontext\n"); #endif memcpy(mcp, >uc_mcontext, sizeof(mcontext_t)); + + /* XXX be overzealous and provide all */ + mcp->_mc_tlsbase = (uintptr_t) l->l_private; + *flags = _UC_CPU | _UC_STACK | _UC_SIGMASK | _UC_FPU | _UC_TLSBASE; + return; } @@ -299,6 +325,10 @@ cpu_mcontext_validate(struct lwp *l, con * can we check here? or should that be done in the target * specific places? */ + /* XXX NO CHECKING! XXX */ +#ifdef CPU_DEBUG + thunk_printf("cpu_mcontext_validate\n"); +#endif return 0; } @@ -311,7 +341,12 @@ cpu_setmcontext(struct lwp *l, const mco #ifdef CPU_DEBUG thunk_printf_debug("cpu_setmcontext\n"); #endif + ucp->uc_flags = flags; memcpy(>uc_mcontext, mcp, sizeof(mcontext_t)); + + /* update our private, it might be altered in userland */ + l->l_private = (void *) ucp->uc_mcontext._mc_tlsbase; + return 0; } @@ -382,10 +417,14 @@ cpu_lwp_fork(struct lwp *l1, struct
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu May 24 19:39:04 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: First try at TLS support and getcontext/setcontext/swapcontext support. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu May 17 19:00:39 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Refactor for easier debugging and while here add some more signals To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu May 17 19:00:39 UTC 2018 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Refactor for easier debugging and while here add some more signals To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.74 src/sys/arch/usermode/dev/cpu.c:1.75 --- src/sys/arch/usermode/dev/cpu.c:1.74 Thu Jun 1 02:45:08 2017 +++ src/sys/arch/usermode/dev/cpu.c Thu May 17 19:00:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.74 2017/06/01 02:45:08 chs Exp $ */ +/* $NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill@@ -30,7 +30,7 @@ #include "opt_hz.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.74 2017/06/01 02:45:08 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.75 2018/05/17 19:00:39 reinoud Exp $"); #include #include @@ -119,6 +119,8 @@ cpu_attach(device_t parent, device_t sel sc->sc_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK; thunk_sigaddset(>sc_ucp.uc_sigmask, SIGALRM); thunk_sigaddset(>sc_ucp.uc_sigmask, SIGIO); + thunk_sigaddset(>sc_ucp.uc_sigmask, SIGINT); + thunk_sigaddset(>sc_ucp.uc_sigmask, SIGTSTP); } void @@ -191,9 +193,13 @@ static void cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp) { - struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; - struct pcb *newpcb = lwp_getpcb(newlwp); - struct cpu_info *ci = curcpu(); + struct pcb *oldpcb; + struct pcb *newpcb; + struct cpu_info *ci; + + oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; + newpcb = lwp_getpcb(newlwp); + ci = curcpu(); ci->ci_stash = oldlwp; @@ -241,6 +247,7 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw #endif /* !CPU_DEBUG */ /* create atomic switcher */ + KASSERT(newlwp); thunk_makecontext(>sc_ucp, (void (*)(void)) cpu_switchto_atomic, 2, oldlwp, newlwp, NULL, NULL);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 13 10:27:58 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Keep up with changes in ld(4): adding ioctl handling on the ld(4) instead of using the old dedicated ldflush() function. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 13 10:27:58 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Keep up with changes in ld(4): adding ioctl handling on the ld(4) instead of using the old dedicated ldflush() function. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.31 src/sys/arch/usermode/dev/ld_thunkbus.c:1.32 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.31 Sat Jan 13 10:08:35 2018 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Sat Jan 13 10:27:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.31 2018/01/13 10:08:35 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.32 2018/01/13 10:27:58 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill@@ -27,13 +27,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.31 2018/01/13 10:08:35 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.32 2018/01/13 10:27:58 reinoud Exp $"); #include #include #include #include #include +#include #include #include @@ -48,7 +49,7 @@ static void ld_thunkbus_attach(device_t, static int ld_thunkbus_ldstart(struct ld_softc *, struct buf *); static int ld_thunkbus_lddump(struct ld_softc *, void *, int, int); -static int ld_thunkbus_ldflush(struct ld_softc *, int); +static int ld_thunkbus_ioctl(struct ld_softc *, u_long, void *, int32_t, bool); //#define LD_USE_AIO @@ -122,7 +123,7 @@ ld_thunkbus_attach(device_t parent, devi ld->sc_maxqueuecnt = 1; ld->sc_start = ld_thunkbus_ldstart; ld->sc_dump = ld_thunkbus_lddump; - ld->sc_flush = ld_thunkbus_ldflush; + ld->sc_ioctl = ld_thunkbus_ioctl; sc->sc_ih = softint_establish(SOFTINT_BIO, ld_thunkbus_complete, ld); @@ -315,13 +316,19 @@ ld_thunkbus_lddump(struct ld_softc *ld, return 0; } + static int -ld_thunkbus_ldflush(struct ld_softc *ld, int flags) +ld_thunkbus_ioctl(struct ld_softc *ld, u_long cmd, void *addr, int32_t flag, +bool poll) { struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; - if (thunk_fsync(sc->sc_fd) == -1) - return thunk_geterrno(); - - return 0; + switch (cmd) { + case DIOCCACHESYNC: + if (thunk_fsync(sc->sc_fd) == -1) + return thunk_geterrno(); + return 0; + default: + return EPASSTHROUGH; + } }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 13 10:08:35 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Add the missing strategy argument of ldattach() To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.30 src/sys/arch/usermode/dev/ld_thunkbus.c:1.31 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.30 Sat Jan 21 22:09:57 2012 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Sat Jan 13 10:08:35 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.30 2012/01/21 22:09:57 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.31 2018/01/13 10:08:35 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.30 2012/01/21 22:09:57 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.31 2018/01/13 10:08:35 reinoud Exp $"); #include #include @@ -135,7 +135,7 @@ ld_thunkbus_attach(device_t parent, devi sc->busy = false; - ldattach(ld); + ldattach(ld, BUFQ_DISK_DEFAULT_STRAT); } #ifdef LD_USE_AIO @@ -260,7 +260,7 @@ ld_thunkbus_complete(void *arg) struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; struct ld_thunkbus_transfer *tt = >sc_tt; struct buf *bp = tt->tt_bp; - off_t offset = bp->b_rawblkno * ld->sc_secsize; + off_t offset = (off_t) bp->b_rawblkno * ld->sc_secsize; int64_t ret; if (!sc->busy)
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 13 10:08:35 UTC 2018 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Add the missing strategy argument of ldattach() To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: christos Date: Wed Mar 26 08:29:41 UTC 2014 Modified Files: src/sys/arch/usermode/dev: vaudio.c Log Message: fix sprintf To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/vaudio.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/usermode/dev/vaudio.c diff -u src/sys/arch/usermode/dev/vaudio.c:1.3 src/sys/arch/usermode/dev/vaudio.c:1.4 --- src/sys/arch/usermode/dev/vaudio.c:1.3 Sun Jan 15 05:51:12 2012 +++ src/sys/arch/usermode/dev/vaudio.c Wed Mar 26 04:29:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vaudio.c,v 1.3 2012/01/15 10:51:12 jmcneill Exp $ */ +/* $NetBSD: vaudio.c,v 1.4 2014/03/26 08:29:41 christos Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.3 2012/01/15 10:51:12 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.4 2014/03/26 08:29:41 christos Exp $); #include sys/param.h #include sys/proc.h @@ -396,8 +396,8 @@ vaudio_getdev(void *opaque, struct audio { struct vaudio_softc *sc = opaque; - sprintf(adev-name, Virtual Audio); - sprintf(adev-version, ); + snprintf(adev-name, sizeof(adev-name), Virtual Audio); + adev-version[0] = '\0'; snprintf(adev-config, sizeof(adev-config), %s, sc-sc_audiopath); return 0;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: christos Date: Wed Mar 26 08:29:41 UTC 2014 Modified Files: src/sys/arch/usermode/dev: vaudio.c Log Message: fix sprintf To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/vaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jun 25 14:43:54 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Implement dummy `cpu_mcontext_validate' to make it compile again. This function needs to be implemented in the target secton one day for extra security. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.70 src/sys/arch/usermode/dev/cpu.c:1.71 --- src/sys/arch/usermode/dev/cpu.c:1.70 Sat Mar 3 21:15:15 2012 +++ src/sys/arch/usermode/dev/cpu.c Mon Jun 25 14:43:54 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.70 2012/03/03 21:15:15 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.71 2012/06/25 14:43:54 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.70 2012/03/03 21:15:15 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.71 2012/06/25 14:43:54 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -286,6 +286,16 @@ cpu_getmcontext(struct lwp *l, mcontext_ } int +cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp) +{ + /* + * can we check here? or should that be done in the target + * specific places? + */ + return 0; +} + +int cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) { struct pcb *pcb = lwp_getpcb(l);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jun 25 14:43:54 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Implement dummy `cpu_mcontext_validate' to make it compile again. This function needs to be implemented in the target secton one day for extra security. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 18 19:17:02 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Create an atomic switchto() that has SIGALRM and SIGIO signals blocked that might otherwise disrupt the setting of curlwp to match the lwp context. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.67 src/sys/arch/usermode/dev/cpu.c:1.68 --- src/sys/arch/usermode/dev/cpu.c:1.67 Sun Jan 15 10:45:03 2012 +++ src/sys/arch/usermode/dev/cpu.c Wed Jan 18 19:17:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.68 2012/01/18 19:17:02 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.68 2012/01/18 19:17:02 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -78,6 +78,9 @@ char cpu_model[48] = virtual processor typedef struct cpu_softc { device_t sc_dev; struct cpu_info *sc_ci; + + ucontext_t sc_ucp; + uint8_t sc_ucp_stack[PAGE_SIZE]; } cpu_softc_t; @@ -108,8 +111,16 @@ cpu_attach(device_t parent, device_t sel aprint_naive(\n); aprint_normal(\n); + cpu_info_primary.ci_dev = self; sc-sc_dev = self; sc-sc_ci = cpu_info_primary; + + thunk_getcontext(sc-sc_ucp); + sc-sc_ucp.uc_stack.ss_sp = sc-sc_ucp_stack; + sc-sc_ucp.uc_stack.ss_size = PAGE_SIZE - sizeof(register_t); + sc-sc_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK; + thunk_sigaddset(sc-sc_ucp.uc_sigmask, SIGALRM); + thunk_sigaddset(sc-sc_ucp.uc_sigmask, SIGIO); } void @@ -176,12 +187,34 @@ cpu_need_proftick(struct lwp *l) { } +static +void +cpu_switchto_atomic(lwp_t *oldlwp, lwp_t *newlwp) +{ + struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; + struct pcb *newpcb = lwp_getpcb(newlwp); + struct cpu_info *ci = curcpu(); + + ci-ci_stash = oldlwp; + + if (oldpcb) + oldpcb-pcb_errno = thunk_geterrno(); + + thunk_seterrno(newpcb-pcb_errno); + + curlwp = newlwp; + if (thunk_setcontext(newpcb-pcb_ucp)) + panic(setcontext failed); + /* not reached */ +} + lwp_t * cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning) { struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; struct pcb *newpcb = lwp_getpcb(newlwp); struct cpu_info *ci = curcpu(); + cpu_softc_t *sc = device_private(ci-ci_dev); #ifdef CPU_DEBUG thunk_printf_debug(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n, @@ -207,19 +240,16 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw } #endif /* !CPU_DEBUG */ - ci-ci_stash = oldlwp; - - if (oldpcb) { - oldpcb-pcb_errno = thunk_geterrno(); - thunk_seterrno(newpcb-pcb_errno); - curlwp = newlwp; - if (thunk_swapcontext(oldpcb-pcb_ucp, newpcb-pcb_ucp)) - panic(swapcontext failed); + /* create atomic switcher */ + thunk_makecontext(sc-sc_ucp, (void (*)(void)) cpu_switchto_atomic, + 2, oldlwp, newlwp, NULL); + + if (!oldpcb) { + thunk_setcontext(sc-sc_ucp); + /* never returns */ } else { - thunk_seterrno(newpcb-pcb_errno); - curlwp = newlwp; - if (thunk_setcontext(newpcb-pcb_ucp)) - panic(setcontext failed); + thunk_swapcontext(oldpcb-pcb_ucp, sc-sc_ucp); + /* returns here */ } #ifdef CPU_DEBUG @@ -344,7 +374,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp /* get l2 its own stack */ pcb2-pcb_ucp.uc_stack.ss_sp = pcb2-sys_stack; pcb2-pcb_ucp.uc_stack.ss_size = pcb2-sys_stack_top - pcb2-sys_stack; - pcb2-pcb_ucp.uc_flags = _UC_STACK | _UC_CPU; + pcb2-pcb_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK; pcb2-pcb_ucp.uc_link = pcb2-pcb_userret_ucp; thunk_makecontext(pcb2-pcb_ucp, (void (*)(void)) cpu_lwp_trampoline, @@ -382,6 +412,7 @@ cpu_startup(void) /* init lwp0 */ memset(lwp0pcb, 0, sizeof(lwp0pcb)); thunk_getcontext(lwp0pcb.pcb_ucp); + lwp0pcb.pcb_ucp.uc_flags = _UC_STACK | _UC_CPU | _UC_SIGMASK; uvm_lwp_setuarea(lwp0, (vaddr_t) lwp0pcb); memcpy(lwp0pcb.pcb_userret_ucp, lwp0pcb.pcb_ucp, sizeof(ucontext_t));
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 18 19:17:02 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Create an atomic switchto() that has SIGALRM and SIGIO signals blocked that might otherwise disrupt the setting of curlwp to match the lwp context. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Sun Jan 15 10:45:03 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: sync disks and unmount at shutdown, and run shutdownhooks + pmf shutdown handlers To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.66 src/sys/arch/usermode/dev/cpu.c:1.67 --- src/sys/arch/usermode/dev/cpu.c:1.66 Sun Jan 15 10:18:58 2012 +++ src/sys/arch/usermode/dev/cpu.c Sun Jan 15 10:45:03 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.66 #include sys/msgbuf.h #include sys/kmem.h #include sys/kernel.h +#include sys/mount.h #include dev/cons.h @@ -127,11 +128,22 @@ cpu_reboot(int howto, char *bootstr) { extern void usermode_reboot(void); - splhigh(); + if (cold) + howto |= RB_HALT; + + if ((howto RB_NOSYNC) == 0) + vfs_shutdown(); + else + suspendsched(); + + doshutdownhooks(); + pmf_system_shutdown(boothowto); if ((howto RB_POWERDOWN) == RB_POWERDOWN) thunk_exit(0); + splhigh(); + if (howto RB_DUMP) thunk_abort();
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Sun Jan 15 10:51:13 UTC 2012 Modified Files: src/sys/arch/usermode/dev: if_veth.c vaudio.c Log Message: close file descriptors at shutdown To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/if_veth.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/vaudio.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/usermode/dev/if_veth.c diff -u src/sys/arch/usermode/dev/if_veth.c:1.3 src/sys/arch/usermode/dev/if_veth.c:1.4 --- src/sys/arch/usermode/dev/if_veth.c:1.3 Mon Jan 9 20:39:39 2012 +++ src/sys/arch/usermode/dev/if_veth.c Sun Jan 15 10:51:12 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $ */ +/* $NetBSD: if_veth.c,v 1.4 2012/01/15 10:51:12 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.4 2012/01/15 10:51:12 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, $NetBSD: if_veth.c,v static int veth_match(device_t, cfdata_t, void *); static void veth_attach(device_t, device_t, void *); +static bool veth_shutdown(device_t, int); static int veth_init(struct ifnet *); static void veth_start(struct ifnet *); @@ -103,6 +104,9 @@ veth_attach(device_t parent, device_t se struct ifnet *ifp = sc-sc_ec.ec_if; sc-sc_dev = self; + + pmf_device_register1(self, NULL, NULL, veth_shutdown); + sc-sc_tapfd = thunk_open_tap(taa-u.veth.device); if (sc-sc_tapfd == -1) { aprint_error(: couldn't open %s: %d\n, @@ -156,6 +160,17 @@ veth_attach(device_t parent, device_t se panic(couldn't establish veth rx interrupt); } +static bool +veth_shutdown(device_t self, int flags) +{ + struct veth_softc *sc = device_private(self); + + if (sc-sc_tapfd != -1) + thunk_close(sc-sc_tapfd); + + return true; +} + static int veth_init(struct ifnet *ifp) { Index: src/sys/arch/usermode/dev/vaudio.c diff -u src/sys/arch/usermode/dev/vaudio.c:1.2 src/sys/arch/usermode/dev/vaudio.c:1.3 --- src/sys/arch/usermode/dev/vaudio.c:1.2 Mon Dec 26 23:50:43 2011 +++ src/sys/arch/usermode/dev/vaudio.c Sun Jan 15 10:51:12 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vaudio.c,v 1.2 2011/12/26 23:50:43 jmcneill Exp $ */ +/* $NetBSD: vaudio.c,v 1.3 2012/01/15 10:51:12 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.2 2011/12/26 23:50:43 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.3 2012/01/15 10:51:12 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -76,6 +76,7 @@ struct vaudio_softc { static int vaudio_match(device_t, cfdata_t, void *); static void vaudio_attach(device_t, device_t, void *); +static bool vaudio_shutdown(device_t, int); static void vaudio_intr(void *); static void vaudio_softintr_play(void *); @@ -148,6 +149,9 @@ vaudio_attach(device_t parent, device_t aprint_normal(: Virtual Audio (device = %s)\n, taa-u.vaudio.device); sc-sc_dev = self; + + pmf_device_register1(self, NULL, NULL, vaudio_shutdown); + sc-sc_audiopath = taa-u.vaudio.device; sc-sc_audiofd = thunk_audio_open(sc-sc_audiopath); if (sc-sc_audiofd == -1) { @@ -181,6 +185,17 @@ vaudio_attach(device_t parent, device_t sc-sc_audiodev = audio_attach_mi(vaudio_hw_if, sc, self); } +static bool +vaudio_shutdown(device_t self, int flags) +{ + struct vaudio_softc *sc = device_private(self); + + if (sc-sc_audiofd != -1) + thunk_audio_close(sc-sc_audiofd); + + return true; +} + static void vaudio_intr(void *opaque) {
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Sun Jan 15 10:45:03 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: sync disks and unmount at shutdown, and run shutdownhooks + pmf shutdown handlers To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Sun Jan 15 10:51:13 UTC 2012 Modified Files: src/sys/arch/usermode/dev: if_veth.c vaudio.c Log Message: close file descriptors at shutdown To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/dev/if_veth.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/vaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 14 21:24:52 UTC 2012 Modified Files: src/sys/arch/usermode/dev: clock.c Log Message: Cleanup clock.c removing unneeded function To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/dev/clock.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/usermode/dev/clock.c diff -u src/sys/arch/usermode/dev/clock.c:1.23 src/sys/arch/usermode/dev/clock.c:1.24 --- src/sys/arch/usermode/dev/clock.c:1.23 Thu Dec 15 03:42:32 2011 +++ src/sys/arch/usermode/dev/clock.c Sat Jan 14 21:24:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.23 2011/12/15 03:42:32 jmcneill Exp $ */ +/* $NetBSD: clock.c,v 1.24 2012/01/14 21:24:52 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -29,7 +29,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.23 2011/12/15 03:42:32 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.24 2012/01/14 21:24:52 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -50,7 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: clock.c,v 1. static int clock_match(device_t, cfdata_t, void *); static void clock_attach(device_t, device_t, void *); -static void clock(void); static void clock_signal(int sig, siginfo_t *info, void *ctx); static unsigned int clock_getcounter(struct timecounter *); @@ -124,35 +123,17 @@ clock_intr(void *priv) while (nticks-- 0) { hardclock(cf); - }; + } } static void -clock(void) +clock_signal(int sig, siginfo_t *info, void *ctx) { curcpu()-ci_idepth++; - spl_intr(IPL_SOFTCLOCK, clock_intr, NULL); + spl_intr(IPL_CLOCK, clock_intr, NULL); curcpu()-ci_idepth--; } -static void -clock_signal(int sig, siginfo_t *info, void *ctx) -{ -#if 0 - ucontext_t *uct = ctx; - struct lwp *l; - struct pcb *pcb; - - l = curlwp; - pcb = lwp_getpcb(l); - - /* copy this state as where the lwp was XXX NEEDED? */ - memcpy(pcb-pcb_ucp, uct, sizeof(ucontext_t)); -#endif - - clock(); -} - static unsigned int clock_getcounter(struct timecounter *tc) {
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 14 21:42:52 UTC 2012 Modified Files: src/sys/arch/usermode/dev: clock.c Log Message: Revert back to IPL_SOFTCLOCK so its lower than IPL_SHED To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/usermode/dev/clock.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/usermode/dev/clock.c diff -u src/sys/arch/usermode/dev/clock.c:1.24 src/sys/arch/usermode/dev/clock.c:1.25 --- src/sys/arch/usermode/dev/clock.c:1.24 Sat Jan 14 21:24:52 2012 +++ src/sys/arch/usermode/dev/clock.c Sat Jan 14 21:42:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.24 2012/01/14 21:24:52 reinoud Exp $ */ +/* $NetBSD: clock.c,v 1.25 2012/01/14 21:42:51 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -29,7 +29,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.24 2012/01/14 21:24:52 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: clock.c,v 1.25 2012/01/14 21:42:51 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -130,7 +130,7 @@ static void clock_signal(int sig, siginfo_t *info, void *ctx) { curcpu()-ci_idepth++; - spl_intr(IPL_CLOCK, clock_intr, NULL); + spl_intr(IPL_SOFTCLOCK, clock_intr, NULL); curcpu()-ci_idepth--; }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 14 21:24:52 UTC 2012 Modified Files: src/sys/arch/usermode/dev: clock.c Log Message: Cleanup clock.c removing unneeded function To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/dev/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Jan 14 21:42:52 UTC 2012 Modified Files: src/sys/arch/usermode/dev: clock.c Log Message: Revert back to IPL_SOFTCLOCK so its lower than IPL_SHED To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/usermode/dev/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu Jan 12 13:28:54 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Remove old comment about space not being freed; it is now done correctly so remove it to avoid confusion later. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.62 src/sys/arch/usermode/dev/cpu.c:1.63 --- src/sys/arch/usermode/dev/cpu.c:1.62 Fri Jan 6 12:54:59 2012 +++ src/sys/arch/usermode/dev/cpu.c Thu Jan 12 13:28:54 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.62 2012/01/06 12:54:59 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.63 2012/01/12 13:28:54 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.62 2012/01/06 12:54:59 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.63 2012/01/12 13:28:54 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -345,7 +345,6 @@ cpu_lwp_fork(struct lwp *l1, struct lwp panic(getcontext failed); /* set up the ucontext for the userland switch */ - /* XXX BUG TODO when is this stack space freed? */ pcb2-pcb_ucp.uc_stack.ss_sp = pcb2-pcb_stack_userland; pcb2-pcb_ucp.uc_stack.ss_size = stacksize; pcb2-pcb_ucp.uc_flags = _UC_STACK | _UC_CPU;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Thu Jan 12 13:28:54 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Remove old comment about space not being freed; it is now done correctly so remove it to avoid confusion later. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 14:56:35 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: sizeof_t is allways =0 and the check for =0 thus allways is true and amd64 complains about this. This might explain the odd write errors that could sometimes be reported. Those are/were probably a side effect of this. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.27 src/sys/arch/usermode/dev/ld_thunkbus.c:1.28 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.27 Fri Jan 6 20:40:51 2012 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Mon Jan 9 14:56:35 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -149,7 +149,7 @@ ld_thunkbus_complete(void *arg) struct ld_thunkbus_transfer *tt = sc-sc_tt; struct buf *bp = tt-tt_bp; off_t offset = bp-b_rawblkno * ld-sc_secsize; - size_t ret; + int64_t ret; if (!sc-busy) panic(%s: but not busy?\n, __func__);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 20:39:39 UTC 2012 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Don't directly call softint_shedule() when we might be in an SPL level too high. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c diff -u src/sys/arch/usermode/dev/if_veth.c:1.2 src/sys/arch/usermode/dev/if_veth.c:1.3 --- src/sys/arch/usermode/dev/if_veth.c:1.2 Mon Dec 26 14:51:20 2011 +++ src/sys/arch/usermode/dev/if_veth.c Mon Jan 9 20:39:39 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $ */ +/* $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.3 2012/01/09 20:39:39 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -174,7 +174,9 @@ veth_rx(void *priv) { struct veth_softc *sc = priv; - softint_schedule(sc-sc_rx_intr); + curcpu()-ci_idepth++; + spl_intr(IPL_NET, softint_schedule, sc-sc_rx_intr); + curcpu()-ci_idepth--; return 0; }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 21:01:31 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Re-implement aio for ld_thunkbus. It seems to work fine though its not set by default; define LD_USE_AIO or uncomment its setting at the top of the sourcefile to enable it. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.28 src/sys/arch/usermode/dev/ld_thunkbus.c:1.29 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.28 Mon Jan 9 14:56:35 2012 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Mon Jan 9 21:01:31 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.29 2012/01/09 21:01:31 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.28 2012/01/09 14:56:35 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.29 2012/01/09 21:01:31 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -50,12 +50,18 @@ static int ld_thunkbus_ldstart(struct ld static int ld_thunkbus_lddump(struct ld_softc *, void *, int, int); static int ld_thunkbus_ldflush(struct ld_softc *, int); +//#define LD_USE_AIO + +#ifdef LD_USE_AIO +static int ld_aio_sig(void *); +#endif static void ld_thunkbus_complete(void *arg); struct ld_thunkbus_softc; struct ld_thunkbus_transfer { struct ld_thunkbus_softc *tt_sc; + struct aiocb tt_aio; struct buf *tt_bp; }; @@ -64,6 +70,7 @@ struct ld_thunkbus_softc { int sc_fd; void *sc_ih; + void *sc_aio_ih; struct ld_thunkbus_transfer sc_tt; bool busy; @@ -120,11 +127,118 @@ ld_thunkbus_attach(device_t parent, devi sc-sc_ih = softint_establish(SOFTINT_BIO, ld_thunkbus_complete, ld); +#ifdef LD_USE_AIO + sc-sc_aio_ih = sigio_intr_establish(ld_aio_sig, sc); + if (sc-sc_aio_ih == NULL) + panic(couldn't establish aio sig interrupt); +#endif + sc-busy = false; ldattach(ld); } +#ifdef LD_USE_AIO +static int +ld_aio_sig(void *arg) +{ + struct ld_softc *ld = arg; + struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; + + curcpu()-ci_idepth++; + spl_intr(IPL_BIO, softint_schedule, sc-sc_ih); + curcpu()-ci_idepth--; + + return 0; +} + +static int +ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp) +{ + struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; + struct ld_thunkbus_transfer *tt = sc-sc_tt; + off_t offset = bp-b_rawblkno * ld-sc_secsize; + off_t disksize = ld-sc_secsize * ld-sc_secperunit; + int error; + + tt-tt_sc = sc; + tt-tt_bp = bp; + + memset(tt-tt_aio, 0, sizeof(tt-tt_aio)); + tt-tt_aio.aio_fildes = sc-sc_fd; + tt-tt_aio.aio_buf = bp-b_data; + tt-tt_aio.aio_nbytes = bp-b_bcount; + tt-tt_aio.aio_offset = offset; + + tt-tt_aio.aio_sigevent.sigev_notify = SIGEV_SIGNAL; + tt-tt_aio.aio_sigevent.sigev_signo = SIGIO; + tt-tt_aio.aio_sigevent.sigev_value.sival_ptr = tt; +#if 0 + device_printf(sc-sc_ld.sc_dv, %s addr %p, off=%lld, count=%lld\n, + (bp-b_flags B_READ) ? rd : wr, + bp-b_data, + (long long)bp-b_rawblkno, + (long long)bp-b_bcount); +#endif + if (sc-busy) + panic(%s: reentry, __func__); + + if ((offset 0) || (offset + bp-b_bcount disksize)) { + error = EIO; + bp-b_error = error; + bp-b_resid = bp-b_bcount; + } else { + sc-busy = true; + if (bp-b_flags B_READ) + error = thunk_aio_read(tt-tt_aio); + else + error = thunk_aio_write(tt-tt_aio); + } + return error; +} + +static void +ld_thunkbus_complete(void *arg) +{ + struct ld_softc *ld = arg; + struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; + struct ld_thunkbus_transfer *tt = sc-sc_tt; + struct buf *bp = tt-tt_bp; + int error; + + /* + * check if our aio has finished, we could be called for whatever + * reason, for whatever SIGIO since signals can be missed. + */ + if (!sc-busy) + return; + + /* check if it was OUR sigio */ + error = thunk_aio_error(tt-tt_aio); + if (error == EINPROGRESS) + return; + + /* use the result */ + if ((error == 0) + thunk_aio_return(tt-tt_aio) != -1) { + bp-b_resid = 0; + } else { + bp-b_error = error; + bp-b_resid = bp-b_bcount; + } + + thunk_printf_debug(\tfin\n); + if (bp-b_error) + thunk_printf_debug(error!\n); + + sc-busy = false; + lddone(sc-sc_ld, bp); +} + + +#else /* LD_USE_AIO */ + + static int ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp) { @@ -154,13 +268,6 @@ ld_thunkbus_complete(void *arg) if (!sc-busy) panic(%s: but not busy?\n, __func__); - if (offset 0 || - offset + bp-b_bcount ld-sc_secsize * ld-sc_secperunit) { - bp-b_error = EIO; - bp-b_resid = bp-b_bcount; - goto done; - } -
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 14:56:35 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: sizeof_t is allways =0 and the check for =0 thus allways is true and amd64 complains about this. This might explain the odd write errors that could sometimes be reported. Those are/were probably a side effect of this. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 20:39:39 UTC 2012 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: Don't directly call softint_shedule() when we might be in an SPL level too high. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/if_veth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Jan 9 21:01:31 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Re-implement aio for ld_thunkbus. It seems to work fine though its not set by default; define LD_USE_AIO or uncomment its setting at the top of the sourcefile to enable it. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Fri Jan 6 20:40:51 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Enhance debugging printfs to also report the functionname To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.26 src/sys/arch/usermode/dev/ld_thunkbus.c:1.27 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.26 Fri Jan 6 14:11:55 2012 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Fri Jan 6 20:40:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.26 2012/01/06 14:11:55 jmcneill Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.26 2012/01/06 14:11:55 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.27 2012/01/06 20:40:51 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -161,7 +161,8 @@ ld_thunkbus_complete(void *arg) goto done; } - //printf(ld: %s %u @ %lld - %p (flags 0x%08x)\n, bp-b_flags B_READ ? read : write, + //printf(%s: %s %u @ %lld - %p (flags 0x%08x)\n, __func__, + //bp-b_flags B_READ ? read : write, //(unsigned int)bp-b_bcount, (long long)offset, bp-b_data, bp-b_flags); /* read/write the request */ @@ -172,7 +173,7 @@ ld_thunkbus_complete(void *arg) } //if (ret == -1) - // printf(ld: errno = %d\n, thunk_geterrno()); + // printf(%s: errno = %d\n, __func__, thunk_geterrno()); /* setup return params */ if ((ret = 0) (ret == bp-b_bcount)) {
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Fri Jan 6 20:40:51 UTC 2012 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Enhance debugging printfs to also report the functionname To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Jan 4 14:53:58 UTC 2012 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: implement cngetc and cnpollc To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.11 src/sys/arch/usermode/dev/vncfb.c:1.12 --- src/sys/arch/usermode/dev/vncfb.c:1.11 Mon Jan 2 00:20:30 2012 +++ src/sys/arch/usermode/dev/vncfb.c Wed Jan 4 14:53:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.12 2012/01/04 14:53:57 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.12 2012/01/04 14:53:57 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -651,11 +651,29 @@ vncfb_kbd_ioctl(void *priv, u_long cmd, static void vncfb_kbd_cngetc(void *priv, u_int *type, int *data) { + struct vncfb_softc *sc = priv; + thunk_rfb_event_t event; + + for (;;) { + if (thunk_rfb_poll(sc-sc_rfb, event) 0) { + if (event.message_type == THUNK_RFB_KEY_EVENT) { +*type = event.data.key_event.down_flag ? +WSCONS_EVENT_KEY_DOWN : WSCONS_EVENT_KEY_UP; +*data = event.data.key_event.keysym 0xfff; +return; + } + } + } } static void vncfb_kbd_cnpollc(void *priv, int on) { + struct vncfb_softc *sc = priv; + + if (!on) { + vncfb_intr(sc); + } } static void
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 4 15:14:57 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Zero the memory we claim for the stacks To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.59 src/sys/arch/usermode/dev/cpu.c:1.60 --- src/sys/arch/usermode/dev/cpu.c:1.59 Tue Jan 3 12:10:04 2012 +++ src/sys/arch/usermode/dev/cpu.c Wed Jan 4 15:14:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.60 2012/01/04 15:14:57 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.60 2012/01/04 15:14:57 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -333,9 +333,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp memcpy(pcb2, pcb1, sizeof(struct pcb)); stacksize = 2*PAGE_SIZE; - stack_ucp = malloc(stacksize, M_TEMP, M_WAITOK); - stack_syscall_ucp = malloc(stacksize, M_TEMP, M_WAITOK); - stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK); + stack_ucp = malloc(stacksize, M_TEMP, M_WAITOK | M_ZERO); + stack_syscall_ucp = malloc(stacksize, M_TEMP, M_WAITOK | M_ZERO); + stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK | M_ZERO); pcb2-pcb_needfree = true; KASSERT(stack_ucp); @@ -415,7 +415,7 @@ cpu_startup(void) /* set up the ucontext for the pagefault */ stacksize = 8*PAGE_SIZE; - stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK); + stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK | M_ZERO); lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_sp = stack_pagefault_ucp; lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_size = stacksize;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 4 15:18:58 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: No reason why to have a larger pagefault stackframe for lwp0 To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.60 src/sys/arch/usermode/dev/cpu.c:1.61 --- src/sys/arch/usermode/dev/cpu.c:1.60 Wed Jan 4 15:14:57 2012 +++ src/sys/arch/usermode/dev/cpu.c Wed Jan 4 15:18:57 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.60 2012/01/04 15:14:57 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.61 2012/01/04 15:18:57 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.60 2012/01/04 15:14:57 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.61 2012/01/04 15:18:57 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -414,7 +414,7 @@ cpu_startup(void) memcpy(lwp0pcb.pcb_trapret_ucp, lwp0pcb.pcb_ucp, sizeof(ucontext_t)); /* set up the ucontext for the pagefault */ - stacksize = 8*PAGE_SIZE; + stacksize = 2*PAGE_SIZE; stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK | M_ZERO); lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_sp = stack_pagefault_ucp;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Jan 4 14:53:58 UTC 2012 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: implement cngetc and cnpollc To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 4 15:14:57 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Zero the memory we claim for the stacks To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Jan 4 15:18:58 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: No reason why to have a larger pagefault stackframe for lwp0 To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Jan 3 12:10:04 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Use M_WAITOK instead of M_NOWAIT for the stack allocations To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.58 src/sys/arch/usermode/dev/cpu.c:1.59 --- src/sys/arch/usermode/dev/cpu.c:1.58 Tue Jan 3 12:05:01 2012 +++ src/sys/arch/usermode/dev/cpu.c Tue Jan 3 12:10:04 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -333,9 +333,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp memcpy(pcb2, pcb1, sizeof(struct pcb)); stacksize = 2*PAGE_SIZE; - stack_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); - stack_syscall_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); - stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); + stack_ucp = malloc(stacksize, M_TEMP, M_WAITOK); + stack_syscall_ucp = malloc(stacksize, M_TEMP, M_WAITOK); + stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK); pcb2-pcb_needfree = true; KASSERT(stack_ucp); @@ -414,8 +414,8 @@ cpu_startup(void) memcpy(lwp0pcb.pcb_trapret_ucp, lwp0pcb.pcb_ucp, sizeof(ucontext_t)); /* set up the ucontext for the pagefault */ - stacksize = 16*PAGE_SIZE; - stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); + stacksize = 8*PAGE_SIZE; + stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK); lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_sp = stack_pagefault_ucp; lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_size = stacksize;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Jan 3 12:10:04 UTC 2012 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Use M_WAITOK instead of M_NOWAIT for the stack allocations To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Jan 2 00:20:30 UTC 2012 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: fix range check for mmap To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.10 src/sys/arch/usermode/dev/vncfb.c:1.11 --- src/sys/arch/usermode/dev/vncfb.c:1.10 Fri Dec 30 20:08:36 2011 +++ src/sys/arch/usermode/dev/vncfb.c Mon Jan 2 00:20:30 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.10 2011/12/30 20:08:36 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.11 2012/01/02 00:20:30 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -507,7 +507,7 @@ vncfb_mmap(void *v, void *vs, off_t offs paddr_t pa; vaddr_t va; - if (offset 0 || offset + PAGE_SIZE sc-sc_framebufsize) { + if (offset 0 || offset = sc-sc_framebufsize) { device_printf(sc-sc_dev, mmap: offset 0x%x, fbsize 0x%x out of range!\n, (unsigned int)offset, (unsigned int)sc-sc_framebufsize);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Jan 2 00:20:30 UTC 2012 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: fix range check for mmap To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 08:49:53 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: send framebuffer updates for cursor changes too To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.1 src/sys/arch/usermode/dev/vncfb.c:1.2 --- src/sys/arch/usermode/dev/vncfb.c:1.1 Thu Dec 29 21:22:49 2011 +++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 08:49:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -63,6 +63,7 @@ struct vncfb_fbops { void (*copyrows)(void *, int, int, int); void (*eraserows)(void *, int, int, long); void (*putchar)(void *, int, int, u_int, long); + void (*cursor)(void *, int, int, int); }; struct vncfb_softc { @@ -94,6 +95,7 @@ static void vncfb_copycols(void *, int, static void vncfb_erasecols(void *, int, int, int, long); static void vncfb_copyrows(void *, int, int, int); static void vncfb_eraserows(void *, int, int, long); +static void vncfb_cursor(void *, int, int, int); static int vncfb_ioctl(void *, void *, u_long, void *, int, lwp_t *); static paddr_t vncfb_mmap(void *, void *, off_t, int); @@ -269,12 +271,14 @@ vncfb_init_screen(void *priv, struct vco ops-eraserows = ri-ri_ops.eraserows; ops-copycols = ri-ri_ops.copycols; ops-erasecols = ri-ri_ops.erasecols; + ops-cursor = ri-ri_ops.cursor; ri-ri_ops.copyrows = vncfb_copyrows; ri-ri_ops.copycols = vncfb_copycols; ri-ri_ops.eraserows = vncfb_eraserows; ri-ri_ops.erasecols = vncfb_erasecols; ri-ri_ops.putchar = vncfb_putchar; + ri-ri_ops.cursor = vncfb_cursor; } static void @@ -383,6 +387,30 @@ vncfb_eraserows(void *priv, int row, int vncfb_update(sc, x, y, w, h); } +static void +vncfb_cursor(void *priv, int on, int row, int col) +{ + struct rasops_info *ri = priv; + struct vcons_screen *scr = ri-ri_hw; + struct vncfb_softc *sc = scr-scr_cookie; + struct vncfb_fbops *ops = sc-sc_ops; + int ox, oy, x, y, w, h; + + w = ri-ri_font-fontwidth; + h = ri-ri_font-fontheight; + + ox = ri-ri_ccol * w + ri-ri_xorigin; + oy = ri-ri_crow * h + ri-ri_yorigin; + + ops-cursor(ri, on, row, col); + + x = ri-ri_ccol * w + ri-ri_xorigin; + y = ri-ri_crow * h + ri-ri_yorigin; + + vncfb_update(sc, ox, oy, w, h); + vncfb_update(sc, x, y, w, h); +} + static int vncfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l) {
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 09:31:44 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: take nrows into account when calculating the update rectangle in vncfb_copyrows To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.2 src/sys/arch/usermode/dev/vncfb.c:1.3 --- src/sys/arch/usermode/dev/vncfb.c:1.2 Fri Dec 30 08:49:53 2011 +++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 09:31:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.3 2011/12/30 09:31:44 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.2 2011/12/30 08:49:53 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.3 2011/12/30 09:31:44 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -359,10 +359,10 @@ vncfb_copyrows(void *priv, int srcrow, i w = ri-ri_width; if (srcrow dstrow) { y = ri-ri_yorigin + (srcrow * ri-ri_font-fontheight); - h = (dstrow - srcrow) * ri-ri_font-fontheight; + h = (nrows + (dstrow - srcrow)) * ri-ri_font-fontheight; } else { y = ri-ri_yorigin + (dstrow * ri-ri_font-fontheight); - h = (srcrow - dstrow) * ri-ri_font-fontheight; + h = (nrows + (srcrow - dstrow)) * ri-ri_font-fontheight; } vncfb_update(sc, x, y, w, h);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 12:14:44 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vnckbdmap.c Log Message: map Fn keys, make vt switching work To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vnckbdmap.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/usermode/dev/vnckbdmap.c diff -u src/sys/arch/usermode/dev/vnckbdmap.c:1.1 src/sys/arch/usermode/dev/vnckbdmap.c:1.2 --- src/sys/arch/usermode/dev/vnckbdmap.c:1.1 Thu Dec 29 21:22:49 2011 +++ src/sys/arch/usermode/dev/vnckbdmap.c Fri Dec 30 12:14:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vnckbdmap.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $ */ +/* $NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $ */ /* * Copyright (c) 1999,2001,2011 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vnckbdmap.c,v 1.1 2011/12/29 21:22:49 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vnckbdmap.c,v 1.2 2011/12/30 12:14:44 jmcneill Exp $); #include sys/types.h #include dev/wscons/wsksymdef.h @@ -51,7 +51,7 @@ static const keysym_t vnckbd_keydesc_us[ KC(0xf13), KS_Pause, KC(0xf14), KS_Hold_Screen, // KC(0xf15), KS_SysReq, -KC(0xf1b), KS_Escape, +KC(0xf1b), KS_Cmd_Debugger, KS_Escape, KC(0xfff), KS_Delete, /* X11 cursor control motion */ @@ -60,8 +60,8 @@ static const keysym_t vnckbd_keydesc_us[ KC(0xf52), KS_Up, KC(0xf53), KS_Right, KC(0xf54), KS_Down, -KC(0xf55), KS_Prior, -KC(0xf56), KS_Next, +KC(0xf55), KS_Cmd_ScrollFastUp, KS_Prior, +KC(0xf56), KS_Cmd_ScrollFastDown, KS_Next, KC(0xf57), KS_End, // KC(0xf58), KS_Begin, @@ -84,16 +84,36 @@ static const keysym_t vnckbd_keydesc_us[ /* ... */ /* X11 auxiliary functions */ -/* ... */ +KC(0xfbe), KS_Cmd_Screen0, KS_F1, +KC(0xfbf), KS_Cmd_Screen1, KS_F2, +KC(0xfc0), KS_Cmd_Screen2, KS_F3, +KC(0xfc1), KS_Cmd_Screen3, KS_F4, +KC(0xfc2), KS_Cmd_Screen4, KS_F5, +KC(0xfc3), KS_Cmd_Screen5, KS_F6, +KC(0xfc4), KS_Cmd_Screen6, KS_F7, +KC(0xfc5), KS_Cmd_Screen7, KS_F8, +KC(0xfc6), KS_Cmd_Screen8, KS_F9, +KC(0xfc7), KS_Cmd_Screen9, KS_F10, +KC(0xfc8), KS_F11, +KC(0xfc9), KS_F12, +KC(0xfca), KS_F13, +KC(0xfcb), KS_F14, +KC(0xfcc), KS_F15, +KC(0xfcd), KS_F16, +KC(0xfce), KS_F17, +KC(0xfcf), KS_F18, +KC(0xfd0), KS_F19, +KC(0xfd1), KS_F20, +/* ... F21 - F35 */ /* X11 modifiers */ KC(0xfe1), KS_Shift_L, KC(0xfe2), KS_Shift_R, -KC(0xfe3), KS_Control_L, +KC(0xfe3), KS_Cmd1, KS_Control_L, KC(0xfe4), KS_Control_R, KC(0xfe5), KS_Caps_Lock, KC(0xfe6), KS_Shift_Lock, -KC(0xfe7), KS_Meta_L, +KC(0xfe7), KS_Cmd2, KS_Meta_L, KC(0xfe8), KS_Meta_R, KC(0xfe9), KS_Alt_L, KC(0xfea), KS_Alt_R,
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 14:22:41 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: no need to poll for pending drawing ops if no client is connected To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.7 src/sys/arch/usermode/dev/vncfb.c:1.8 --- src/sys/arch/usermode/dev/vncfb.c:1.7 Fri Dec 30 14:20:33 2011 +++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 14:22:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.7 2011/12/30 14:20:33 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -357,7 +357,8 @@ vncfb_copyrows(void *priv, int srcrow, i /* barrier */ while (sc-sc_rfb.nupdates 0) - thunk_rfb_poll(sc-sc_rfb, NULL); + if (thunk_rfb_poll(sc-sc_rfb, NULL) == -1) + break; ops-copyrows(ri, srcrow, dstrow, nrows);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 19:32:32 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: add mmap support To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/vncfb.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/usermode/dev/vncfb.c diff -u src/sys/arch/usermode/dev/vncfb.c:1.8 src/sys/arch/usermode/dev/vncfb.c:1.9 --- src/sys/arch/usermode/dev/vncfb.c:1.8 Fri Dec 30 14:22:41 2011 +++ src/sys/arch/usermode/dev/vncfb.c Fri Dec 30 19:32:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $ */ +/* $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -35,7 +35,7 @@ #include opt_wsemul.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.8 2011/12/30 14:22:41 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1.9 2011/12/30 19:32:32 jmcneill Exp $); #include sys/param.h #include sys/systm.h @@ -43,6 +43,8 @@ __KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1. #include sys/device.h #include sys/kmem.h +#include uvm/uvm_extern.h + #include dev/wscons/wsconsio.h #include dev/wscons/wsdisplayvar.h @@ -57,6 +59,8 @@ __KERNEL_RCSID(0, $NetBSD: vncfb.c,v 1. #include machine/mainbus.h #include machine/thunk.h +#define VNCFB_REFRESH_INTERVAL 33 /* fb refresh interval when mapped */ + struct vncfb_fbops { void (*copycols)(void *, int, int, int, int); void (*erasecols)(void *, int, int, int, long); @@ -74,7 +78,10 @@ struct vncfb_softc { unsigned int sc_height; unsigned int sc_depth; int sc_mode; + uint8_t * sc_mem; + size_t sc_memsize; uint8_t * sc_framebuf; + size_t sc_framebufsize; struct vcons_data sc_vd; struct vncfb_fbops sc_ops; @@ -82,6 +89,9 @@ struct vncfb_softc { void *sc_ih; void *sc_sih; + + callout_t sc_callout; + void *sc_refresh_sih; }; static int vncfb_match(device_t, cfdata_t, void *); @@ -107,6 +117,8 @@ static void vncfb_copyrect(struct vncfb_ static void vncfb_fillrect(struct vncfb_softc *, int, int, int, int, uint32_t); static int vncfb_intr(void *); static void vncfb_softintr(void *); +static void vncfb_refresh(void *); +static void vncfb_softrefresh(void *); static int vncfb_kbd_enable(void *, int); static void vncfb_kbd_set_leds(void *, int); @@ -187,13 +199,17 @@ vncfb_attach(device_t parent, device_t s panic(couldn't open VNC socket); #endif - sc-sc_framebuf = kmem_zalloc(sc-sc_width * sc-sc_height * - (sc-sc_depth / 8), KM_SLEEP); - KASSERT(sc-sc_framebuf != NULL); + sc-sc_framebufsize = sc-sc_width * sc-sc_height * (sc-sc_depth / 8); + sc-sc_memsize = sc-sc_framebufsize + PAGE_SIZE; + + sc-sc_mem = kmem_zalloc(sc-sc_memsize, KM_SLEEP); + sc-sc_framebuf = (void *)round_page((vaddr_t)sc-sc_mem); aprint_naive(\n); aprint_normal(: %ux%u %ubpp (port %u)\n, sc-sc_width, sc-sc_height, sc-sc_depth, taa-u.vnc.port); + aprint_normal_dev(self, mem @ %p\n, sc-sc_mem); + aprint_normal_dev(self, fb @ %p\n, sc-sc_framebuf); sc-sc_rfb.width = sc-sc_width; sc-sc_rfb.height = sc-sc_height; @@ -210,6 +226,12 @@ vncfb_attach(device_t parent, device_t s sc-sc_sih = softint_establish(SOFTINT_SERIAL, vncfb_softintr, sc); sc-sc_ih = sigio_intr_establish(vncfb_intr, sc); + sc-sc_refresh_sih = softint_establish(SOFTINT_SERIAL, + vncfb_softrefresh, sc); + + callout_init(sc-sc_callout, 0); + callout_setfunc(sc-sc_callout, vncfb_refresh, sc); + vcons_init(sc-sc_vd, sc, vncfb_defaultscreen, vncfb_accessops); sc-sc_vd.init_screen = vncfb_init_screen; @@ -438,12 +460,19 @@ vncfb_ioctl(void *v, void *vs, u_long cm wdf-depth = ms-scr_ri.ri_depth; wdf-cmsize = 256; return 0; + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = sc-sc_width * (sc-sc_depth / 8); + return 0; case WSDISPLAYIO_SMODE: new_mode = *(int *)data; if (sc-sc_mode != new_mode) { sc-sc_mode = new_mode; - if (new_mode == WSDISPLAYIO_MODE_EMUL) + if (new_mode == WSDISPLAYIO_MODE_EMUL) { +callout_halt(sc-sc_callout, NULL); vcons_redraw_screen(ms); + } else { +callout_schedule(sc-sc_callout, 1); + } } return 0; default: @@ -454,8 +483,26 @@ vncfb_ioctl(void *v, void *vs, u_long cm static paddr_t vncfb_mmap(void *v, void *vs, off_t offset, int prot) { - /* TODO */ - return -1; + struct vcons_data *vd = v; + struct vncfb_softc *sc = vd-cookie; + paddr_t pa; + vaddr_t va; + + if (offset 0 || offset + PAGE_SIZE sc-sc_framebufsize) { + device_printf(sc-sc_dev, mmap: offset 0x%x, fbsize 0x%x + out of range!\n, + (unsigned int)offset, (unsigned int)sc-sc_framebufsize); + return -1; + } + + va = trunc_page((vaddr_t)sc-sc_framebuf + offset); + + if (pmap_extract(pmap_kernel(), va, pa) == false) { + device_printf(sc-sc_dev, mmap: pmap_extract failed!\n); + return -1;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 08:49:53 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: send framebuffer updates for cursor changes too To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 09:31:44 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: take nrows into account when calculating the update rectangle in vncfb_copyrows To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 12:14:44 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vnckbdmap.c Log Message: map Fn keys, make vt switching work To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vnckbdmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 14:22:41 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: no need to poll for pending drawing ops if no client is connected To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Fri Dec 30 19:32:32 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vncfb.c Log Message: add mmap support To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/vncfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 27 20:59:45 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: support ^Z To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.16 src/sys/arch/usermode/dev/ttycons.c:1.17 --- src/sys/arch/usermode/dev/ttycons.c:1.16 Mon Dec 26 12:29:38 2011 +++ src/sys/arch/usermode/dev/ttycons.c Tue Dec 27 20:59:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.16 2011/12/26 12:29:38 jmcneill Exp $ */ +/* $NetBSD: ttycons.c,v 1.17 2011/12/27 20:59:45 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.16 2011/12/26 12:29:38 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.17 2011/12/27 20:59:45 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -53,6 +53,7 @@ struct ttycons_softc { struct tty *sc_tty; void *sc_rd_sih; void *sc_ctrlc_sih; + void *sc_ctrlz_sih; u_char sc_buf[1024]; }; @@ -104,6 +105,8 @@ static void ttycons_softintr(void *); static void ttycons_ctrlc(int); static void ttycons_softctrlc(void *); +static void ttycons_ctrlz(int); +static void ttycons_softctrlz(void *); static int ttycons_match(device_t parent, cfdata_t match, void *opaque) @@ -145,9 +148,14 @@ ttycons_attach(device_t parent, device_t ttycons_softctrlc, sc); if (sc-sc_ctrlc_sih == NULL) panic(couldn't establish ttycons ctrlc handler\n); + sc-sc_ctrlz_sih = softint_establish(SOFTINT_SERIAL, + ttycons_softctrlz, sc); + if (sc-sc_ctrlz_sih == NULL) + panic(couldn't establish ttycons ctrlz handler\n); sigio_intr_establish(ttycons_intr, sc); thunk_signal(SIGINT, ttycons_ctrlc); + thunk_signal(SIGTSTP, ttycons_ctrlz); if (thunk_set_stdin_sigio(true) != 0) panic(couldn't enable stdin async mode); } @@ -399,3 +407,28 @@ ttycons_softctrlc(void *priv) cn_check_magic(t-t_dev, ch, ttycons_cnm_state); t-t_linesw-l_rint(ch, t); } + +static void +ttycons_ctrlz(int sig) +{ + struct ttycons_softc *sc; + + curcpu()-ci_idepth++; + sc = device_lookup_private(ttycons_cd, minor(cn_tab-cn_dev)); + if (sc) { + spl_intr(IPL_SERIAL, softint_schedule, sc-sc_ctrlz_sih); + } + curcpu()-ci_idepth--; + +} + +static void +ttycons_softctrlz(void *priv) +{ + struct ttycons_softc *sc = priv; + struct tty *t = sc-sc_tty; + unsigned char ch = 26; /* SUB */ + + cn_check_magic(t-t_dev, ch, ttycons_cnm_state); + t-t_linesw-l_rint(ch, t); +}
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 27 20:59:45 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: support ^Z To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/usermode/dev/ttycons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 14:51:20 UTC 2011 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: veth_start: copy data from mbuf into a buffer and pass that to thunk_write(), now this driver works as expected To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c diff -u src/sys/arch/usermode/dev/if_veth.c:1.1 src/sys/arch/usermode/dev/if_veth.c:1.2 --- src/sys/arch/usermode/dev/if_veth.c:1.1 Mon Dec 26 12:39:19 2011 +++ src/sys/arch/usermode/dev/if_veth.c Mon Dec 26 14:51:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_veth.c,v 1.1 2011/12/26 12:39:19 jmcneill Exp $ */ +/* $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.1 2011/12/26 12:39:19 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: if_veth.c,v 1.2 2011/12/26 14:51:20 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -75,6 +75,7 @@ struct veth_softc { int sc_tapfd; uint8_t sc_eaddr[ETHER_ADDR_LEN]; uint8_t sc_rx_buf[4096 + 65536]; + uint8_t sc_tx_buf[4096 + 65536]; void *sc_rx_ih; void *sc_rx_intr; void *sc_tx_intr; @@ -269,8 +270,10 @@ veth_start(struct ifnet *ifp) IFQ_DEQUEUE(ifp-if_snd, m0); bpf_mtap(ifp, m0); + m_copydata(m0, 0, m0-m_pkthdr.len, sc-sc_tx_buf); + vethprintf(write %d bytes...\n, m0-m_pkthdr.len); - len = thunk_write(sc-sc_tapfd, mtod(m0, void *), + len = thunk_write(sc-sc_tapfd, sc-sc_tx_buf, m0-m_pkthdr.len); vethprintf(write returned %d\n, len); if (len 0)
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 21:09:22 UTC 2011 Added Files: src/sys/arch/usermode/dev: vaudio.c Log Message: add vaudio(4) audio device driver To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/dev/vaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/usermode/dev/vaudio.c diff -u /dev/null src/sys/arch/usermode/dev/vaudio.c:1.1 --- /dev/null Mon Dec 26 21:09:22 2011 +++ src/sys/arch/usermode/dev/vaudio.c Mon Dec 26 21:09:22 2011 @@ -0,0 +1,423 @@ +/* $NetBSD: vaudio.c,v 1.1 2011/12/26 21:09:22 jmcneill Exp $ */ + +/*- + * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.1 2011/12/26 21:09:22 jmcneill Exp $); + +#include sys/param.h +#include sys/proc.h +#include sys/systm.h +#include sys/device.h +#include sys/audioio.h + +#include machine/mainbus.h +#include machine/thunk.h + +#include dev/audio_if.h +#include dev/auconv.h + +static const struct audio_format vaudio_audio_formats[1] = { + { NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, + 2, AUFMT_STEREO, 0, { 8000, 48000 } }, +}; + +struct vaudio_stream { + struct vaudio_softc *st_softc; + void *st_sih; + callout_t st_callout; + void(*st_intr)(void *); + void *st_intrarg; + uint8_t * st_start; + uint8_t * st_end; + uint8_t * st_cur; + intst_blksize; + boolst_running; +}; + +struct vaudio_softc { + device_t sc_dev; + void *sc_audiodev; + const char * sc_audiopath; + intsc_audiofd; + struct audio_encoding_set * sc_encodings; + audio_params_t sc_pparam; + audio_params_t sc_rparam; + kmutex_t sc_lock; + kmutex_t sc_intr_lock; + + struct vaudio_stream sc_play; + struct vaudio_stream sc_record; +}; + +static int vaudio_match(device_t, cfdata_t, void *); +static void vaudio_attach(device_t, device_t, void *); + +static void vaudio_intr(void *); +static void vaudio_softintr_play(void *); +static void vaudio_softintr_record(void *); + +static int vaudio_open(void *, int); +static void vaudio_close(void *); +static int vaudio_drain(void *); +static int vaudio_query_encoding(void *, audio_encoding_t *); +static int vaudio_set_params(void *, int, int, audio_params_t *, + audio_params_t *, stream_filter_list_t *, + stream_filter_list_t *); +static int vaudio_commit_settings(void *); +static int vaudio_trigger_output(void *, void *, void *, int, + void (*)(void *), void *, + const audio_params_t *); +static int vaudio_trigger_input(void *, void *, void *, int, + void (*)(void *), void *, + const audio_params_t *); +static int vaudio_halt_output(void *); +static int vaudio_halt_input(void *); +static int vaudio_getdev(void *, struct audio_device *); +static int vaudio_set_port(void *, mixer_ctrl_t *); +static int vaudio_get_port(void *, mixer_ctrl_t *); +static int vaudio_query_devinfo(void *, mixer_devinfo_t *); +static int vaudio_get_props(void *); +static void vaudio_get_locks(void *, kmutex_t **, kmutex_t **); + +CFATTACH_DECL_NEW(vaudio, sizeof(struct vaudio_softc), +vaudio_match, vaudio_attach, NULL, NULL); + +static const struct audio_hw_if vaudio_hw_if = { + .open = vaudio_open, + .close = vaudio_close, + .drain = vaudio_drain, + .query_encoding = vaudio_query_encoding, + .set_params = vaudio_set_params, + .commit_settings = vaudio_commit_settings, + .halt_output = vaudio_halt_output, + .halt_input = vaudio_halt_input, + .getdev = vaudio_getdev, +
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 23:50:43 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vaudio.c Log Message: mark vaudio callout and softint handler as mpsafe To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vaudio.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/usermode/dev/vaudio.c diff -u src/sys/arch/usermode/dev/vaudio.c:1.1 src/sys/arch/usermode/dev/vaudio.c:1.2 --- src/sys/arch/usermode/dev/vaudio.c:1.1 Mon Dec 26 21:09:22 2011 +++ src/sys/arch/usermode/dev/vaudio.c Mon Dec 26 23:50:43 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vaudio.c,v 1.1 2011/12/26 21:09:22 jmcneill Exp $ */ +/* $NetBSD: vaudio.c,v 1.2 2011/12/26 23:50:43 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.1 2011/12/26 21:09:22 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: vaudio.c,v 1.2 2011/12/26 23:50:43 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -167,15 +167,15 @@ vaudio_attach(device_t parent, device_t } sc-sc_play.st_softc = sc; - sc-sc_play.st_sih = softint_establish(SOFTINT_SERIAL, + sc-sc_play.st_sih = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, vaudio_softintr_play, sc-sc_play); - callout_init(sc-sc_play.st_callout, 0); + callout_init(sc-sc_play.st_callout, CALLOUT_MPSAFE); callout_setfunc(sc-sc_play.st_callout, vaudio_intr, sc-sc_play); sc-sc_record.st_softc = sc; - sc-sc_record.st_sih = softint_establish(SOFTINT_SERIAL, + sc-sc_record.st_sih = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, vaudio_softintr_record, sc-sc_record); - callout_init(sc-sc_record.st_callout, 0); + callout_init(sc-sc_record.st_callout, CALLOUT_MPSAFE); callout_setfunc(sc-sc_record.st_callout, vaudio_intr, sc-sc_record); sc-sc_audiodev = audio_attach_mi(vaudio_hw_if, sc, self);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 14:51:20 UTC 2011 Modified Files: src/sys/arch/usermode/dev: if_veth.c Log Message: veth_start: copy data from mbuf into a buffer and pass that to thunk_write(), now this driver works as expected To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/if_veth.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 21:09:22 UTC 2011 Added Files: src/sys/arch/usermode/dev: vaudio.c Log Message: add vaudio(4) audio device driver To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/dev/vaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 26 23:50:43 UTC 2011 Modified Files: src/sys/arch/usermode/dev: vaudio.c Log Message: mark vaudio callout and softint handler as mpsafe To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/dev/vaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Dec 24 12:23:25 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Implement cpu_getmcontext() and cpu_setmcontext() To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.55 src/sys/arch/usermode/dev/cpu.c:1.56 --- src/sys/arch/usermode/dev/cpu.c:1.55 Thu Dec 15 03:42:32 2011 +++ src/sys/arch/usermode/dev/cpu.c Sat Dec 24 12:23:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.55 2011/12/15 03:42:32 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.56 2011/12/24 12:23:24 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.55 2011/12/15 03:42:32 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.56 2011/12/24 12:23:24 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -224,19 +224,26 @@ cpu_signotify(struct lwp *l) void cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) { - panic(cpu_getmcontext); + struct pcb *pcb = lwp_getpcb(l); + ucontext_t *ucp = pcb-pcb_userret_ucp; + #ifdef CPU_DEBUG dprintf_debug(cpu_getmcontext\n); #endif + memcpy(mcp, ucp-uc_mcontext, sizeof(mcontext_t)); + return; } int cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) { - panic(cpu_setmcontext); + struct pcb *pcb = lwp_getpcb(l); + ucontext_t *ucp = pcb-pcb_userret_ucp; + #ifdef CPU_DEBUG dprintf_debug(cpu_setmcontext\n); #endif + memcpy(ucp-uc_mcontext, mcp, sizeof(mcontext_t)); return 0; }
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Sat Dec 24 12:23:25 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Implement cpu_getmcontext() and cpu_setmcontext() To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Dec 21 10:02:45 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: Increase printing buffer of ttycons from 80 to 1024 significantly increasing console output on large dumps. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.13 src/sys/arch/usermode/dev/ttycons.c:1.14 --- src/sys/arch/usermode/dev/ttycons.c:1.13 Tue Dec 20 21:35:16 2011 +++ src/sys/arch/usermode/dev/ttycons.c Wed Dec 21 10:02:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $ */ +/* $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -301,7 +301,7 @@ ttycons_ioctl(dev_t dev, u_long cmd, voi static void ttycons_start(struct tty *t) { - u_char buf[80+1]; + u_char buf[1024+1]; u_char *p = buf; int s, len, brem;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Dec 21 11:53:07 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: move the (now 1024 byte) printing buffer off the stack To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.14 src/sys/arch/usermode/dev/ttycons.c:1.15 --- src/sys/arch/usermode/dev/ttycons.c:1.14 Wed Dec 21 10:02:45 2011 +++ src/sys/arch/usermode/dev/ttycons.c Wed Dec 21 11:53:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $ */ +/* $NetBSD: ttycons.c,v 1.15 2011/12/21 11:53:07 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.15 2011/12/21 11:53:07 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -53,6 +53,7 @@ struct ttycons_softc { struct tty *sc_tty; void *sc_rd_sih; void *sc_ctrlc_sih; + u_char sc_buf[1024]; }; dev_type_cngetc(ttycons_cngetc); @@ -129,6 +130,7 @@ ttycons_attach(device_t parent, device_t tty_attach(sc-sc_tty); sc-sc_tty-t_oproc = ttycons_start; sc-sc_tty-t_param = ttycons_param; + sc-sc_tty-t_sc = sc; maj = cdevsw_lookup_major(ttycons_cdevsw); cn_tab-cn_dev = makedev(maj, device_unit(self)); @@ -301,8 +303,8 @@ ttycons_ioctl(dev_t dev, u_long cmd, voi static void ttycons_start(struct tty *t) { - u_char buf[1024+1]; - u_char *p = buf; + struct ttycons_softc *sc = t-t_sc; + u_char *p = sc-sc_buf; int s, len, brem; s = spltty(); @@ -313,7 +315,7 @@ ttycons_start(struct tty *t) t-t_state |= TS_BUSY; splx(s); - brem = q_to_b(t-t_outq, buf, sizeof(buf) - 1); + brem = q_to_b(t-t_outq, sc-sc_buf, sizeof(sc-sc_buf)); while (brem 0) { len = thunk_write(1, p, brem);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Wed Dec 21 10:02:45 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: Increase printing buffer of ttycons from 80 to 1024 significantly increasing console output on large dumps. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/ttycons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Dec 21 11:53:07 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: move the (now 1024 byte) printing buffer off the stack To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/dev/ttycons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 20 21:35:16 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: check return value of write, make sure we send the whole buffer to stdout To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.12 src/sys/arch/usermode/dev/ttycons.c:1.13 --- src/sys/arch/usermode/dev/ttycons.c:1.12 Thu Dec 15 01:04:15 2011 +++ src/sys/arch/usermode/dev/ttycons.c Tue Dec 20 21:35:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.12 2011/12/15 01:04:15 jmcneill Exp $ */ +/* $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.12 2011/12/15 01:04:15 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -302,7 +302,8 @@ static void ttycons_start(struct tty *t) { u_char buf[80+1]; - int s, len; //, i; + u_char *p = buf; + int s, len, brem; s = spltty(); if (t-t_state (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) { @@ -312,8 +313,15 @@ ttycons_start(struct tty *t) t-t_state |= TS_BUSY; splx(s); - len = q_to_b(t-t_outq, buf, sizeof(buf) - 1); - thunk_write(1, buf, len); + brem = q_to_b(t-t_outq, buf, sizeof(buf) - 1); + + while (brem 0) { + len = thunk_write(1, p, brem); + if (len 0) { + p += len; + brem -= len; + } + } s = spltty(); t-t_state = ~TS_BUSY;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 20 21:35:16 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: check return value of write, make sure we send the whole buffer to stdout To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/dev/ttycons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Dec 14 21:22:24 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: set ld maxxfer to MAXPHYS To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.23 src/sys/arch/usermode/dev/ld_thunkbus.c:1.24 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.23 Tue Dec 13 15:53:47 2011 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Wed Dec 14 21:22:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -108,7 +108,7 @@ ld_thunkbus_attach(device_t parent, devi aprint_normal(: %s (%lld)\n, path, (long long)size); ld-sc_flags = LDF_ENABLED; - ld-sc_maxxfer = blksize; + ld-sc_maxxfer = MAXPHYS; ld-sc_secsize = 512; ld-sc_secperunit = size / ld-sc_secsize; ld-sc_maxqueuecnt = 1;
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Thu Dec 15 02:09:15 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: allocate msgbuf with kmem_zalloc instead of thunk_malloc, now dmesg works To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.53 src/sys/arch/usermode/dev/cpu.c:1.54 --- src/sys/arch/usermode/dev/cpu.c:1.53 Thu Dec 15 00:40:03 2011 +++ src/sys/arch/usermode/dev/cpu.c Thu Dec 15 02:09:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.53 2011/12/15 00:40:03 jmcneill Exp $ */ +/* $NetBSD: cpu.c,v 1.54 2011/12/15 02:09:15 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.53 2011/12/15 00:40:03 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.54 2011/12/15 02:09:15 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.53 #include sys/cpu.h #include sys/mbuf.h #include sys/msgbuf.h +#include sys/kmem.h #include dev/cons.h @@ -78,7 +79,7 @@ typedef struct cpu_softc { } cpu_softc_t; static struct pcb lwp0pcb; -static void *msgbuf; +static void *um_msgbuf; CFATTACH_DECL_NEW(cpu, sizeof(cpu_softc_t), cpu_match, cpu_attach, NULL, NULL); @@ -374,13 +375,13 @@ cpu_initclocks(void) void cpu_startup(void) { - size_t stacksize; + size_t stacksize, msgbufsize = 32 * 1024; void *stack_pagefault_ucp; - msgbuf = thunk_malloc(PAGE_SIZE); - if (msgbuf == NULL) + um_msgbuf = kmem_zalloc(msgbufsize, KM_SLEEP); + if (um_msgbuf == NULL) panic(couldn't allocate msgbuf); - initmsgbuf(msgbuf, PAGE_SIZE); + initmsgbuf(um_msgbuf, msgbufsize); banner();
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Wed Dec 14 21:22:24 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: set ld maxxfer to MAXPHYS To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Thu Dec 15 02:09:15 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: allocate msgbuf with kmem_zalloc instead of thunk_malloc, now dmesg works To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 12:25:42 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Just in case ease up the stack space a bit more To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.49 src/sys/arch/usermode/dev/cpu.c:1.50 --- src/sys/arch/usermode/dev/cpu.c:1.49 Mon Dec 12 12:20:30 2011 +++ src/sys/arch/usermode/dev/cpu.c Tue Dec 13 12:25:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.49 2011/12/12 12:20:30 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.50 2011/12/13 12:25:42 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.49 2011/12/12 12:20:30 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.50 2011/12/13 12:25:42 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -326,7 +326,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp /* copy the PCB and its switchframes from parent */ memcpy(pcb2, pcb1, sizeof(struct pcb)); - stacksize = PAGE_SIZE; + stacksize = 2*PAGE_SIZE; stack_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); stack_syscall_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 13 13:32:16 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: - gc old aio implementation - set busy before scheduling softint not after - try not to write past end of backing file - if B_PHYS flag is set, pread/write with bounce buffer and copyout/copyin - use the correct offset in ld_thunkbus_dump To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.20 src/sys/arch/usermode/dev/ld_thunkbus.c:1.21 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.20 Fri Dec 9 17:21:45 2011 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Tue Dec 13 13:32:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.20 2011/12/09 17:21:45 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.21 2011/12/13 13:32:15 jmcneill Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.20 2011/12/09 17:21:45 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.21 2011/12/13 13:32:15 jmcneill Exp $); #include sys/param.h #include sys/proc.h @@ -50,18 +50,12 @@ static int ld_thunkbus_ldstart(struct ld static int ld_thunkbus_lddump(struct ld_softc *, void *, int, int); static int ld_thunkbus_ldflush(struct ld_softc *, int); -//#define LD_USE_AIO - -#ifdef LD_USE_AIO -static void ld_thunkbus_sig(int, siginfo_t *, void *); -#endif static void ld_thunkbus_complete(void *arg); struct ld_thunkbus_softc; struct ld_thunkbus_transfer { struct ld_thunkbus_softc *tt_sc; - struct aiocb tt_aio; struct buf *tt_bp; }; @@ -71,6 +65,8 @@ struct ld_thunkbus_softc { int sc_fd; void *sc_ih; + uint8_t sc_bbuf[MAXBSIZE]; + struct ld_thunkbus_transfer sc_tt; bool busy; }; @@ -95,9 +91,6 @@ ld_thunkbus_attach(device_t parent, devi struct ld_thunkbus_softc *sc = device_private(self); struct ld_softc *ld = sc-sc_ld; struct thunkbus_attach_args *taa = opaque; -#ifdef LD_USE_AIO - struct sigaction sa; -#endif const char *path = taa-u.diskimage.path; ssize_t size, blksize; @@ -126,46 +119,13 @@ ld_thunkbus_attach(device_t parent, devi ld-sc_flush = ld_thunkbus_ldflush; sc-sc_ih = softint_establish(SOFTINT_BIO, - ld_thunkbus_complete, sc); - -#ifdef LD_USE_AIO - sa.sa_flags = SA_RESTART | SA_SIGINFO; - sa.sa_sigaction = ld_thunkbus_sig; - thunk_sigemptyset(sa.sa_mask); -// thunk_sigaddset(sa.sa_mask, SIGALRM); - if (thunk_sigaction(SIGIO, sa, NULL) == -1) - panic(couldn't register SIGIO handler: %d, thunk_geterrno()); -#endif + ld_thunkbus_complete, ld); sc-busy = false; ldattach(ld); } -#ifdef LD_USE_AIO -static void -ld_thunkbus_sig(int sig, siginfo_t *info, void *ctx) -{ - struct ld_thunkbus_transfer *tt = NULL; - struct ld_thunkbus_softc *sc; - - curcpu()-ci_idepth++; - - if (info-si_signo == SIGIO) { - if (info-si_code == SI_ASYNCIO) - tt = info-si_value.sival_ptr; - if (tt) { - sc = tt-tt_sc; - spl_intr(IPL_BIO, softint_schedule, sc-sc_ih); - // spl_intr(IPL_BIO, ld_thunkbus_complete, sc); - // softint_schedule(sc-sc_ih); - } - } - - curcpu()-ci_idepth--; -} -#endif - static int ld_thunkbus_ldstart(struct ld_softc *ld, struct buf *bp) { @@ -175,67 +135,63 @@ ld_thunkbus_ldstart(struct ld_softc *ld, tt-tt_sc = sc; tt-tt_bp = bp; - memset(tt-tt_aio, 0, sizeof(tt-tt_aio)); - tt-tt_aio.aio_fildes = sc-sc_fd; - tt-tt_aio.aio_buf = bp-b_data; - tt-tt_aio.aio_nbytes = bp-b_bcount; - tt-tt_aio.aio_offset = bp-b_rawblkno * ld-sc_secsize; - - tt-tt_aio.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - tt-tt_aio.aio_sigevent.sigev_signo = SIGIO; - tt-tt_aio.aio_sigevent.sigev_value.sival_ptr = tt; -#ifdef LD_USE_AIO -#if 0 - device_printf(sc-sc_ld.sc_dv, %s addr %p, off=%lld, count=%lld\n, - (bp-b_flags B_READ) ? rd : wr, - bp-b_data, - (long long)bp-b_rawblkno, - (long long)bp-b_bcount); -#endif - if (sc-busy) - panic(%s: reentry, __func__); - sc-busy = true; - if (bp-b_flags B_READ) - error = thunk_aio_read(tt-tt_aio); - else - error = thunk_aio_write(tt-tt_aio); -#else /* let the softint do the work */ - spl_intr(IPL_BIO, softint_schedule, sc-sc_ih); sc-busy = true; + spl_intr(IPL_BIO, softint_schedule, sc-sc_ih); error = 0; -#endif + return error == -1 ? thunk_geterrno() : 0; } static void ld_thunkbus_complete(void *arg) { - struct ld_thunkbus_softc *sc = arg; + struct ld_softc *ld = arg; + struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; struct ld_thunkbus_transfer *tt = sc-sc_tt; struct buf *bp = tt-tt_bp; + off_t offset = bp-b_rawblkno * ld-sc_secsize; + void *bbuf = sc-sc_bbuf; + size_t ret; if (!sc-busy) panic(%s: but not
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 15:50:17 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: No need for the bounce-buffer anymore since pmap bahaves like it ought to To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.21 src/sys/arch/usermode/dev/ld_thunkbus.c:1.22 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.21 Tue Dec 13 13:32:15 2011 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Tue Dec 13 15:50:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.21 2011/12/13 13:32:15 jmcneill Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.21 2011/12/13 13:32:15 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -65,8 +65,6 @@ struct ld_thunkbus_softc { int sc_fd; void *sc_ih; - uint8_t sc_bbuf[MAXBSIZE]; - struct ld_thunkbus_transfer sc_tt; bool busy; }; @@ -152,7 +150,6 @@ ld_thunkbus_complete(void *arg) struct ld_thunkbus_transfer *tt = sc-sc_tt; struct buf *bp = tt-tt_bp; off_t offset = bp-b_rawblkno * ld-sc_secsize; - void *bbuf = sc-sc_bbuf; size_t ret; if (!sc-busy) @@ -170,24 +167,9 @@ ld_thunkbus_complete(void *arg) /* read/write the request */ if (bp-b_flags B_READ) { - if (bp-b_flags B_PHYS) { - /* read to bounce buffer and copy out */ - ret = thunk_pread(sc-sc_fd, bbuf, bp-b_bcount, offset); - if (ret 0) -copyout(bbuf, bp-b_data, ret); - } else { - /* just read it */ - ret = thunk_pread(sc-sc_fd, bp-b_data, bp-b_bcount, offset); - } + ret = thunk_pread(sc-sc_fd, bp-b_data, bp-b_bcount, offset); } else { - if (bp-b_flags B_PHYS) { - /* copy in to bounce buffer and write it */ - copyin(bp-b_data, bbuf, bp-b_bcount); - ret = thunk_pwrite(sc-sc_fd, bbuf, bp-b_bcount, offset); - } else { - /* just write it */ - ret = thunk_pwrite(sc-sc_fd, bp-b_data, bp-b_bcount, offset); - } + ret = thunk_pwrite(sc-sc_fd, bp-b_data, bp-b_bcount, offset); } //if (ret == -1)
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 15:53:47 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Remove dead code. The error variable was no longer used. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/usermode/dev/ld_thunkbus.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/usermode/dev/ld_thunkbus.c diff -u src/sys/arch/usermode/dev/ld_thunkbus.c:1.22 src/sys/arch/usermode/dev/ld_thunkbus.c:1.23 --- src/sys/arch/usermode/dev/ld_thunkbus.c:1.22 Tue Dec 13 15:50:17 2011 +++ src/sys/arch/usermode/dev/ld_thunkbus.c Tue Dec 13 15:53:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $ */ +/* $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.22 2011/12/13 15:50:17 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: ld_thunkbus.c,v 1.23 2011/12/13 15:53:47 reinoud Exp $); #include sys/param.h #include sys/proc.h @@ -129,7 +129,6 @@ ld_thunkbus_ldstart(struct ld_softc *ld, { struct ld_thunkbus_softc *sc = (struct ld_thunkbus_softc *)ld; struct ld_thunkbus_transfer *tt = sc-sc_tt; - int error; tt-tt_sc = sc; tt-tt_bp = bp; @@ -137,9 +136,8 @@ ld_thunkbus_ldstart(struct ld_softc *ld, /* let the softint do the work */ sc-busy = true; spl_intr(IPL_BIO, softint_schedule, sc-sc_ih); - error = 0; - return error == -1 ? thunk_geterrno() : 0; + return 0; } static void
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 12:25:42 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: Just in case ease up the stack space a bit more To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Tue Dec 13 13:32:16 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: - gc old aio implementation - set busy before scheduling softint not after - try not to write past end of backing file - if B_PHYS flag is set, pread/write with bounce buffer and copyout/copyin - use the correct offset in ld_thunkbus_dump To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 15:50:17 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: No need for the bounce-buffer anymore since pmap bahaves like it ought to To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Tue Dec 13 15:53:47 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ld_thunkbus.c Log Message: Remove dead code. The error variable was no longer used. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/usermode/dev/ld_thunkbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Dec 12 12:20:30 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: No need for such big stack spaces on lwp_fork() with the new setup. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c diff -u src/sys/arch/usermode/dev/cpu.c:1.48 src/sys/arch/usermode/dev/cpu.c:1.49 --- src/sys/arch/usermode/dev/cpu.c:1.48 Sun Dec 11 20:45:14 2011 +++ src/sys/arch/usermode/dev/cpu.c Mon Dec 12 12:20:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.48 2011/12/11 20:45:14 reinoud Exp $ */ +/* $NetBSD: cpu.c,v 1.49 2011/12/12 12:20:30 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -30,7 +30,7 @@ #include opt_hz.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.48 2011/12/11 20:45:14 reinoud Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.49 2011/12/12 12:20:30 reinoud Exp $); #include sys/param.h #include sys/conf.h @@ -326,7 +326,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp /* copy the PCB and its switchframes from parent */ memcpy(pcb2, pcb1, sizeof(struct pcb)); - stacksize = 16*PAGE_SIZE; + stacksize = PAGE_SIZE; stack_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); stack_syscall_ucp = malloc(stacksize, M_TEMP, M_NOWAIT); stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 12 16:06:15 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: use spl_intr from signal handler instead of calling softint_schedule directly To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.8 src/sys/arch/usermode/dev/ttycons.c:1.9 --- src/sys/arch/usermode/dev/ttycons.c:1.8 Sun Dec 11 22:34:42 2011 +++ src/sys/arch/usermode/dev/ttycons.c Mon Dec 12 16:06:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.8 2011/12/11 22:34:42 jmcneill Exp $ */ +/* $NetBSD: ttycons.c,v 1.9 2011/12/12 16:06:15 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.8 2011/12/11 22:34:42 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.9 2011/12/12 16:06:15 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -333,11 +333,13 @@ ttycons_intr(int sig) { struct ttycons_softc *sc; + curcpu()-ci_idepth++; sc = device_lookup_private(ttycons_cd, minor(cn_tab-cn_dev)); - if (sc == NULL) - return; + if (sc) { + spl_intr(IPL_SERIAL, softint_schedule, sc-sc_rd_sih); + } + curcpu()-ci_idepth--; - softint_schedule(sc-sc_rd_sih); } static void
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 12 17:07:43 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: install a SIGINT handler and use it to emulate ^C To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/usermode/dev/ttycons.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/usermode/dev/ttycons.c diff -u src/sys/arch/usermode/dev/ttycons.c:1.10 src/sys/arch/usermode/dev/ttycons.c:1.11 --- src/sys/arch/usermode/dev/ttycons.c:1.10 Mon Dec 12 16:39:16 2011 +++ src/sys/arch/usermode/dev/ttycons.c Mon Dec 12 17:07:42 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ttycons.c,v 1.10 2011/12/12 16:39:16 jmcneill Exp $ */ +/* $NetBSD: ttycons.c,v 1.11 2011/12/12 17:07:42 jmcneill Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.10 2011/12/12 16:39:16 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.11 2011/12/12 17:07:42 jmcneill Exp $); #include sys/param.h #include sys/conf.h @@ -52,6 +52,7 @@ struct ttycons_softc { device_t sc_dev; struct tty *sc_tty; void *sc_rd_sih; + void *sc_ctrlc_sih; }; dev_type_cngetc(ttycons_cngetc); @@ -100,6 +101,9 @@ static int ttycons_param(struct tty *, s static void ttycons_intr(int); static void ttycons_softintr(void *); +static void ttycons_ctrlc(int); +static void ttycons_softctrlc(void *); + static int ttycons_match(device_t parent, cfdata_t match, void *opaque) { @@ -133,9 +137,15 @@ ttycons_attach(device_t parent, device_t sc-sc_rd_sih = softint_establish(SOFTINT_SERIAL, ttycons_softintr, sc); if (sc-sc_rd_sih == NULL) - panic(couldn't establish ttycons softint handler\n); + panic(couldn't establish ttycons intr handler\n); + + sc-sc_ctrlc_sih = softint_establish(SOFTINT_SERIAL, + ttycons_softctrlc, sc); + if (sc-sc_ctrlc_sih == NULL) + panic(couldn't establish ttycons ctrlc handler\n); thunk_signal(SIGIO, ttycons_intr); + thunk_signal(SIGINT, ttycons_ctrlc); if (thunk_set_stdin_sigio(true) != 0) panic(couldn't enable stdin async mode); } @@ -358,3 +368,28 @@ ttycons_softintr(void *priv) t-t_linesw-l_rint(ch, t); } } + +static void +ttycons_ctrlc(int sig) +{ + struct ttycons_softc *sc; + + curcpu()-ci_idepth++; + sc = device_lookup_private(ttycons_cd, minor(cn_tab-cn_dev)); + if (sc) { + spl_intr(IPL_SERIAL, softint_schedule, sc-sc_ctrlc_sih); + } + curcpu()-ci_idepth--; + +} + +static void +ttycons_softctrlc(void *priv) +{ + struct ttycons_softc *sc = priv; + struct tty *t = sc-sc_tty; + unsigned char ch = 3; /* ETX */ + + cn_check_magic(t-t_dev, ch, ttycons_cnm_state); + t-t_linesw-l_rint(ch, t); +}
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: reinoud Date: Mon Dec 12 12:20:30 UTC 2011 Modified Files: src/sys/arch/usermode/dev: cpu.c Log Message: No need for such big stack spaces on lwp_fork() with the new setup. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/usermode/dev/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/usermode/dev
Module Name:src Committed By: jmcneill Date: Mon Dec 12 16:06:15 UTC 2011 Modified Files: src/sys/arch/usermode/dev: ttycons.c Log Message: use spl_intr from signal handler instead of calling softint_schedule directly To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/ttycons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.