@@ -61,21 +61,24 @@ SYM_CODE_START_NOALIGN(relocate_kernel)
61
61
pushq %r15
62
62
pushf
63
63
64
- movq %rsp , saved_rsp(%rip )
65
- movq %cr0 , %rax
66
- movq %rax , saved_cr0(%rip )
67
- movq %cr3 , %rax
68
- movq %rax , saved_cr3(%rip )
69
- movq %cr4 , %rax
70
- movq %rax , saved_cr4(%rip )
71
-
72
- /* Save CR4. Required to enable the right paging mode later. */
73
- movq %rax , %r13
74
-
75
64
/* zero out flags, and disable interrupts */
76
65
pushq $0
77
66
popfq
78
67
68
+ /* Switch to the identity mapped page tables */
69
+ movq %cr3 , %rax
70
+ movq kexec_pa_table_page(%rip ), %r9
71
+ movq %r9 , %cr3
72
+
73
+ /* Save %rsp and CRs. */
74
+ movq %rsp , saved_rsp(%rip )
75
+ movq %rax , saved_cr3(%rip )
76
+ movq %cr0 , %rax
77
+ movq %rax , saved_cr0(%rip )
78
+ /* Leave CR4 in %r13 to enable the right paging mode later. */
79
+ movq %cr4 , %r13
80
+ movq %r13 , saved_cr4(%rip )
81
+
79
82
/* Save SME active flag */
80
83
movq %r8 , %r12
81
84
@@ -85,10 +88,6 @@ SYM_CODE_START_NOALIGN(relocate_kernel)
85
88
/* Save the preserve_context to %r11 as swap_pages clobbers %rcx. */
86
89
movq %rcx , %r11
87
90
88
- /* Switch to the identity mapped page tables */
89
- movq kexec_pa_table_page(%rip ), %r9
90
- movq %r9 , %cr3
91
-
92
91
/* Physical address of control page */
93
92
movq %rsi , %r8
94
93
0 commit comments