Nios® II Processor Reference Guide

ID 683836
Date 8/28/2023
Document Table of Contents System Calls

The Linux system call interface relies on the trap instruction with immediate argument zero. The system call number is passed in register r2. The arguments are passed in r4, r5, r6, r7, r8, and r9 as necessary. The return value is written in r2 on success, or a positive error number is written to r2 on failure. A flag indicating successful completion, to distinguish error values from valid results, is written to r7; 0 indicates syscall success and 1 indicates r2 contains a positive errno value.