System calls are grouped based on the object they operate on. For example, the system calls dealing with thread manipulation are called oz_sys_thread_.... They all return an uLong status value.

In general, the system call routines can be called from either user or kernel mode. However, if called from kernel mode, the highest smplevel is softint, ie, you cannot have any spinlocks held, because most system call routines call oz_hw_cpu_setsoftint to inhibit software interrupt delivery, which will crash if the smplevel is above softint level.

There are two sets of macros associated with the declaration and definition of the syscall routines. They are defined by the hardware layer header file (oz_hw_type.h).

The OZ_HW_SYSCALL_DCL_n macros are used to declare the system call prototypes in an appropriate header file. The n is used to indicate the number of parameters of the syscall routine. The macro will declare two prototypes, one name is prefixed by oz_sys_ and the other is prefixed by oz_syscall_. The oz_sys_ is the routine that normal user mode routines should call. They can also be called from kernel mode as noted above. The oz_syscall_ routine is the kernel mode equivalent 'backend' routine.

The OZ_HW_SYSCALL_DEF_n macros are used to define the system call routines in an appropriate source file. They define both the oz_sys_ and the oz_syscall_ routine. They also define any code used to transition from the oz_sys_ routine to the kernel mode oz_syscall_ routine.

For example, in the x86 implementation: