summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/apic_vector.S
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2018-02-21 14:21:29 -0300
committerLuiz Souza <luiz@netgate.com>2018-02-21 14:21:29 -0300
commitd3d59b01294138e59995b31d2bcbbbdf45e26a3c (patch)
tree11fbc866b8a4436698a543bf2dc20a8360bcf479 /sys/amd64/amd64/apic_vector.S
parent63302e53ed4b3fe59711d939ba87433a9a12199d (diff)
downloadFreeBSD-src-d3d59b01294138e59995b31d2bcbbbdf45e26a3c.zip
FreeBSD-src-d3d59b01294138e59995b31d2bcbbbdf45e26a3c.tar.gz
Revert "MFC r328083,328096,328116,328119,328120,328128,328135,328153,328157,"
This reverts commit 430a2bea3907149b30cc75fc722b6cf1f81da82a.
Diffstat (limited to 'sys/amd64/amd64/apic_vector.S')
-rw-r--r--sys/amd64/amd64/apic_vector.S172
1 files changed, 98 insertions, 74 deletions
diff --git a/sys/amd64/amd64/apic_vector.S b/sys/amd64/amd64/apic_vector.S
index ea93d32..b3ca520 100644
--- a/sys/amd64/amd64/apic_vector.S
+++ b/sys/amd64/amd64/apic_vector.S
@@ -2,12 +2,6 @@
* Copyright (c) 1989, 1990 William F. Jolitz.
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
- * Copyright (c) 2014-2018 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by
- * Konstantin Belousov <kib@FreeBSD.org> under sponsorship from
- * the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,12 +38,12 @@
#include "opt_smp.h"
-#include "assym.s"
-
#include <machine/asmacros.h>
#include <machine/specialreg.h>
#include <x86/apicreg.h>
+#include "assym.s"
+
#ifdef SMP
#define LK lock ;
#else
@@ -79,28 +73,30 @@ as_lapic_eoi:
* translates that into a vector, and passes the vector to the
* lapic_handle_intr() function.
*/
- .macro ISR_VEC index, vec_name
- INTR_HANDLER \vec_name
- FAKE_MCOUNT(TF_RIP(%rsp))
- cmpl $0,x2apic_mode
- je 1f
- movl $(MSR_APIC_ISR0 + \index),%ecx
- rdmsr
- jmp 2f
-1:
- movq lapic_map, %rdx /* pointer to local APIC */
- movl LA_ISR + 16 * (\index)(%rdx), %eax /* load ISR */
-2:
- bsrl %eax, %eax /* index of highest set bit in ISR */
- jz 3f
- addl $(32 * \index),%eax
- movq %rsp, %rsi
- movl %eax, %edi /* pass the IRQ */
- call lapic_handle_intr
-3:
- MEXITCOUNT
+#define ISR_VEC(index, vec_name) \
+ .text ; \
+ SUPERALIGN_TEXT ; \
+IDTVEC(vec_name) ; \
+ PUSH_FRAME ; \
+ FAKE_MCOUNT(TF_RIP(%rsp)) ; \
+ cmpl $0,x2apic_mode ; \
+ je 1f ; \
+ movl $(MSR_APIC_ISR0 + index),%ecx ; \
+ rdmsr ; \
+ jmp 2f ; \
+1: ; \
+ movq lapic_map, %rdx ; /* pointer to local APIC */ \
+ movl LA_ISR + 16 * (index)(%rdx), %eax ; /* load ISR */ \
+2: ; \
+ bsrl %eax, %eax ; /* index of highest set bit in ISR */ \
+ jz 3f ; \
+ addl $(32 * index),%eax ; \
+ movq %rsp, %rsi ; \
+ movl %eax, %edi ; /* pass the IRQ */ \
+ call lapic_handle_intr ; \
+3: ; \
+ MEXITCOUNT ; \
jmp doreti
- .endm
/*
* Handle "spurious INTerrupts".
@@ -112,21 +108,26 @@ as_lapic_eoi:
.text
SUPERALIGN_TEXT
IDTVEC(spuriousint)
+
/* No EOI cycle used here */
+
jmp doreti_iret
- ISR_VEC 1, apic_isr1
- ISR_VEC 2, apic_isr2
- ISR_VEC 3, apic_isr3
- ISR_VEC 4, apic_isr4
- ISR_VEC 5, apic_isr5
- ISR_VEC 6, apic_isr6
- ISR_VEC 7, apic_isr7
+ ISR_VEC(1, apic_isr1)
+ ISR_VEC(2, apic_isr2)
+ ISR_VEC(3, apic_isr3)
+ ISR_VEC(4, apic_isr4)
+ ISR_VEC(5, apic_isr5)
+ ISR_VEC(6, apic_isr6)
+ ISR_VEC(7, apic_isr7)
/*
* Local APIC periodic timer handler.
*/
- INTR_HANDLER timerint
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(timerint)
+ PUSH_FRAME
FAKE_MCOUNT(TF_RIP(%rsp))
movq %rsp, %rdi
call lapic_handle_timer
@@ -136,7 +137,10 @@ IDTVEC(spuriousint)
/*
* Local APIC CMCI handler.
*/
- INTR_HANDLER cmcint
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(cmcint)
+ PUSH_FRAME
FAKE_MCOUNT(TF_RIP(%rsp))
call lapic_handle_cmc
MEXITCOUNT
@@ -145,7 +149,10 @@ IDTVEC(spuriousint)
/*
* Local APIC error interrupt handler.
*/
- INTR_HANDLER errorint
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(errorint)
+ PUSH_FRAME
FAKE_MCOUNT(TF_RIP(%rsp))
call lapic_handle_error
MEXITCOUNT
@@ -156,7 +163,10 @@ IDTVEC(spuriousint)
* Xen event channel upcall interrupt handler.
* Only used when the hypervisor supports direct vector callbacks.
*/
- INTR_HANDLER xen_intr_upcall
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(xen_intr_upcall)
+ PUSH_FRAME
FAKE_MCOUNT(TF_RIP(%rsp))
movq %rsp, %rdi
call xen_intr_handle_upcall
@@ -173,68 +183,74 @@ IDTVEC(spuriousint)
SUPERALIGN_TEXT
invltlb_ret:
call as_lapic_eoi
- jmp ld_regs
+ POP_FRAME
+ jmp doreti_iret
SUPERALIGN_TEXT
- INTR_HANDLER invltlb
+IDTVEC(invltlb)
+ PUSH_FRAME
+
call invltlb_handler
jmp invltlb_ret
- INTR_HANDLER invltlb_pcid
+IDTVEC(invltlb_pcid)
+ PUSH_FRAME
+
call invltlb_pcid_handler
jmp invltlb_ret
- INTR_HANDLER invltlb_invpcid_nopti
- call invltlb_invpcid_handler
- jmp invltlb_ret
+IDTVEC(invltlb_invpcid)
+ PUSH_FRAME
- INTR_HANDLER invltlb_invpcid_pti
- call invltlb_invpcid_pti_handler
+ call invltlb_invpcid_handler
jmp invltlb_ret
/*
* Single page TLB shootdown
*/
- INTR_HANDLER invlpg
- call invlpg_handler
- jmp invltlb_ret
+ .text
- INTR_HANDLER invlpg_invpcid
- call invlpg_invpcid_handler
- jmp invltlb_ret
+ SUPERALIGN_TEXT
+IDTVEC(invlpg)
+ PUSH_FRAME
- INTR_HANDLER invlpg_pcid
- call invlpg_pcid_handler
+ call invlpg_handler
jmp invltlb_ret
/*
* Page range TLB shootdown.
*/
- INTR_HANDLER invlrng
- call invlrng_handler
- jmp invltlb_ret
-
- INTR_HANDLER invlrng_invpcid
- call invlrng_invpcid_handler
- jmp invltlb_ret
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(invlrng)
+ PUSH_FRAME
- INTR_HANDLER invlrng_pcid
- call invlrng_pcid_handler
+ call invlrng_handler
jmp invltlb_ret
/*
* Invalidate cache.
*/
- INTR_HANDLER invlcache
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(invlcache)
+ PUSH_FRAME
+
call invlcache_handler
jmp invltlb_ret
/*
* Handler for IPIs sent via the per-cpu IPI bitmap.
*/
- INTR_HANDLER ipi_intr_bitmap_handler
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(ipi_intr_bitmap_handler)
+ PUSH_FRAME
+
call as_lapic_eoi
+
FAKE_MCOUNT(TF_RIP(%rsp))
+
call ipi_bitmap_handler
MEXITCOUNT
jmp doreti
@@ -242,15 +258,24 @@ invltlb_ret:
/*
* Executed by a CPU when it receives an IPI_STOP from another CPU.
*/
- INTR_HANDLER cpustop
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(cpustop)
+ PUSH_FRAME
+
call as_lapic_eoi
+
call cpustop_handler
jmp doreti
/*
* Executed by a CPU when it receives an IPI_SUSPEND from another CPU.
*/
- INTR_HANDLER cpususpend
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(cpususpend)
+ PUSH_FRAME
+
call cpususpend_handler
call as_lapic_eoi
jmp doreti
@@ -260,7 +285,10 @@ invltlb_ret:
*
* - Calls the generic rendezvous action function.
*/
- INTR_HANDLER rendezvous
+ .text
+ SUPERALIGN_TEXT
+IDTVEC(rendezvous)
+ PUSH_FRAME
#ifdef COUNT_IPIS
movl PCPU(CPUID), %eax
movq ipi_rendezvous_counts(,%rax,8), %rax
@@ -300,8 +328,4 @@ IDTVEC(justreturn)
popq %rax
jmp doreti_iret
- INTR_HANDLER justreturn1
- call as_lapic_eoi
- jmp doreti
-
#endif /* SMP */
OpenPOWER on IntegriCloud