acrn-hypervisor/hypervisor/arch/x86/sched.S
Ziheng Li eb8bcb06b3 Update copyright year range in code headers
Modified the copyright year range in code, and corrected "int32_tel"
into "Intel" in two "hypervisor/include/debug/profiling.h" and
"hypervisor/include/debug/profiling_internal.h".

Tracked-On: #7559
Signed-off-by: Ziheng Li <ziheng.li@intel.com>
2022-07-15 11:48:35 +08:00

42 lines
978 B
ArmAsm

/*
* Copyright (C) 2019-2022 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* Function schedule() will finally call arch_switch_to here for x86 platform, which use
* the pointer of previous & next thread_obj->host_sp as the input parameters (rdi & rsi).
*
* Function arch_switch_to will save rflags, rbx, rbp, r12~r15, and rdi in the previous
* thread_obj's stack, then switch stack pointer(rsp) from previous to next thread_obj (saved
* in thread_obj->host_sp) and restore above registers from next thread_obj's stack.
* It make sure the execution context return to the same point of next thread_obj when it got
* scheduled last time.
*/
.text
.code64
.align 8
.global arch_switch_to
arch_switch_to:
pushf
pushq %rbx
pushq %rbp
pushq %r12
pushq %r13
pushq %r14
pushq %r15
pushq %rdi
movq %rsp, (%rdi)
movq (%rsi), %rsp
popq %rdi
popq %r15
popq %r14
popq %r13
popq %r12
popq %rbp
popq %rbx
popf
retq