@@ -47,6 +47,8 @@ __invalid:
4747 b .
4848
4949 / *
50+ * Only uses x0..x3 so as to not clobber callee - saved SMCCC registers.
51+ *
5052 * x0: SMCCC function ID
5153 * x1: struct kvm_nvhe_init_params PA
5254 * /
@@ -70,9 +72,9 @@ __do_hyp_init:
7072 eret
7173
72741 : mov x0 , x1
73- mov x4 , lr
74- bl ___kvm_hyp_init
75- mov lr , x4
75+ mov x3 , lr
76+ bl ___kvm_hyp_init // Clobbers x0..x2
77+ mov lr , x3
7678
7779 / * Hello , World! * /
7880 mov x0 , #SMCCC_RET_SUCCESS
@@ -82,8 +84,8 @@ SYM_CODE_END(__kvm_hyp_init)
8284/ *
8385 * Initialize the hypervisor in EL2.
8486 *
85- * Only uses x0..x3 so as to not clobber callee - saved SMCCC registers
86- * and leave x4 for the caller.
87+ * Only uses x0..x2 so as to not clobber callee - saved SMCCC registers
88+ * and leave x3 for the caller.
8789 *
8890 * x0: struct kvm_nvhe_init_params PA
8991 * /
@@ -112,9 +114,9 @@ alternative_else_nop_endif
112114 / *
113115 * Set the PS bits in TCR_EL2.
114116 * /
115- ldr x1 , [ x0 , #NVHE_INIT_TCR_EL2 ]
116- tcr_compute_pa_size x1 , #TCR_EL2_PS_SHIFT , x2 , x3
117- msr tcr_el2 , x1
117+ ldr x0 , [ x0 , #NVHE_INIT_TCR_EL2 ]
118+ tcr_compute_pa_size x0 , #TCR_EL2_PS_SHIFT , x1 , x2
119+ msr tcr_el2 , x0
118120
119121 isb
120122
@@ -193,7 +195,7 @@ SYM_CODE_START_LOCAL(__kvm_hyp_init_cpu)
193195
194196 / * Enable MMU , set vectors and stack. * /
195197 mov x0 , x28
196- bl ___kvm_hyp_init // Clobbers x0..x3
198+ bl ___kvm_hyp_init // Clobbers x0..x2
197199
198200 / * Leave idmap. * /
199201 mov x0 , x29
0 commit comments