summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/apic_vector.S
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2015-03-14 02:32:08 +0000
committerneel <neel@FreeBSD.org>2015-03-14 02:32:08 +0000
commite16d18eeb88f1763ac45bd42e37e7244970d4722 (patch)
tree3315483c52723327945a90b486ede6f81b26e39c /sys/amd64/amd64/apic_vector.S
parent771dc2cc82487fde44a71d30533ccde7bf753a8a (diff)
downloadFreeBSD-src-e16d18eeb88f1763ac45bd42e37e7244970d4722.zip
FreeBSD-src-e16d18eeb88f1763ac45bd42e37e7244970d4722.tar.gz
Use lapic_ipi_alloc() to dynamically allocate IPI slots needed by bhyve when
vmm.ko is loaded. Also relocate the 'justreturn' IPI handler to be alongside all other handlers. Requested by: kib
Diffstat (limited to 'sys/amd64/amd64/apic_vector.S')
-rw-r--r--sys/amd64/amd64/apic_vector.S31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S
index d9f2724..c3aac33 100644
--- a/sys/amd64/amd64/apic_vector.S
+++ b/sys/amd64/amd64/apic_vector.S
@@ -301,4 +301,35 @@ IDTVEC(rendezvous)
call smp_rendezvous_action
call as_lapic_eoi
jmp doreti
+
+/*
+ * IPI handler whose purpose is to interrupt the CPU with minimum overhead.
+ * This is used by bhyve to force a host cpu executing in guest context to
+ * trap into the hypervisor.
+ *
+ * This handler is different from other IPI handlers in the following aspects:
+ *
+ * 1. It doesn't push a trapframe on the stack.
+ *
+ * This implies that a DDB backtrace involving 'justreturn' will skip the
+ * function that was interrupted by this handler.
+ *
+ * 2. It doesn't 'swapgs' when userspace is interrupted.
+ *
+ * The 'justreturn' handler does not access any pcpu data so it is not an
+ * issue. Moreover the 'justreturn' handler can only be interrupted by an NMI
+ * whose handler already doesn't trust GS.base when kernel code is interrupted.
+ */
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(justreturn)
+ pushq %rax
+ pushq %rcx
+ pushq %rdx
+ call as_lapic_eoi
+ popq %rdx
+ popq %rcx
+ popq %rax
+ jmp doreti_iret
+
#endif /* SMP */
OpenPOWER on IntegriCloud