Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/swtch.S
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | ENTRY(cpu_throw) | ||||
/* If we were single stepping, disable it */ | /* If we were single stepping, disable it */ | ||||
ldr x4, [x0, #TD_PCB] | ldr x4, [x0, #TD_PCB] | ||||
ldr w5, [x4, #PCB_FLAGS] | ldr w5, [x4, #PCB_FLAGS] | ||||
clear_step_flag w5, x6 | clear_step_flag w5, x6 | ||||
1: | 1: | ||||
#ifdef VFP | #ifdef VFP | ||||
/* Backup the new thread pointer around a call to C code */ | /* Backup the new thread pointer around a call to C code */ | ||||
mov x19, x0 | mov x19, x1 | ||||
mov x20, x1 | |||||
bl vfp_discard | bl vfp_discard | ||||
mov x1, x20 | |||||
mov x0, x19 | mov x0, x19 | ||||
#else | |||||
mov x0, x1 | |||||
#endif | #endif | ||||
/* This returns the thread pointer so no need to save it */ | |||||
bl ptrauth_switch | |||||
/* This returns the thread pcb */ | |||||
bl pmap_switch | bl pmap_switch | ||||
mov x4, x0 | mov x4, x0 | ||||
/* 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 */ | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | ENTRY(cpu_switch) | ||||
mov x19, x0 | mov x19, x0 | ||||
mov x20, x1 | mov x20, x1 | ||||
mov x21, x2 | mov x21, x2 | ||||
#ifdef VFP | #ifdef VFP | ||||
/* Load the pcb address */ | /* Load the pcb address */ | ||||
mov x1, x4 | mov x1, x4 | ||||
bl vfp_save_state | bl vfp_save_state | ||||
mov x1, x20 | mov x0, x20 | ||||
mov x0, x19 | #else | ||||
mov x0, x1 | |||||
#endif | #endif | ||||
/* This returns the thread pointer so no need to save it */ | |||||
bl ptrauth_switch | |||||
/* 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 | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
ENTRY(fork_trampoline) | ENTRY(fork_trampoline) | ||||
mov x0, x8 | mov x0, x8 | ||||
mov x1, x9 | mov x1, x9 | ||||
mov x2, sp | mov x2, sp | ||||
mov fp, #0 /* Stack traceback stops here. */ | mov fp, #0 /* Stack traceback stops here. */ | ||||
bl _C_LABEL(fork_exit) | bl _C_LABEL(fork_exit) | ||||
/* | |||||
* Disable interrupts as we are setting userspace specific | |||||
* state that we won't handle correctly in an interrupt while | |||||
* in the kernel. | |||||
*/ | |||||
msr daifset, #2 | |||||
ldr x0, [x18, #PC_CURTHREAD] | |||||
bl ptrauth_enter_el0 | |||||
/* Restore the registers other than x0 and x1 */ | /* Restore the registers other than x0 and x1 */ | ||||
ldp x2, x3, [sp, #TF_X + 2 * 8] | ldp x2, x3, [sp, #TF_X + 2 * 8] | ||||
ldp x4, x5, [sp, #TF_X + 4 * 8] | ldp x4, x5, [sp, #TF_X + 4 * 8] | ||||
ldp x6, x7, [sp, #TF_X + 6 * 8] | ldp x6, x7, [sp, #TF_X + 6 * 8] | ||||
ldp x8, x9, [sp, #TF_X + 8 * 8] | ldp x8, x9, [sp, #TF_X + 8 * 8] | ||||
ldp x10, x11, [sp, #TF_X + 10 * 8] | ldp x10, x11, [sp, #TF_X + 10 * 8] | ||||
ldp x12, x13, [sp, #TF_X + 12 * 8] | ldp x12, x13, [sp, #TF_X + 12 * 8] | ||||
ldp x14, x15, [sp, #TF_X + 14 * 8] | ldp x14, x15, [sp, #TF_X + 14 * 8] | ||||
ldp x16, x17, [sp, #TF_X + 16 * 8] | ldp x16, x17, [sp, #TF_X + 16 * 8] | ||||
ldr x19, [sp, #TF_X + 19 * 8] | ldr x19, [sp, #TF_X + 19 * 8] | ||||
ldp x20, x21, [sp, #TF_X + 20 * 8] | ldp x20, x21, [sp, #TF_X + 20 * 8] | ||||
ldp x22, x23, [sp, #TF_X + 22 * 8] | ldp x22, x23, [sp, #TF_X + 22 * 8] | ||||
ldp x24, x25, [sp, #TF_X + 24 * 8] | ldp x24, x25, [sp, #TF_X + 24 * 8] | ||||
ldp x26, x27, [sp, #TF_X + 26 * 8] | ldp x26, x27, [sp, #TF_X + 26 * 8] | ||||
ldp x28, x29, [sp, #TF_X + 28 * 8] | ldp x28, x29, [sp, #TF_X + 28 * 8] | ||||
/* | |||||
* Disable interrupts to avoid | |||||
* overwriting spsr_el1 and sp_el0 by an IRQ exception. | |||||
*/ | |||||
msr daifset, #2 | |||||
/* Restore sp and lr */ | /* Restore sp and lr */ | ||||
ldp x0, x1, [sp, #TF_SP] | ldp x0, x1, [sp, #TF_SP] | ||||
msr sp_el0, x0 | msr sp_el0, x0 | ||||
mov lr, x1 | mov lr, x1 | ||||
/* Restore elr and spsr */ | /* Restore elr and spsr */ | ||||
ldp x0, x1, [sp, #TF_ELR] | ldp x0, x1, [sp, #TF_ELR] | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |