mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
pm: use cpu_context for s3 save/restore
use structure cpu_context and update offsets in wakeup.S Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
8a95b2abdc
commit
72f9c9a26e
@ -5,7 +5,7 @@
|
|||||||
#include <hypervisor.h>
|
#include <hypervisor.h>
|
||||||
#include <reloc.h>
|
#include <reloc.h>
|
||||||
|
|
||||||
struct run_context cpu_ctx;
|
struct cpu_context cpu_ctx;
|
||||||
|
|
||||||
/* whether the host enter s3 success */
|
/* whether the host enter s3 success */
|
||||||
uint8_t host_enter_s3_success = 1U;
|
uint8_t host_enter_s3_success = 1U;
|
||||||
|
@ -68,25 +68,25 @@ __enter_s3:
|
|||||||
movq %r15, 0x78 + cpu_ctx(%rip)
|
movq %r15, 0x78 + cpu_ctx(%rip)
|
||||||
|
|
||||||
pushfq
|
pushfq
|
||||||
/*168U=0xa8=CPU_CONTEXT_OFFSET_RFLAGS*/
|
/*160U=0xa0=CPU_CONTEXT_OFFSET_RFLAGS*/
|
||||||
popq 0xa8 + cpu_ctx(%rip)
|
popq 0xa0 + cpu_ctx(%rip)
|
||||||
|
|
||||||
/*504U=0x1f8=CPU_CONTEXT_OFFSET_IDTR*/
|
/*192U=0xc0=CPU_CONTEXT_OFFSET_IDTR*/
|
||||||
sidt 0x1f8 + cpu_ctx(%rip)
|
sidt 0xc0 + cpu_ctx(%rip)
|
||||||
/*536U=0x218=CPU_CONTEXT_OFFSET_LDTR*/
|
/*216U=0xd8=CPU_CONTEXT_OFFSET_LDTR*/
|
||||||
sldt 0x218 + cpu_ctx(%rip)
|
sldt 0xd8 + cpu_ctx(%rip)
|
||||||
|
|
||||||
mov %cr0, %rax
|
mov %cr0, %rax
|
||||||
/*128U=0x80=CPU_CONTEXT_OFFSET_CR0*/
|
/*128U=0x80=CPU_CONTEXT_OFFSET_CR0*/
|
||||||
mov %rax, 0x80 + cpu_ctx(%rip)
|
mov %rax, 0x80 + cpu_ctx(%rip)
|
||||||
|
|
||||||
mov %cr3, %rax
|
mov %cr3, %rax
|
||||||
/*144U=0x90=CPU_CONTEXT_OFFSET_CR3*/
|
/*184U=0xb8=CPU_CONTEXT_OFFSET_CR3*/
|
||||||
mov %rax, 0x90 + cpu_ctx(%rip)
|
mov %rax, 0xb8 + cpu_ctx(%rip)
|
||||||
|
|
||||||
mov %cr4, %rax
|
mov %cr4, %rax
|
||||||
/*152U=0x98=CPU_CONTEXT_OFFSET_CR4*/
|
/*144U=0x90=CPU_CONTEXT_OFFSET_CR4*/
|
||||||
mov %rax, 0x98 + cpu_ctx(%rip)
|
mov %rax, 0x90 + cpu_ctx(%rip)
|
||||||
|
|
||||||
wbinvd
|
wbinvd
|
||||||
|
|
||||||
@ -113,32 +113,28 @@ __enter_s3:
|
|||||||
*/
|
*/
|
||||||
.global restore_s3_context
|
.global restore_s3_context
|
||||||
restore_s3_context:
|
restore_s3_context:
|
||||||
/*152U=0x98=CPU_CONTEXT_OFFSET_CR4*/
|
/*144U=0x90=CPU_CONTEXT_OFFSET_CR4*/
|
||||||
mov 0x98 + cpu_ctx(%rip), %rax
|
mov 0x90 + cpu_ctx(%rip), %rax
|
||||||
mov %rax, %cr4
|
mov %rax, %cr4
|
||||||
|
|
||||||
/*144U=0x90=CPU_CONTEXT_OFFSET_CR3*/
|
/*184U=0xb8=CPU_CONTEXT_OFFSET_CR3*/
|
||||||
mov 0x90 + cpu_ctx(%rip), %rax
|
mov 0xb8 + cpu_ctx(%rip), %rax
|
||||||
mov %rax, %cr3
|
mov %rax, %cr3
|
||||||
|
|
||||||
/*128U=0x80=CPU_CONTEXT_OFFSET_CR0*/
|
/*128U=0x80=CPU_CONTEXT_OFFSET_CR0*/
|
||||||
mov 0x80 + cpu_ctx(%rip), %rax
|
mov 0x80 + cpu_ctx(%rip), %rax
|
||||||
mov %rax, %cr0
|
mov %rax, %cr0
|
||||||
|
|
||||||
/*504U=0x1f8=CPU_CONTEXT_OFFSET_IDTR*/
|
/*192U=0xc0=CPU_CONTEXT_OFFSET_IDTR*/
|
||||||
lidt 0x1f8 + cpu_ctx(%rip)
|
lidt 0xc0 + cpu_ctx(%rip)
|
||||||
/*536U=0x218=CPU_CONTEXT_OFFSET_LDTR*/
|
/*216U=0xd8=CPU_CONTEXT_OFFSET_LDTR*/
|
||||||
lldt 0x218 + cpu_ctx(%rip)
|
lldt 0xd8 + cpu_ctx(%rip)
|
||||||
|
|
||||||
/*
|
/*32=0x20=CPU_CONTEXT_OFFSET_RSP*/
|
||||||
*312U=0x138=CPU_CONTEXT_OFFSET_SS
|
|
||||||
*32=0x20=CPU_CONTEXT_OFFSET_RSP
|
|
||||||
*/
|
|
||||||
mov 0x138 + cpu_ctx(%rip), %ss
|
|
||||||
movq 0x20 + cpu_ctx(%rip), %rsp
|
movq 0x20 + cpu_ctx(%rip), %rsp
|
||||||
|
|
||||||
/*168U=0xa8=CPU_CONTEXT_OFFSET_RFLAGS*/
|
/*160U=0xa0=CPU_CONTEXT_OFFSET_RFLAGS*/
|
||||||
pushq 0xa8 + cpu_ctx(%rip)
|
pushq 0xa0 + cpu_ctx(%rip)
|
||||||
popfq
|
popfq
|
||||||
|
|
||||||
call load_gdtr_and_tr
|
call load_gdtr_and_tr
|
||||||
|
Loading…
Reference in New Issue
Block a user