diff options
Diffstat (limited to 'arch/arm64/kernel/entry.S')
-rw-r--r-- | arch/arm64/kernel/entry.S | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index db8a09331f2b..5472cedfe750 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
33 | #include <asm/thread_info.h> | 33 | #include <asm/thread_info.h> |
34 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
35 | #include <asm/asm-uaccess.h> | ||
35 | #include <asm/unistd.h> | 36 | #include <asm/unistd.h> |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -120,11 +121,9 @@ | |||
120 | * feature as all TTBR0_EL1 accesses are disabled, not just those to | 121 | * feature as all TTBR0_EL1 accesses are disabled, not just those to |
121 | * user mappings. | 122 | * user mappings. |
122 | */ | 123 | */ |
123 | alternative_if_not ARM64_HAS_PAN | 124 | alternative_if ARM64_HAS_PAN |
124 | nop | ||
125 | alternative_else | ||
126 | b 1f // skip TTBR0 PAN | 125 | b 1f // skip TTBR0 PAN |
127 | alternative_endif | 126 | alternative_else_nop_endif |
128 | 127 | ||
129 | .if \el != 0 | 128 | .if \el != 0 |
130 | mrs x21, ttbr0_el1 | 129 | mrs x21, ttbr0_el1 |
@@ -134,7 +133,7 @@ alternative_endif | |||
134 | and x23, x23, #~PSR_PAN_BIT // Clear the emulated PAN in the saved SPSR | 133 | and x23, x23, #~PSR_PAN_BIT // Clear the emulated PAN in the saved SPSR |
135 | .endif | 134 | .endif |
136 | 135 | ||
137 | uaccess_ttbr0_disable x21 | 136 | __uaccess_ttbr0_disable x21 |
138 | 1: | 137 | 1: |
139 | #endif | 138 | #endif |
140 | 139 | ||
@@ -181,17 +180,15 @@ alternative_endif | |||
181 | * Restore access to TTBR0_EL1. If returning to EL0, no need for SPSR | 180 | * Restore access to TTBR0_EL1. If returning to EL0, no need for SPSR |
182 | * PAN bit checking. | 181 | * PAN bit checking. |
183 | */ | 182 | */ |
184 | alternative_if_not ARM64_HAS_PAN | 183 | alternative_if ARM64_HAS_PAN |
185 | nop | ||
186 | alternative_else | ||
187 | b 2f // skip TTBR0 PAN | 184 | b 2f // skip TTBR0 PAN |
188 | alternative_endif | 185 | alternative_else_nop_endif |
189 | 186 | ||
190 | .if \el != 0 | 187 | .if \el != 0 |
191 | tbnz x22, #_PSR_PAN_BIT, 1f // Skip re-enabling TTBR0 access if previously disabled | 188 | tbnz x22, #22, 1f // Skip re-enabling TTBR0 access if the PSR_PAN_BIT is set |
192 | .endif | 189 | .endif |
193 | 190 | ||
194 | uaccess_ttbr0_enable x0 | 191 | __uaccess_ttbr0_enable x0 |
195 | 192 | ||
196 | .if \el == 0 | 193 | .if \el == 0 |
197 | /* | 194 | /* |
@@ -435,12 +432,13 @@ el1_da: | |||
435 | /* | 432 | /* |
436 | * Data abort handling | 433 | * Data abort handling |
437 | */ | 434 | */ |
438 | mrs x0, far_el1 | 435 | mrs x3, far_el1 |
439 | enable_dbg | 436 | enable_dbg |
440 | // re-enable interrupts if they were enabled in the aborted context | 437 | // re-enable interrupts if they were enabled in the aborted context |
441 | tbnz x23, #7, 1f // PSR_I_BIT | 438 | tbnz x23, #7, 1f // PSR_I_BIT |
442 | enable_irq | 439 | enable_irq |
443 | 1: | 440 | 1: |
441 | clear_address_tag x0, x3 | ||
444 | mov x2, sp // struct pt_regs | 442 | mov x2, sp // struct pt_regs |
445 | bl do_mem_abort | 443 | bl do_mem_abort |
446 | 444 | ||
@@ -602,7 +600,7 @@ el0_da: | |||
602 | // enable interrupts before calling the main handler | 600 | // enable interrupts before calling the main handler |
603 | enable_dbg_and_irq | 601 | enable_dbg_and_irq |
604 | ct_user_exit | 602 | ct_user_exit |
605 | bic x0, x26, #(0xff << 56) | 603 | clear_address_tag x0, x26 |
606 | mov x1, x25 | 604 | mov x1, x25 |
607 | mov x2, sp | 605 | mov x2, sp |
608 | bl do_mem_abort | 606 | bl do_mem_abort |