On 2 August 2012 05:04, Lei Wen adrian.wenl@gmail.com wrote:
Hi Peter,
I'm current studying the kvm and its bootwrapper code, and find a confused point, hoping to get a answer here.
Marc Z is currently working on the kernel entry code for KVM and probably has a better current understanding of this than I do; cc'd.
First I quote words from ARM virt extension spec, it says: "When in Hyp Mode: An MSR instruction which attempts to modify the CSPR.M bits is UNPREDICTABLE, except in Debug state."
While in bootwrapper, I see code would set cpu into hyp mode and launch the kernel. In kernel booting stage, it would first set the cpu mode to SVC in the start of arch/arm/kernel/head.S. And the most important is the kernel set cpu mode by directly using the MSR method which is forbidden by the virt extension spec...
So here is my question:
- Could the kernel set SVC behavior lead to any issue?
- And could we set the cpu into SVC in bootwrapper before launch the kernel?
I tried to switch to SVC before launching kernel by insert a SVC entry in hyp vector table, and copy the desired mode into spsr first then call the eret instruction. However the bootwarpper seems get hang there and I didn't figure out why...
-- PMM