![Intel NIOS II Owner Reference Manual Download Page 167](http://html1.mh-extra.com/html/intel/nios-ii/nios-ii_owner-reference-manual_2071826167.webp)
7.9.6.5. Linux Initialization and Termination Functions
The implementation is responsible for calling
DT_INIT()
,
DT_INIT_ARRAY()
,
DT_PREINIT_ARRAY()
,
DT_FINI()
, and
DT_FINI_ARRAY()
.
7.9.7. Linux Conventions
7.9.7.1. 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.
7.9.7.2. Userspace Breakpoints
Userspace breakpoints are accomplished using the
trap
instruction with immediate
operand 31 (all ones). The OS must distinguish this instruction from a
trap 0
system
call and generate a
trap
signal.
7.9.7.3. Atomic Operations
The Nios II architecture does not have atomic operations (such as load linked and
store conditional). Atomic operations are emulated using a kernel system call via the
trap
instruction. The toolchain provides intrinsic functions which perform the system
call. Applications must use those functions rather than the system call directly. Atomic
operations may be added in a future processor extension.
7.9.7.4. Processor Requirements
Linux requires that a hardware multiplier be present. The full 64-bit multiplier (
mulx
instructions) is not required.
7.10. Development Environment
The following object macros are defined:
•
NIOS2
•
__NIOS2
•
__NIOS2__
•
nios2
•
__nios2
•
__nios2__
•
nios2_little_endian
•
__nios2_little_endian
•
__nios2_little_endian__
7. Application Binary Interface
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
167