next up previous contents
Next: abort and _exit Up: <ucr/config.h> Previous: <ucr/config.h>

System Calls for Virtual Targets

For some targets, <ucr/config.h> also defines the inline functions necessary to call the host operating system. This is especially true of the virtual targets that run under Linux, although some targets have monitors that may do interesting things. The convential names of the function names for this role are call_hostX where X is the number of parameters. The functions may be inline functions, macros, or external functions in the ucr library.

For targets with system calls, a few system call numbers are defined as __SYSCALL_xxx where ``xxx'' is the conventional name of the system call. A call to linux to exit uCR would thus be:

# include <ucr/ucr.h>
call_host1(__SYSCALL_exit, 0);

Of course, in the case of exiting it is better to use the ANSI-C ``exit(int)'' library routine, but this does demonstrate the system call mechanism. Making system calls is intentionally slightly cumbersome (but not excessively so) because a real target will not have any system calls, and the call_hostX functions will NOT exist. (One notable exception is the Cyclone-911 board. This target has the mon960 monitor on board which takes some system calls.)



Stephen Williams
9/2/1997