swtch.S (302408) | swtch.S (317147) |
---|---|
1/*- 2 * Copyright (c) 2014 Andrew Turner 3 * Copyright (c) 2014 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * This software was developed by Andrew Turner under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#include "assym.s" 33#include "opt_kstack_pages.h" 34#include "opt_sched.h" 35 36#include <machine/asm.h> 37 | 1/*- 2 * Copyright (c) 2014 Andrew Turner 3 * Copyright (c) 2014 The FreeBSD Foundation 4 * All rights reserved. 5 * 6 * This software was developed by Andrew Turner under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#include "assym.s" 33#include "opt_kstack_pages.h" 34#include "opt_sched.h" 35 36#include <machine/asm.h> 37 |
38__FBSDID("$FreeBSD: stable/11/sys/arm64/arm64/swtch.S 297446 2016-03-31 11:07:24Z andrew $"); | 38__FBSDID("$FreeBSD: stable/11/sys/arm64/arm64/swtch.S 317147 2017-04-19 15:59:16Z andrew $"); |
39 40.macro clear_step_flag pcbflags, tmp 41 tbz \pcbflags, #PCB_SINGLE_STEP_SHIFT, 999f 42 mrs \tmp, mdscr_el1 43 bic \tmp, \tmp, #1 44 msr mdscr_el1, \tmp 45 isb 46999: --- 189 unchanged lines hidden (view full) --- 236 237ENTRY(fork_trampoline) 238 mov x0, x8 239 mov x1, x9 240 mov x2, sp 241 mov fp, #0 /* Stack traceback stops here. */ 242 bl _C_LABEL(fork_exit) 243 | 39 40.macro clear_step_flag pcbflags, tmp 41 tbz \pcbflags, #PCB_SINGLE_STEP_SHIFT, 999f 42 mrs \tmp, mdscr_el1 43 bic \tmp, \tmp, #1 44 msr mdscr_el1, \tmp 45 isb 46999: --- 189 unchanged lines hidden (view full) --- 236 237ENTRY(fork_trampoline) 238 mov x0, x8 239 mov x1, x9 240 mov x2, sp 241 mov fp, #0 /* Stack traceback stops here. */ 242 bl _C_LABEL(fork_exit) 243 |
244 /* Restore sp and lr */ 245 ldp x0, x1, [sp] 246 msr sp_el0, x0 247 mov lr, x1 248 | |
249 /* Restore the registers other than x0 and x1 */ 250 ldp x2, x3, [sp, #TF_X + 2 * 8] 251 ldp x4, x5, [sp, #TF_X + 4 * 8] 252 ldp x6, x7, [sp, #TF_X + 6 * 8] 253 ldp x8, x9, [sp, #TF_X + 8 * 8] 254 ldp x10, x11, [sp, #TF_X + 10 * 8] 255 ldp x12, x13, [sp, #TF_X + 12 * 8] 256 ldp x14, x15, [sp, #TF_X + 14 * 8] 257 ldp x16, x17, [sp, #TF_X + 16 * 8] 258 ldr x19, [sp, #TF_X + 19 * 8] 259 ldp x20, x21, [sp, #TF_X + 20 * 8] 260 ldp x22, x23, [sp, #TF_X + 22 * 8] 261 ldp x24, x25, [sp, #TF_X + 24 * 8] 262 ldp x26, x27, [sp, #TF_X + 26 * 8] 263 ldp x28, x29, [sp, #TF_X + 28 * 8] | 244 /* Restore the registers other than x0 and x1 */ 245 ldp x2, x3, [sp, #TF_X + 2 * 8] 246 ldp x4, x5, [sp, #TF_X + 4 * 8] 247 ldp x6, x7, [sp, #TF_X + 6 * 8] 248 ldp x8, x9, [sp, #TF_X + 8 * 8] 249 ldp x10, x11, [sp, #TF_X + 10 * 8] 250 ldp x12, x13, [sp, #TF_X + 12 * 8] 251 ldp x14, x15, [sp, #TF_X + 14 * 8] 252 ldp x16, x17, [sp, #TF_X + 16 * 8] 253 ldr x19, [sp, #TF_X + 19 * 8] 254 ldp x20, x21, [sp, #TF_X + 20 * 8] 255 ldp x22, x23, [sp, #TF_X + 22 * 8] 256 ldp x24, x25, [sp, #TF_X + 24 * 8] 257 ldp x26, x27, [sp, #TF_X + 26 * 8] 258 ldp x28, x29, [sp, #TF_X + 28 * 8] |
264 /* Skip x30 as it was restored above as lr */ | |
265 266 /* 267 * Disable interrupts to avoid | 259 260 /* 261 * Disable interrupts to avoid |
268 * overwriting spsr_el1 by an IRQ exception. | 262 * overwriting spsr_el1 and sp_el0 by an IRQ exception. |
269 */ 270 msr daifset, #2 271 | 263 */ 264 msr daifset, #2 265 |
266 /* Restore sp and lr */ 267 ldp x0, x1, [sp] 268 msr sp_el0, x0 269 mov lr, x1 270 |
|
272 /* Restore elr and spsr */ 273 ldp x0, x1, [sp, #16] 274 msr elr_el1, x0 275 msr spsr_el1, x1 276 277 /* Finally x0 and x1 */ 278 ldp x0, x1, [sp, #TF_X + 0 * 8] 279 ldr x18, [sp, #TF_X + 18 * 8] --- 40 unchanged lines hidden --- | 271 /* Restore elr and spsr */ 272 ldp x0, x1, [sp, #16] 273 msr elr_el1, x0 274 msr spsr_el1, x1 275 276 /* Finally x0 and x1 */ 277 ldp x0, x1, [sp, #TF_X + 0 * 8] 278 ldr x18, [sp, #TF_X + 18 * 8] --- 40 unchanged lines hidden --- |