|
59 | 59 | #include <asm/cpu_device_id.h> |
60 | 60 | #include <asm/uv/uv.h> |
61 | 61 | #include <asm/sigframe.h> |
| 62 | +#include <asm/ia32.h> |
62 | 63 | #include <asm/traps.h> |
63 | 64 | #include <asm/sev.h> |
64 | 65 |
|
@@ -2012,24 +2013,24 @@ void syscall_init(void) |
2012 | 2013 | wrmsr(MSR_STAR, 0, (__USER32_CS << 16) | __KERNEL_CS); |
2013 | 2014 | wrmsrl(MSR_LSTAR, (unsigned long)entry_SYSCALL_64); |
2014 | 2015 |
|
2015 | | -#ifdef CONFIG_IA32_EMULATION |
2016 | | - wrmsrl(MSR_CSTAR, (unsigned long)entry_SYSCALL_compat); |
2017 | | - /* |
2018 | | - * This only works on Intel CPUs. |
2019 | | - * On AMD CPUs these MSRs are 32-bit, CPU truncates MSR_IA32_SYSENTER_EIP. |
2020 | | - * This does not cause SYSENTER to jump to the wrong location, because |
2021 | | - * AMD doesn't allow SYSENTER in long mode (either 32- or 64-bit). |
2022 | | - */ |
2023 | | - wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); |
2024 | | - wrmsrl_safe(MSR_IA32_SYSENTER_ESP, |
2025 | | - (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1)); |
2026 | | - wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat); |
2027 | | -#else |
2028 | | - wrmsrl(MSR_CSTAR, (unsigned long)entry_SYSCALL32_ignore); |
2029 | | - wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG); |
2030 | | - wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); |
2031 | | - wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL); |
2032 | | -#endif |
| 2016 | + if (ia32_enabled()) { |
| 2017 | + wrmsrl(MSR_CSTAR, (unsigned long)entry_SYSCALL_compat); |
| 2018 | + /* |
| 2019 | + * This only works on Intel CPUs. |
| 2020 | + * On AMD CPUs these MSRs are 32-bit, CPU truncates MSR_IA32_SYSENTER_EIP. |
| 2021 | + * This does not cause SYSENTER to jump to the wrong location, because |
| 2022 | + * AMD doesn't allow SYSENTER in long mode (either 32- or 64-bit). |
| 2023 | + */ |
| 2024 | + wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); |
| 2025 | + wrmsrl_safe(MSR_IA32_SYSENTER_ESP, |
| 2026 | + (unsigned long)(cpu_entry_stack(smp_processor_id()) + 1)); |
| 2027 | + wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)entry_SYSENTER_compat); |
| 2028 | + } else { |
| 2029 | + wrmsrl(MSR_CSTAR, (unsigned long)entry_SYSCALL32_ignore); |
| 2030 | + wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)GDT_ENTRY_INVALID_SEG); |
| 2031 | + wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); |
| 2032 | + wrmsrl_safe(MSR_IA32_SYSENTER_EIP, 0ULL); |
| 2033 | + } |
2033 | 2034 |
|
2034 | 2035 | /* |
2035 | 2036 | * Flags to clear on syscall; clear as much as possible |
|
0 commit comments