sc

System Call

sc LEV

Provides the means by which a program can call upon the system to perform a service.

Encoding

Binary Layout
17
0:5
/
6:10
/
11:15
/
16:19
LEV
20:26
/
27:30
1
31
 
Format SC-form
Opcode 0x44000002
Extension Base

Operands

  • LEV
    Level (0=OS, 1=Hypervisor)

Example

sc 0

Registers Altered

SRR0, SRR1, MSR

Related

Across architectures

System Call : how x86, ARM, RISC-V, and PowerISA each do this.

More in Base

Reference

Description

Triggers a system call, transferring control to the operating system (LEV=0) or hypervisor (LEV=1). The instruction is privileged; attempting to execute it in user mode or with an invalid LEV value may cause an exception. The LEV field indicates the target privilege level for the service request.

Operation

if LEV = 0 then
  SyscallOS()
else if LEV = 1 then
  SyscallHypervisor()
else
  raise exception

Extended Mnemonics

Extended Mnemonic Equivalent Instruction

Programming Note

Executing this instruction with LEV=1 or LEV=2 is the only way that executing an instruction can cause a transition from non-hypervisor state to hypervisor state on the thread that executed the instruction. Executing this instruction with LEV=2 when SMFCTRLE=1 is the only way that executing an instruction can cause a transition from non-ultravisor state to ultravisor state on the thread that executed the instruction. In correct use, this instruction is used to 'call up' one privilege level (application program calls operating system, operating system calls hypervisor, hypervisor calls ultravisor). However, it is possible for a program to call up more than one level (e.g., for an application program to call the hypervisor). An attempt to call up more than one level should be considered a programming error.