Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/swtch.S
| Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | #ifdef VFP | ||||
| bl vfp_discard | bl vfp_discard | ||||
| mov x0, x19 | mov x0, x19 | ||||
| #else | #else | ||||
| mov x0, x1 | mov x0, x1 | ||||
| #endif | #endif | ||||
| /* This returns the thread pointer so no need to save it */ | /* This returns the thread pointer so no need to save it */ | ||||
| bl ptrauth_switch | bl ptrauth_switch | ||||
| #ifdef PERTHREAD_SSP | |||||
| mov x19, x0 | |||||
| #endif | |||||
| /* This returns the thread pcb */ | /* This returns the thread pcb */ | ||||
| bl pmap_switch | bl pmap_switch | ||||
| mov x4, x0 | mov x4, x0 | ||||
| #ifdef PERTHREAD_SSP | |||||
| /* Update the per-thread stack canary pointer. */ | |||||
| add x19, x19, #(TD_MD_CANARY) | |||||
| msr sp_el0, x19 | |||||
| #endif | |||||
| /* If we are single stepping, enable it */ | /* If we are single stepping, enable it */ | ||||
| ldr w5, [x4, #PCB_FLAGS] | ldr w5, [x4, #PCB_FLAGS] | ||||
| set_step_flag w5, x6 | set_step_flag w5, x6 | ||||
| /* Restore the registers */ | /* Restore the registers */ | ||||
| ldp x5, x6, [x4, #PCB_SP] | ldp x5, x6, [x4, #PCB_SP] | ||||
| mov sp, x5 | mov sp, x5 | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | #endif | ||||
| /* This returns the thread pcb */ | /* This returns the thread pcb */ | ||||
| bl pmap_switch | bl pmap_switch | ||||
| /* Move the new pcb out of the way */ | /* Move the new pcb out of the way */ | ||||
| mov x4, x0 | mov x4, x0 | ||||
| mov x2, x21 | mov x2, x21 | ||||
| mov x1, x20 | mov x1, x20 | ||||
| mov x0, x19 | mov x0, x19 | ||||
| #ifdef PERTHREAD_SSP | |||||
| /* Update the per-thread stack canary pointer. */ | |||||
| add x20, x20, #(TD_MD_CANARY) | |||||
| msr sp_el0, x20 | |||||
| #endif | |||||
| /* | /* | ||||
| * Release the old thread. | * Release the old thread. | ||||
| */ | */ | ||||
| stlr x2, [x0, #TD_LOCK] | stlr x2, [x0, #TD_LOCK] | ||||
| #if defined(SCHED_ULE) && defined(SMP) | #if defined(SCHED_ULE) && defined(SMP) | ||||
| /* Spin if TD_LOCK points to a blocked_lock */ | /* Spin if TD_LOCK points to a blocked_lock */ | ||||
| ldr x2, =_C_LABEL(blocked_lock) | ldr x2, =_C_LABEL(blocked_lock) | ||||
| ▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines | |||||