- 论坛徽章:
- 0
|
找到一篇文章,说kvm_call_hyp()函数是为了在HYP mode下执行代码。例如,执行在SVC mode下的KVM/ARM代码可以通过下面的调用在HYP mode下无效TLB条目(第一个参数是要执行的函数名,后面的是该函数的参数)
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, kvm, ipa);
但是我看这个函数的实现似乎只是通过hvc指令切换到HYP mode,然后就返回了,什么都没调用
ENTRY(kvm_call_hyp)
hvc #0
bx lr
而且在__cpu_init_hyp_mode函数里面也两次调用kvm_call_hyp,调用的第一个参数分别是null和栈指针,并不是一个函数指针。按照PCS规则,kvm_call_hyp的三个参数分别存入r0,r1和r2,显然在函数实现中并未用到这些寄存器。
因为下面的函数涉及到KVM下的一些关键数据存储的位置,所以一直想把它搞清楚,不知哪位可以指点一下。谢谢
static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
phys_addr_t pgd_ptr,
unsigned long hyp_stack_ptr,
unsigned long vector_ptr)
{
/*
* Call initialization code, and switch to the full blown HYP
* code. The init code doesn't need to preserve these
* registers as r0-r3 are already callee saved according to
* the AAPCS.
* Note that we slightly misuse the prototype by casing the
* stack pointer to a void *.
*
* We don't have enough registers to perform the full init in
* one go. Install the boot PGD first, and then install the
* runtime PGD, stack pointer and vectors. The PGDs are always
* passed as the third argument, in order to be passed into
* r2-r3 to the init code (yes, this is compliant with the
* PCS!).
*/
kvm_call_hyp(NULL, 0, boot_pgd_ptr);
kvm_call_hyp((void*)hyp_stack_ptr, vector_ptr, pgd_ptr);
}
|
|