Module Name: src Committed By: rmind Date: Sat Nov 21 05:54:04 UTC 2009
Modified Files: src/sys/arch/usermode/dev: cpu.c src/sys/arch/xen/x86: autoconf.c cpu.c Log Message: Catch-up Xen and usermode with lwp_getpcb() and unbreak Xen build. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/dev/cpu.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/x86/autoconf.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/xen/x86/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.4 src/sys/arch/usermode/dev/cpu.c:1.5 --- src/sys/arch/usermode/dev/cpu.c:1.4 Wed Oct 21 16:06:59 2009 +++ src/sys/arch/usermode/dev/cpu.c Sat Nov 21 05:54:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.4 2009/10/21 16:06:59 snj Exp $ */ +/* $NetBSD: cpu.c,v 1.5 2009/11/21 05:54:04 rmind Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.4 2009/10/21 16:06:59 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.5 2009/11/21 05:54:04 rmind Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -145,8 +145,8 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning) { extern int errno; - struct pcb *oldpcb = (struct pcb *)(oldlwp ? oldlwp->l_addr : NULL); - struct pcb *newpcb = (struct pcb *)newlwp->l_addr; + struct pcb *oldpcb = oldlwp ? lwp_getpcb(oldlwp) : NULL; + struct pcb *newpcb = lwp_getpcb(newlwp); struct cpu_info *ci = curcpu(); #ifdef CPU_DEBUG @@ -243,7 +243,7 @@ void cpu_lwp_free2(struct lwp *l) { - struct pcb *pcb = (struct pcb *)l->l_addr; + struct pcb *pcb = lwp_getpcb(l); #ifdef CPU_DEBUG printf("cpu_lwp_free2\n"); @@ -273,7 +273,7 @@ void (*func)(void *), void *arg) { extern int errno; - struct pcb *pcb = (struct pcb *)l2->l_addr; + struct pcb *pcb = lwp_getpcb(l2); #ifdef CPU_DEBUG printf("cpu_lwp_fork [%s/%p] -> [%s/%p] stack=%p stacksize=%d\n", Index: src/sys/arch/xen/x86/autoconf.c diff -u src/sys/arch/xen/x86/autoconf.c:1.11 src/sys/arch/xen/x86/autoconf.c:1.12 --- src/sys/arch/xen/x86/autoconf.c:1.11 Fri Nov 6 23:09:10 2009 +++ src/sys/arch/xen/x86/autoconf.c Sat Nov 21 05:54:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.11 2009/11/06 23:09:10 dyoung Exp $ */ +/* $NetBSD: autoconf.c,v 1.12 2009/11/21 05:54:04 rmind Exp $ */ /* NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp */ /*- @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.11 2009/11/06 23:09:10 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.12 2009/11/21 05:54:04 rmind Exp $"); #include "opt_xen.h" #include "opt_compat_oldboot.h" @@ -117,6 +117,7 @@ void cpu_configure(void) { + struct pcb *pcb; startrtclock(); @@ -140,7 +141,8 @@ #endif /* resync cr0 after FPU configuration */ - lwp0.l_addr->u_pcb.pcb_cr0 = rcr0(); + pcb = lwp_getpcb(&lwp0); + pcb->pcb_cr0 = rcr0(); #ifdef MULTIPROCESSOR /* propagate this to the idle pcb's. */ cpu_init_idle_lwps(); Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.36 src/sys/arch/xen/x86/cpu.c:1.37 --- src/sys/arch/xen/x86/cpu.c:1.36 Sat Nov 7 07:27:49 2009 +++ src/sys/arch/xen/x86/cpu.c Sat Nov 21 05:54:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.36 2009/11/07 07:27:49 cegger Exp $ */ +/* $NetBSD: cpu.c,v 1.37 2009/11/21 05:54:04 rmind Exp $ */ /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */ /*- @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2009/11/07 07:27:49 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 2009/11/21 05:54:04 rmind Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -512,13 +512,14 @@ #if defined(MULTIPROCESSOR) if (mp_verbose) { struct lwp *l = ci->ci_data.cpu_idlelwp; + struct pcb *pcb = lwp_getpcb(l); aprint_verbose_dev(sc->sc_dev, "idle lwp at %p, idle sp at 0x%p\n", l, #ifdef i386 - (void *)l->l_addr->u_pcb.pcb_esp + (void *)pcb->pcb_esp #else - (void *)l->l_addr->u_pcb.pcb_rsp + (void *)pcb->pcb_rsp #endif ); @@ -596,7 +597,7 @@ cpu_init_idle_lwp(struct cpu_info *ci) { struct lwp *l = ci->ci_data.cpu_idlelwp; - struct pcb *pcb = &l->l_addr->u_pcb; + struct pcb *pcb = lwp_getpcb(l); pcb->pcb_cr0 = rcr0(); } @@ -692,8 +693,9 @@ cpu_hatch(void *v) { struct cpu_info *ci = (struct cpu_info *)v; - int s, i; + struct pcb *pcb; uint32_t blacklist_features; + int s, i; #ifdef __x86_64__ cpu_init_msrs(ci, true); @@ -720,9 +722,12 @@ KASSERT((ci->ci_flags & CPUF_RUNNING) == 0); + pcb = lwp_getpcb(curlwp); lcr3(pmap_kernel()->pm_pdirpa); - curlwp->l_addr->u_pcb.pcb_cr3 = pmap_kernel()->pm_pdirpa; - lcr0(ci->ci_data.cpu_idlelwp->l_addr->u_pcb.pcb_cr0); + pcb->pcb_cr3 = pmap_kernel()->pm_pdirpa; + pcb = lwp_getpcb(ci->ci_data.cpu_idlelwp); + lcr0(pcb->pcb_cr0); + cpu_init_idt(); gdt_init_cpu(ci); lapic_enable();