|
61 | 61 |
|
62 | 62 | /*
|
63 | 63 | * Both ptrauth_switch_to_guest and ptrauth_switch_to_host macros will
|
64 |
| - * check for the presence of one of the cpufeature flag |
65 |
| - * ARM64_HAS_ADDRESS_AUTH_ARCH or ARM64_HAS_ADDRESS_AUTH_IMP_DEF and |
| 64 | + * check for the presence ARM64_HAS_ADDRESS_AUTH, which is defined as |
| 65 | + * (ARM64_HAS_ADDRESS_AUTH_ARCH || ARM64_HAS_ADDRESS_AUTH_IMP_DEF) and |
66 | 66 | * then proceed ahead with the save/restore of Pointer Authentication
|
67 |
| - * key registers. |
| 67 | + * key registers if enabled for the guest. |
68 | 68 | */
|
69 | 69 | .macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3
|
70 |
| -alternative_if ARM64_HAS_ADDRESS_AUTH_ARCH |
71 |
| - b 1000f |
| 70 | +alternative_if_not ARM64_HAS_ADDRESS_AUTH |
| 71 | + b .L__skip_switch\@ |
72 | 72 | alternative_else_nop_endif
|
73 |
| -alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF |
74 |
| - b 1001f |
75 |
| -alternative_else_nop_endif |
76 |
| -1000: |
77 | 73 | mrs \reg1, hcr_el2
|
78 | 74 | and \reg1, \reg1, #(HCR_API | HCR_APK)
|
79 |
| - cbz \reg1, 1001f |
| 75 | + cbz \reg1, .L__skip_switch\@ |
80 | 76 | add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
|
81 | 77 | ptrauth_restore_state \reg1, \reg2, \reg3
|
82 |
| -1001: |
| 78 | +.L__skip_switch\@: |
83 | 79 | .endm
|
84 | 80 |
|
85 | 81 | .macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3
|
86 |
| -alternative_if ARM64_HAS_ADDRESS_AUTH_ARCH |
87 |
| - b 2000f |
88 |
| -alternative_else_nop_endif |
89 |
| -alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF |
90 |
| - b 2001f |
| 82 | +alternative_if_not ARM64_HAS_ADDRESS_AUTH |
| 83 | + b .L__skip_switch\@ |
91 | 84 | alternative_else_nop_endif
|
92 |
| -2000: |
93 | 85 | mrs \reg1, hcr_el2
|
94 | 86 | and \reg1, \reg1, #(HCR_API | HCR_APK)
|
95 |
| - cbz \reg1, 2001f |
| 87 | + cbz \reg1, .L__skip_switch\@ |
96 | 88 | add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
|
97 | 89 | ptrauth_save_state \reg1, \reg2, \reg3
|
98 | 90 | add \reg1, \h_ctxt, #CPU_APIAKEYLO_EL1
|
99 | 91 | ptrauth_restore_state \reg1, \reg2, \reg3
|
100 | 92 | isb
|
101 |
| -2001: |
| 93 | +.L__skip_switch\@: |
102 | 94 | .endm
|
103 | 95 |
|
104 | 96 | #else /* !CONFIG_ARM64_PTR_AUTH */
|
|
0 commit comments