Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/include Add Xen specific members to struct cpu_...



details:   https://anonhg.NetBSD.org/src/rev/f986c07aa6cd
branches:  trunk
changeset: 768169:f986c07aa6cd
user:      cherry <cherry%NetBSD.org@localhost>
date:      Wed Aug 10 06:40:35 2011 +0000

description:
Add Xen specific members to struct cpu_info, Add proper per-cpu curcpu() functionality

diffstat:

 sys/arch/x86/include/cpu.h |  26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diffs (70 lines):

diff -r 87235fcf22d8 -r f986c07aa6cd sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h        Wed Aug 10 06:38:02 2011 +0000
+++ b/sys/arch/x86/include/cpu.h        Wed Aug 10 06:40:35 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.35 2011/06/12 03:35:50 rmind Exp $   */
+/*     $NetBSD: cpu.h,v 1.36 2011/08/10 06:40:35 cherry Exp $  */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -67,6 +67,11 @@
 #include <sys/evcnt.h>
 #include <sys/device_if.h> /* for device_t */
 
+#ifdef XEN
+#include <xen/xen3-public/xen.h>
+#include <xen/xen3-public/event_channel.h>
+#endif /* XEN */
+
 struct intrsource;
 struct pmap;
 struct device;
@@ -177,13 +182,20 @@
 
 #if defined(XEN) && defined(__x86_64__)
        /* Currently active user PGD (can't use rcr3() with Xen) */
+       pd_entry_t *    ci_kpm_pdir;    /* per-cpu L4 PD (va) */
+       paddr_t         ci_kpm_pdirpa; /* per-cpu L4 PD (pa) */
        paddr_t         ci_xen_current_user_pgd;
 #endif
 
        char *ci_doubleflt_stack;
        char *ci_ddbipi_stack;
 
+#ifndef XEN
        struct evcnt ci_ipi_events[X86_NIPI];
+#else   /* XEN */
+       struct evcnt ci_ipi_events[XEN_NIPIS];
+       evtchn_port_t ci_ipi_evtchn;
+#endif  /* XEN */
 
        device_t        ci_frequency;   /* Frequency scaling technology */
        device_t        ci_padlock;     /* VIA PadLock private storage */
@@ -220,6 +232,11 @@
        int             ci_padout __aligned(64);
 };
 
+#ifdef __x86_64__
+#define ci_pdirpa(ci, index) \
+       ((ci)->ci_kpm_pdirpa + (index) * sizeof(pd_entry_t))
+#endif /* __x86_64__ */
+
 /*
  * Macros to handle (some) trapframe registers for common x86 code.
  */
@@ -299,14 +316,9 @@
 void cpu_load_pmap(struct pmap *);
 
 extern uint32_t cpus_attached;
-#ifndef XEN
+
 #define        curcpu()                x86_curcpu()
 #define        curlwp                  x86_curlwp()
-#else
-/* XXX initgdt() calls pmap_kenter_pa() which calls splvm() before %fs is set */
-#define curcpu()               (&cpu_info_primary)
-#define curlwp                 curcpu()->ci_curlwp
-#endif
 #define        curpcb                  ((struct pcb *)lwp_getpcb(curlwp))
 
 /*



Home | Main Index | Thread Index | Old Index