diff options
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r-- | arch/x86/kernel/entry_64.S | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 2363e820ed68..70641aff0c25 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -56,7 +56,7 @@ | |||
56 | #include <asm/ftrace.h> | 56 | #include <asm/ftrace.h> |
57 | #include <asm/percpu.h> | 57 | #include <asm/percpu.h> |
58 | #include <asm/asm.h> | 58 | #include <asm/asm.h> |
59 | #include <asm/rcu.h> | 59 | #include <asm/context_tracking.h> |
60 | #include <asm/smap.h> | 60 | #include <asm/smap.h> |
61 | #include <linux/err.h> | 61 | #include <linux/err.h> |
62 | 62 | ||
@@ -1715,9 +1715,10 @@ nested_nmi: | |||
1715 | 1715 | ||
1716 | 1: | 1716 | 1: |
1717 | /* Set up the interrupted NMIs stack to jump to repeat_nmi */ | 1717 | /* Set up the interrupted NMIs stack to jump to repeat_nmi */ |
1718 | leaq -6*8(%rsp), %rdx | 1718 | leaq -1*8(%rsp), %rdx |
1719 | movq %rdx, %rsp | 1719 | movq %rdx, %rsp |
1720 | CFI_ADJUST_CFA_OFFSET 6*8 | 1720 | CFI_ADJUST_CFA_OFFSET 1*8 |
1721 | leaq -10*8(%rsp), %rdx | ||
1721 | pushq_cfi $__KERNEL_DS | 1722 | pushq_cfi $__KERNEL_DS |
1722 | pushq_cfi %rdx | 1723 | pushq_cfi %rdx |
1723 | pushfq_cfi | 1724 | pushfq_cfi |
@@ -1725,8 +1726,8 @@ nested_nmi: | |||
1725 | pushq_cfi $repeat_nmi | 1726 | pushq_cfi $repeat_nmi |
1726 | 1727 | ||
1727 | /* Put stack back */ | 1728 | /* Put stack back */ |
1728 | addq $(11*8), %rsp | 1729 | addq $(6*8), %rsp |
1729 | CFI_ADJUST_CFA_OFFSET -11*8 | 1730 | CFI_ADJUST_CFA_OFFSET -6*8 |
1730 | 1731 | ||
1731 | nested_nmi_out: | 1732 | nested_nmi_out: |
1732 | popq_cfi %rdx | 1733 | popq_cfi %rdx |
@@ -1752,18 +1753,18 @@ first_nmi: | |||
1752 | * +-------------------------+ | 1753 | * +-------------------------+ |
1753 | * | NMI executing variable | | 1754 | * | NMI executing variable | |
1754 | * +-------------------------+ | 1755 | * +-------------------------+ |
1755 | * | Saved SS | | ||
1756 | * | Saved Return RSP | | ||
1757 | * | Saved RFLAGS | | ||
1758 | * | Saved CS | | ||
1759 | * | Saved RIP | | ||
1760 | * +-------------------------+ | ||
1761 | * | copied SS | | 1756 | * | copied SS | |
1762 | * | copied Return RSP | | 1757 | * | copied Return RSP | |
1763 | * | copied RFLAGS | | 1758 | * | copied RFLAGS | |
1764 | * | copied CS | | 1759 | * | copied CS | |
1765 | * | copied RIP | | 1760 | * | copied RIP | |
1766 | * +-------------------------+ | 1761 | * +-------------------------+ |
1762 | * | Saved SS | | ||
1763 | * | Saved Return RSP | | ||
1764 | * | Saved RFLAGS | | ||
1765 | * | Saved CS | | ||
1766 | * | Saved RIP | | ||
1767 | * +-------------------------+ | ||
1767 | * | pt_regs | | 1768 | * | pt_regs | |
1768 | * +-------------------------+ | 1769 | * +-------------------------+ |
1769 | * | 1770 | * |
@@ -1779,9 +1780,14 @@ first_nmi: | |||
1779 | /* Set the NMI executing variable on the stack. */ | 1780 | /* Set the NMI executing variable on the stack. */ |
1780 | pushq_cfi $1 | 1781 | pushq_cfi $1 |
1781 | 1782 | ||
1783 | /* | ||
1784 | * Leave room for the "copied" frame | ||
1785 | */ | ||
1786 | subq $(5*8), %rsp | ||
1787 | |||
1782 | /* Copy the stack frame to the Saved frame */ | 1788 | /* Copy the stack frame to the Saved frame */ |
1783 | .rept 5 | 1789 | .rept 5 |
1784 | pushq_cfi 6*8(%rsp) | 1790 | pushq_cfi 11*8(%rsp) |
1785 | .endr | 1791 | .endr |
1786 | CFI_DEF_CFA_OFFSET SS+8-RIP | 1792 | CFI_DEF_CFA_OFFSET SS+8-RIP |
1787 | 1793 | ||
@@ -1802,12 +1808,15 @@ repeat_nmi: | |||
1802 | * is benign for the non-repeat case, where 1 was pushed just above | 1808 | * is benign for the non-repeat case, where 1 was pushed just above |
1803 | * to this very stack slot). | 1809 | * to this very stack slot). |
1804 | */ | 1810 | */ |
1805 | movq $1, 5*8(%rsp) | 1811 | movq $1, 10*8(%rsp) |
1806 | 1812 | ||
1807 | /* Make another copy, this one may be modified by nested NMIs */ | 1813 | /* Make another copy, this one may be modified by nested NMIs */ |
1814 | addq $(10*8), %rsp | ||
1815 | CFI_ADJUST_CFA_OFFSET -10*8 | ||
1808 | .rept 5 | 1816 | .rept 5 |
1809 | pushq_cfi 4*8(%rsp) | 1817 | pushq_cfi -6*8(%rsp) |
1810 | .endr | 1818 | .endr |
1819 | subq $(5*8), %rsp | ||
1811 | CFI_DEF_CFA_OFFSET SS+8-RIP | 1820 | CFI_DEF_CFA_OFFSET SS+8-RIP |
1812 | end_repeat_nmi: | 1821 | end_repeat_nmi: |
1813 | 1822 | ||
@@ -1858,8 +1867,12 @@ nmi_swapgs: | |||
1858 | SWAPGS_UNSAFE_STACK | 1867 | SWAPGS_UNSAFE_STACK |
1859 | nmi_restore: | 1868 | nmi_restore: |
1860 | RESTORE_ALL 8 | 1869 | RESTORE_ALL 8 |
1870 | |||
1871 | /* Pop the extra iret frame */ | ||
1872 | addq $(5*8), %rsp | ||
1873 | |||
1861 | /* Clear the NMI executing stack variable */ | 1874 | /* Clear the NMI executing stack variable */ |
1862 | movq $0, 10*8(%rsp) | 1875 | movq $0, 5*8(%rsp) |
1863 | jmp irq_return | 1876 | jmp irq_return |
1864 | CFI_ENDPROC | 1877 | CFI_ENDPROC |
1865 | END(nmi) | 1878 | END(nmi) |