ISARef Multi-ISA & Silicon Reference
45,419 ISA items · 105,907 timings · 1,823 microarchs · 16,083 chips · 105 sources
Arch:
Tier:

ecall

T1 riscv system insn
Environment call
SourceRISC-V Official Unified Database (riscv-unified-db) (riscv_unified_db)
Reliability TierT1 — Official Specification
ISA / Silicon ScopeRV32/RV64 I
RV32 / RV64 (Ratified & Standard Extensions)
License & VersionApache-2.0 / CC-BY-4.0
main
Upstreamhttps://github.com/riscv/riscv-unified-db
Privilegeuser
ExtensionsI

Summary

Makes a request to the supporting execution environment. When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode exception, environment-call-from-S-mode exception, or environment-call-from-M-mode exception, respectively, and performs no other operation.

Syntax / Encoding

ecall | 00000000000000000000000001110011 (mask=0xffffffff match=0x00000073)

Binary Encodings (1)

WidthFormatBit PatternMask / Match
32RV000000000000000000000000011100110xffffffff / 0x00000073

Reference Notes

Makes a request to the supporting execution environment.
When executed in U-mode, S-mode, or M-mode, it generates an environment-call-from-U-mode
exception, environment-call-from-S-mode exception, or environment-call-from-M-mode
exception, respectively, and performs no other operation.

[NOTE]
ECALL generates a different exception for each originating privilege mode so that
environment call exceptions can be selectively delegated.
A typical use case for Unix-like operating systems is to delegate to S-mode
the environment-call-from-U-mode exception but not the others.

ECALL causes the receiving privilege mode's epc register to be set to the address of
the ECALL instruction itself, not the address of the following instruction.
As ECALL causes a synchronous exception, it is not considered to retire,
and should not increment the `minstret` CSR.