|
22 | 22 | #include <asm/kernel-pgtable.h> |
23 | 23 | #include <asm/sysreg.h> |
24 | 24 |
|
25 | | -#ifndef __ASSEMBLY__ |
26 | | - |
27 | 25 | /* |
28 | 26 | * User space memory access functions |
29 | 27 | */ |
@@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count); |
424 | 422 | extern __must_check long strlen_user(const char __user *str); |
425 | 423 | extern __must_check long strnlen_user(const char __user *str, long n); |
426 | 424 |
|
427 | | -#else /* __ASSEMBLY__ */ |
428 | | - |
429 | | -#include <asm/assembler.h> |
430 | | - |
431 | | -/* |
432 | | - * User access enabling/disabling macros. |
433 | | - */ |
434 | | -#ifdef CONFIG_ARM64_SW_TTBR0_PAN |
435 | | - .macro __uaccess_ttbr0_disable, tmp1 |
436 | | - mrs \tmp1, ttbr1_el1 // swapper_pg_dir |
437 | | - add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir |
438 | | - msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1 |
439 | | - isb |
440 | | - .endm |
441 | | - |
442 | | - .macro __uaccess_ttbr0_enable, tmp1 |
443 | | - get_thread_info \tmp1 |
444 | | - ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1 |
445 | | - msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1 |
446 | | - isb |
447 | | - .endm |
448 | | - |
449 | | - .macro uaccess_ttbr0_disable, tmp1 |
450 | | -alternative_if_not ARM64_HAS_PAN |
451 | | - __uaccess_ttbr0_disable \tmp1 |
452 | | -alternative_else_nop_endif |
453 | | - .endm |
454 | | - |
455 | | - .macro uaccess_ttbr0_enable, tmp1, tmp2 |
456 | | -alternative_if_not ARM64_HAS_PAN |
457 | | - save_and_disable_irq \tmp2 // avoid preemption |
458 | | - __uaccess_ttbr0_enable \tmp1 |
459 | | - restore_irq \tmp2 |
460 | | -alternative_else_nop_endif |
461 | | - .endm |
462 | | -#else |
463 | | - .macro uaccess_ttbr0_disable, tmp1 |
464 | | - .endm |
465 | | - |
466 | | - .macro uaccess_ttbr0_enable, tmp1, tmp2 |
467 | | - .endm |
468 | | -#endif |
469 | | - |
470 | | -/* |
471 | | - * These macros are no-ops when UAO is present. |
472 | | - */ |
473 | | - .macro uaccess_disable_not_uao, tmp1 |
474 | | - uaccess_ttbr0_disable \tmp1 |
475 | | -alternative_if ARM64_ALT_PAN_NOT_UAO |
476 | | - SET_PSTATE_PAN(1) |
477 | | -alternative_else_nop_endif |
478 | | - .endm |
479 | | - |
480 | | - .macro uaccess_enable_not_uao, tmp1, tmp2 |
481 | | - uaccess_ttbr0_enable \tmp1, \tmp2 |
482 | | -alternative_if ARM64_ALT_PAN_NOT_UAO |
483 | | - SET_PSTATE_PAN(0) |
484 | | -alternative_else_nop_endif |
485 | | - .endm |
486 | | - |
487 | | -#endif /* __ASSEMBLY__ */ |
488 | | - |
489 | 425 | #endif /* __ASM_UACCESS_H */ |
0 commit comments