acrn-hypervisor/hypervisor/arch/x86/sched.S
Shuo A Liu 837e4d8788 hv: sched: rename schedule related structs and vars
prepare_switch_out -> switch_out
prepare_switch_in -> switch_in
prepare_switch -> do_switch
run_thread_t -> thread_entry_t
sched_object -> thread_object
sched_object.thread -> thread_object.thread_entry
sched_obj -> thread_obj
sched_context -> sched_control
sched_ctx -> sched_ctl

Tracked-On: #3813
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: Yu Wang <yu1.wang@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-10-16 10:25:53 +08:00

42 lines
994 B
ArmAsm

/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
*
* 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