This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Enter Hypervisor Mode on ARMv7 through Kernel Module

I am trying to write a kernel module in C to bring the system in the hypervisor mode. The module is for a router, which is running OpenWrt. The architecture is ARMv7.

When I load my module with insmod I get this error when the module comes to the hvc #0 instruction:

Internal Error: Oops - undefined instruction: 0 [#1] SMP ARM

I am new to ARM and virtualization but so far I have understood that I have to do the following things before calling hvc #0

  1. I have to be in PL1(SVC) mode. Is this given when I load a kernel module instead of a normal C Program?

  2. I have to set the SCR.NS bit to 1.

  3. I have to set the SCR.HCE bit to 1.

I have not understood how to set these bits. I have read that the CPU needs to be in monitor mode for setting these bits, is this true? And how can I do this?

Can someone give me please an example in C or assembly how to prepare the system that I can execute hvc #0.

Parents
  • Hi,

    I think your question is a bit outside the scope of this specific Community subgroup (maybe better in one of the more generic areas). But...

    Do you know what ARM core you are using?

    Arch v7A includes hardware support for Hypervisors - delivered as a set of virtualization extensions. *However* not all v7-A  implementations support these extensions.

    So the HVC instruction will work with Cortex-A15, which does implement these extensions.

    But, If you tried (say) on a Cortex-A9 you'd get an undef in you tried to execute a HVC instruction.

    MarkN

Reply
  • Hi,

    I think your question is a bit outside the scope of this specific Community subgroup (maybe better in one of the more generic areas). But...

    Do you know what ARM core you are using?

    Arch v7A includes hardware support for Hypervisors - delivered as a set of virtualization extensions. *However* not all v7-A  implementations support these extensions.

    So the HVC instruction will work with Cortex-A15, which does implement these extensions.

    But, If you tried (say) on a Cortex-A9 you'd get an undef in you tried to execute a HVC instruction.

    MarkN

Children