Index: sys/arch/amd64/amd64/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/machdep.c,v
retrieving revision 1.163
diff -p -u -r1.163 machdep.c
--- sys/arch/amd64/amd64/machdep.c      10 Aug 2011 11:39:45 -0000      1.163
+++ sys/arch/amd64/amd64/machdep.c      11 Aug 2011 10:18:04 -0000
@@ -719,11 +719,7 @@ haltsys:
#endif /* XEN */
       }

-#ifdef XEN
-       xen_broadcast_ipi(XEN_IPI_HALT);
-#else /* XEN */
-       x86_broadcast_ipi(X86_IPI_HALT);
-#endif
+       cpu_broadcast_halt();

       if (howto & RB_HALT) {
#if NACPICA > 0
Index: sys/arch/i386/i386/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.707
diff -p -u -r1.707 machdep.c
--- sys/arch/i386/i386/machdep.c        10 Aug 2011 06:38:02 -0000      1.707
+++ sys/arch/i386/i386/machdep.c        11 Aug 2011 10:18:10 -0000
@@ -955,11 +955,7 @@ haltsys:
       }

#ifdef MULTIPROCESSOR
-#ifdef XEN
-       xen_broadcast_ipi(XEN_IPI_HALT);
-#else /* XEN */
-       x86_broadcast_ipi(X86_IPI_HALT);
-#endif /* XEN */
+       cpu_broadcast_halt();
#endif /* MULTIPROCESSOR */

       if (howto & RB_HALT) {
Index: sys/arch/x86/include/cpu.h
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/include/cpu.h,v
retrieving revision 1.36
diff -p -u -r1.36 cpu.h
--- sys/arch/x86/include/cpu.h  10 Aug 2011 06:40:35 -0000      1.36
+++ sys/arch/x86/include/cpu.h  11 Aug 2011 10:18:14 -0000
@@ -314,6 +314,8 @@ void cpu_boot_secondary_processors(void)
void cpu_init_idle_lwps(void);
void cpu_init_msrs(struct cpu_info *, bool);
void cpu_load_pmap(struct pmap *);
+void cpu_broadcast_halt(void);
+void cpu_kick(struct cpu_info *);

extern uint32_t cpus_attached;

Index: sys/arch/x86/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/cpu.c,v
retrieving revision 1.90
diff -p -u -r1.90 cpu.c
--- sys/arch/x86/x86/cpu.c      29 Jul 2011 21:21:43 -0000      1.90
+++ sys/arch/x86/x86/cpu.c      11 Aug 2011 10:18:15 -0000
@@ -1210,3 +1210,23 @@ cpu_load_pmap(struct pmap *pmap)
       lcr3(pmap_pdirpa(pmap, 0));
#endif /* PAE */
}
+
+/*
+ * Notify all other cpus to halt.
+ */
+
+void
+cpu_broadcast_halt(struct cpu_info *ci)
+{
+       x86_broadcast_ipi(X86_IPI_HALT);
+}
+
+/*
+ * Send a dummy ipi to a cpu to force it to run splraise()/spllower()
+ */
+
+void
+cpu_kick(struct cpu_info *ci)
+{
+       x86_send_ipi(ci, 0);
+}
Index: sys/arch/x86/x86/x86_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/x86_machdep.c,v
retrieving revision 1.54
diff -p -u -r1.54 x86_machdep.c
--- sys/arch/x86/x86/x86_machdep.c      10 Aug 2011 11:39:45 -0000      1.54
+++ sys/arch/x86/x86/x86_machdep.c      11 Aug 2011 10:18:18 -0000
@@ -205,11 +205,7 @@ cpu_need_resched(struct cpu_info *ci, in
               if (ci == cur)
                       return;
               if (x86_cpu_idle_ipi != false) {
-#ifdef XEN
-                       xen_send_ipi(ci, XEN_IPI_KICK);
-#else /* XEN */
-                       x86_send_ipi(ci, 0);
-#endif /* XEN */
+                       cpu_kick(ci);
               }
               return;
       }
@@ -231,11 +227,7 @@ cpu_need_resched(struct cpu_info *ci, in
               return;
       }
       if ((flags & RESCHED_IMMED) != 0) {
-#ifdef XEN
-               xen_send_ipi(ci, XEN_IPI_KICK);
-#else /* XEN */
-               x86_send_ipi(ci, 0);
-#endif /* XEN */
+               cpu_kick(ci);
       }
}

@@ -246,11 +238,7 @@ cpu_signotify(struct lwp *l)
       KASSERT(kpreempt_disabled());
       aston(l, X86_AST_GENERIC);
       if (l->l_cpu != curcpu())
-#ifdef XEN
-               xen_send_ipi(l->l_cpu, XEN_IPI_KICK);
-#else /* XEN */
-               x86_send_ipi(l->l_cpu, 0);
-#endif /* XEN */
+               cpu_kick(l->l_cpu);
}

void
Index: sys/arch/xen/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/cpu.c,v
retrieving revision 1.60
diff -p -u -r1.60 cpu.c
--- sys/arch/xen/x86/cpu.c      16 Jul 2011 14:46:18 -0000      1.60
+++ sys/arch/xen/x86/cpu.c      11 Aug 2011 10:18:19 -0000
@@ -1177,3 +1177,23 @@ cpu_load_pmap(struct pmap *pmap)
       }
#endif /* __x86_64__ */
}
+
+/*
+ * Notify all other cpus to halt.
+ */
+
+void
+cpu_broadcast_halt(void)
+{
+       xen_broadcast_ipi(XEN_IPI_HALT);
+}
+
+/*
+ * Send a dummy ipi to a cpu.
+ */
+
+void
+cpu_kick(struct cpu_info *ci)
+{
+       xen_send_ipi(ci, XEN_IPI_KICK);
+}