Source-Changes-HG archive

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

[src/bouyer-xenpvh]: src/sys/arch Avoid overflow of ci_ipi_events[] in the PV...



details:   https://anonhg.NetBSD.org/src/rev/01a482630ced
branches:  bouyer-xenpvh
changeset: 982938:01a482630ced
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Apr 16 17:44:54 2020 +0000

description:
Avoid overflow of ci_ipi_events[] in the PVHVM case (it's size is
XEN_NIPIS but we use x86 IPIs): size XEN_NIPIS only for PV, and
CTASSERT that XEN_NIPIS <= X86_NIPI if we ever use Xen IPIs for
PVHVM.

diffstat:

 sys/arch/amd64/include/intrdefs.h |   4 +---
 sys/arch/i386/include/intrdefs.h  |   4 +---
 sys/arch/x86/include/cpu.h        |  17 +++++++++--------
 3 files changed, 11 insertions(+), 14 deletions(-)

diffs (71 lines):

diff -r 2dc9b3a06d64 -r 01a482630ced sys/arch/amd64/include/intrdefs.h
--- a/sys/arch/amd64/include/intrdefs.h Thu Apr 16 10:42:26 2020 +0000
+++ b/sys/arch/amd64/include/intrdefs.h Thu Apr 16 17:44:54 2020 +0000
@@ -1,6 +1,4 @@
-/*     $NetBSD: intrdefs.h,v 1.2 2011/08/10 06:30:59 cherry Exp $      */
+/*     $NetBSD: intrdefs.h,v 1.2.64.1 2020/04/16 17:44:54 bouyer Exp $ */
 
 #include <x86/intrdefs.h>
-#ifdef XEN
 #include <xen/intrdefs.h>
-#endif /* XEN */
diff -r 2dc9b3a06d64 -r 01a482630ced sys/arch/i386/include/intrdefs.h
--- a/sys/arch/i386/include/intrdefs.h  Thu Apr 16 10:42:26 2020 +0000
+++ b/sys/arch/i386/include/intrdefs.h  Thu Apr 16 17:44:54 2020 +0000
@@ -1,6 +1,4 @@
-/*     $NetBSD: intrdefs.h,v 1.4 2011/08/10 06:30:59 cherry Exp $      */
+/*     $NetBSD: intrdefs.h,v 1.4.64.1 2020/04/16 17:44:54 bouyer Exp $ */
 
 #include <x86/intrdefs.h>
-#ifdef XEN
 #include <xen/intrdefs.h>
-#endif /* XEN */
diff -r 2dc9b3a06d64 -r 01a482630ced sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h        Thu Apr 16 10:42:26 2020 +0000
+++ b/sys/arch/x86/include/cpu.h        Thu Apr 16 17:44:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.117.4.4 2020/04/12 17:25:52 bouyer Exp $     */
+/*     $NetBSD: cpu.h,v 1.117.4.5 2020/04/16 17:44:54 bouyer Exp $     */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -262,9 +262,13 @@
        vaddr_t         ci_svs_utls;
 #endif
 
+#ifndef XENPV
+       struct evcnt ci_ipi_events[X86_NIPI];
+#else
+       struct evcnt ci_ipi_events[XEN_NIPIS];
+#endif
 #ifdef XEN
        u_long ci_evtmask[NR_EVENT_CHANNELS]; /* events allowed on this CPU */
-       struct evcnt ci_ipi_events[XEN_NIPIS];
        evtchn_port_t ci_ipi_evtchn;
 #if defined(XENPV)
 #if defined(PAE) || defined(__x86_64__)
@@ -299,9 +303,6 @@
         */
        uint64_t        ci_xen_systime_ns_skew;
 
-       /* Xen periodic timer interrupt handle.  */
-       struct intrhand *ci_xen_timer_intrhand;
-
        /*
         * Clockframe for timer interrupt handler.
         * Saved at entry via event callback.
@@ -316,11 +317,11 @@
        struct evcnt    ci_xen_raw_systime_backwards_evcnt;
        struct evcnt    ci_xen_systime_backwards_hardclock_evcnt;
        struct evcnt    ci_xen_missed_hardclock_evcnt;
-#else   /* XEN */
-       struct evcnt ci_ipi_events[X86_NIPI];
 #endif /* XEN */
-
 };
+#ifndef XENPV
+       __CTASSERT(XEN_NIPIS <= X86_NIPI);
+#endif
 
 /*
  * Macros to handle (some) trapframe registers for common x86 code.



Home | Main Index | Thread Index | Old Index