<?xml-stylesheet type="text/xsl" encoding="UTF-8" href="iform.xsl" version="1.0"?>
<!DOCTYPE instructionsection PUBLIC "-//ARM//DTD instructionsection //EN" "iform-p.dtd">
<!-- Copyright (c) 2010-2025 Arm Limited or its affiliates. All rights reserved. -->
<!-- This document is Non-Confidential. This document may only be used and distributed in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to. -->
<instructionsection id="HVC_a32" title="HVC -- AArch32" type="instruction">
  <docvars>
    <docvar key="instr-class" value="general"/>
    <docvar key="mnemonic" value="HVC"/>
  </docvars>
  <heading>HVC</heading>
  <desc>
    <brief>
      <para>Hypervisor Call</para>
    </brief>
    <authored>
      <para>Hypervisor Call causes a Hypervisor Call exception. For more
information, see <xref linkend="ARMARM_BEIBEBHJ">Hypervisor Call (HVC)
exception</xref>. Software executing at EL1 can use this
instruction to call the hypervisor to request a service.</para>
      <para>The <instruction>HVC</instruction> instruction is <arm-defined-word>UNDEFINED</arm-defined-word>:</para>
      <list type="unordered">
        <listitem>
          <content>When EL3 is implemented and using AArch64, and <register_link id="AArch64-scr_el3.xml" state="AArch64">SCR_EL3</register_link>.HCE is set to 0.</content>
        </listitem>
        <listitem>
          <content>In Non-secure EL1 modes when EL3 is implemented and using AArch32, and <xref linkend="ARMARM_AArch32.scr">SCR</xref>.HCE is set to 0.</content>
        </listitem>
        <listitem>
          <content>When EL3 is not implemented and either <register_link id="AArch64-hcr_el2.xml" state="AArch64">HCR_EL2</register_link>.HCD is set to 1 or <xref linkend="ARMARM_AArch32.hcr">HCR</xref>.HCD is set to 1.</content>
        </listitem>
        <listitem>
          <content>When EL2 is not implemented.</content>
        </listitem>
        <listitem>
          <content>In Secure state, if EL2 is not enabled in the current Security state.</content>
        </listitem>
        <listitem>
          <content>In User mode.</content>
        </listitem>
      </list>
      <para>The <instruction>HVC</instruction> instruction is <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word>
in Hyp mode when EL3 is implemented and using AArch32, and
<xref linkend="ARMARM_AArch32.scr">SCR</xref>.HCE is set to 0.</para>
      <para>On executing an <instruction>HVC</instruction> instruction, the
<xref linkend="ARMARM_AArch32.hsr">HSR, Hyp Syndrome Register</xref> reports the
exception as a Hypervisor Call exception, using the EC value
<hexnumber>0x12</hexnumber>, and captures the value of the immediate argument,
see <xref linkend="ARMARM_BEIDBEAG">Use of the HSR</xref>.</para>
    </authored>
    <encodingnotes>
      <para>For more information about the <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word> behavior of this instruction, see <xref linkend="ARMARM_CJAEGDJC">Architectural Constraints on UNPREDICTABLE behaviors</xref>.</para>
    </encodingnotes>
  </desc>
  <alias_list howmany="0"/>
  <classes>
    <classesintro count="2">
      <txt>It has encodings from the following instruction sets:</txt>
      <txt> A32 (</txt>
      <a href="#iclass_a1">A1</a>
      <txt>)</txt>
      <txt> and </txt>
      <txt> T32 (</txt>
      <a href="#iclass_t1">T1</a>
      <txt>)</txt>
      <txt>.</txt>
    </classesintro>
    <iclass name="A1" oneof="2" id="iclass_a1" no_encodings="1" isa="A32">
      <docvars>
        <docvar key="armarmheading" value="A1"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="A32"/>
        <docvar key="mnemonic" value="HVC"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A32.dp.dpmisc.except.HVC_A1" tworows="1">
        <box hibit="31" width="4" name="cond" usename="1" settings="4" constraint="!= 1111">
          <c colspan="4">!= 1111</c>
        </box>
        <box hibit="27" width="2" settings="2">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="25" width="3" settings="3">
          <c>0</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" width="2" name="opc" usename="1" settings="2" psbits="xx">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="20" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="19" width="12" name="imm12" usename="1">
          <c colspan="12"/>
        </box>
        <box hibit="7" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="6" width="3" settings="3">
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="3" width="4" name="imm4" usename="1">
          <c colspan="4"/>
        </box>
      </regdiagram>
      <encoding name="HVC_A1" oneofinclass="1" oneof="2" label="">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic" value="HVC"/>
        </docvars>
        <asmtemplate><text>HVC{</text><a hover="See x[Standard assembler syntax fields](Babbefhf). An HVC instruction must be unconditional." link="qw_option__6">&lt;q&gt;</a><text>}  {#}</text><a hover="For the &quot;A1&quot; variant: is a 16-bit unsigned immediate, in the range 0 to 65535, encoded in the &quot;imm12:imm4&quot; field. This value is for assembly and disassembly only. It is reported in the HSR but otherwise is ignored by hardware. An HVC handler might interpret imm16, for example to determine the required service." link="imm12_imm4__3">&lt;imm16&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A32.dp.dpmisc.except.HVC_A1" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if cond != '1110' then UnpredictableProcedure(); end;
let imm16 : bits(16) = imm12::imm4;</pstext></ps>
      </ps_section>
      <constrained_unpredictables encoding="A1" ps_block="Decode">
        <cu_case>
          <cu_cause>
            <pstext mayhavelinks="1">cond != '1110'</pstext></cu_cause>
          <cu_type constraint="Constraint_UNDEF"/>
          <cu_type constraint="Constraint_NOP"/>
          <cu_type constraint="Constraint_UNCOND"/>
          <cu_type constraint="Constraint_COND"/>
        </cu_case>
      </constrained_unpredictables>
    </iclass>
    <iclass name="T1" oneof="2" id="iclass_t1" no_encodings="1" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T1"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="HVC"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16x2" psname="T32.w.bcrtrl.except.HVC_T1" tworows="1">
        <box hibit="31" width="3" settings="3">
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="28" width="2" settings="2">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="26" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="25" width="4" settings="4">
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="21" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="20" name="o1" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="19" width="4" name="imm4" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="14" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="13" name="o2" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="12" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="11" width="12" name="imm12" usename="1">
          <c colspan="12"/>
        </box>
      </regdiagram>
      <encoding name="HVC_T1" oneofinclass="1" oneof="2" label="">
        <docvars>
          <docvar key="armarmheading" value="T1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="HVC"/>
        </docvars>
        <asmtemplate><text>HVC{</text><a hover="See x[Standard assembler syntax fields](Babbefhf). An HVC instruction must be unconditional." link="qw_option__6">&lt;q&gt;</a><text>}  {#}</text><a hover="For the &quot;T1&quot; variant: is a 16-bit unsigned immediate, in the range 0 to 65535, encoded in the &quot;imm4:imm12&quot; field. This value is for assembly and disassembly only. It is reported in the HSR but otherwise is ignored by hardware. An HVC handler might interpret imm16, for example to determine the required service." link="imm4_imm12__2">&lt;imm16&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.w.bcrtrl.except.HVC_T1" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let imm16 : bits(16) = imm4::imm12;
if InITBlock() then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="HVC_A1, HVC_T1" symboldefcount="1">
      <symbol link="qw_option__6">&lt;q&gt;</symbol>
      <account encodedin="">
        <intro>
          <para>See <xref linkend="Babbefhf">Standard assembler syntax fields</xref>. An <instruction>HVC</instruction> instruction must be unconditional.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="HVC_A1" symboldefcount="1">
      <symbol link="imm12_imm4__3">&lt;imm16&gt;</symbol>
      <account encodedin="(imm12 :: imm4)">
        <intro>
          <para>For the "A1" variant: is a 16-bit unsigned immediate, in the range 0 to 65535, encoded in the "imm12:imm4" field. This value is for assembly and disassembly only. It is reported in the HSR but otherwise is ignored by hardware. An HVC handler might interpret imm16, for example to determine the required service.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="HVC_T1" symboldefcount="2">
      <symbol link="imm4_imm12__2">&lt;imm16&gt;</symbol>
      <account encodedin="(imm4 :: imm12)">
        <intro>
          <para>For the "T1" variant: is a 16-bit unsigned immediate, in the range 0 to 65535, encoded in the "imm4:imm12" field. This value is for assembly and disassembly only. It is reported in the HSR but otherwise is ignored by hardware. An HVC handler might interpret imm16, for example to determine the required service.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A32.dp.dpmisc.except.HVC_A1" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">EncodingSpecificOperations();
if PSTATE.EL IN {EL0, EL3} || !EL2Enabled() then
    Undefined();
end;

var hvc_enable : bit;
if HaveEL(EL3) then
    if ELUsingAArch32(EL3) then
        if SCR().HCE == '0' &amp;&amp; PSTATE.EL == EL2 then UnpredictableProcedure(); end;
        hvc_enable = SCR().HCE;
    else
        hvc_enable = SCR_EL3().HCE;
    end;
else
    hvc_enable = if ELUsingAArch32(EL2) then NOT(HCR().HCD) else NOT(HCR_EL2().HCD);
end;

if hvc_enable == '0' then
    Undefined();
else
    AArch32_CallHypervisor(imm16);
end;</pstext></ps>
  </ps_section>
  <constrained_unpredictables ps_block="Operation">
    <cu_case>
      <cu_cause>
        <pstext mayhavelinks="1">ELUsingAArch32(EL3) &amp;&amp; SCR.HCE == '0' &amp;&amp; PSTATE.EL == EL2</pstext></cu_cause>
      <cu_type constraint="Constraint_UNDEF"/>
      <cu_type constraint="Constraint_NOP"/>
    </cu_case>
  </constrained_unpredictables>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
