hvc

Hypervisor Call

HVC #<imm>

Generates a Hypervisor Call exception to EL2.

Details

Hypervisor Call generates an exception to the hypervisor (EL2) and passes a 16-bit immediate value to it. The exception is synchronous and the current state is saved so the hypervisor can interpret the request. Condition flags (N, Z, C, V) are unaffected by the instruction itself. This requires AArch64 execution and can be called from EL0, EL1, or EL2.

Pseudocode Operation

exception ← HypervisorCall
ESR_ELx.ISS ← imm16
Branch to EL2 exception handler

Example

HVC #16

Encoding

Binary Layout
11010100
000
imm16
000
10
 
Format Exception
Opcode 0xD4000002
Extension System

Operands

  • imm
    ID

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xD4000002 HVC #<imm> A64 11010100 | 000 | imm16 | 000 | 10

Description

Hypervisor Call causes an exception to EL2. Software executing at EL1 can use this instruction to call the hypervisor to request a service. The HVC instruction is UNDEFINED: On executing an HVC instruction, the PE records the exception as a Hypervisor Call exception in ESR_ELx, using the EC value 0x16, and the value of the immediate argument.

Operation

if !HaveEL(EL2) || PSTATE.EL == EL0 || (PSTATE.EL == EL1 && !EL2Enabled()) then
    UNDEFINED;

bits(1) hvc_enable = if HaveEL(EL3) then SCR_EL3.HCE else NOT(HCR_EL2.HCD);

if hvc_enable == '0' then
    UNDEFINED;
else
    AArch64.CallHypervisor(imm16);