summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorrmind <rmind@NetBSD.org>2009-11-21 05:54:04 +0000
committerrmind <rmind@NetBSD.org>2009-11-21 05:54:04 +0000
commit448807fa214fc37a744ee64ea6debfa3e5a5f2be (patch)
treefd9257699fa13681de6c2d0d84260088f91fcc4d /sys
parent498ef96f103a7966262edb6ebe55e93c5f6b1ff7 (diff)
Catch-up Xen and usermode with lwp_getpcb() and unbreak Xen build.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/usermode/dev/cpu.c12
-rw-r--r--sys/arch/xen/x86/autoconf.c8
-rw-r--r--sys/arch/xen/x86/cpu.c21
3 files changed, 24 insertions, 17 deletions
diff --git a/sys/arch/usermode/dev/cpu.c b/sys/arch/usermode/dev/cpu.c
index 0d6c4505435..b042c401145 100644
--- a/sys/arch/usermode/dev/cpu.c
+++ b/sys/arch/usermode/dev/cpu.c
@@ -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 <jmcneill@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 @@ lwp_t *
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 @@ cpu_lwp_free(struct lwp *l, int proc)
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 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
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",
diff --git a/sys/arch/xen/x86/autoconf.c b/sys/arch/xen/x86/autoconf.c
index 8d19d26372d..c39af80f677 100644
--- a/sys/arch/xen/x86/autoconf.c
+++ b/sys/arch/xen/x86/autoconf.c
@@ -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 @@ int x86_ndisks;
void
cpu_configure(void)
{
+ struct pcb *pcb;
startrtclock();
@@ -140,7 +141,8 @@ cpu_configure(void)
#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();
diff --git a/sys/arch/xen/x86/cpu.c b/sys/arch/xen/x86/cpu.c
index 4db543595d6..1a2ea69e333 100644
--- a/sys/arch/xen/x86/cpu.c
+++ b/sys/arch/xen/x86/cpu.c
@@ -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 @@ cpu_attach_common(device_t parent, device_t self, void *aux)
#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 @@ static void
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 @@ void
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 @@ cpu_hatch(void *v)
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();