#if defined(__linux__)
#if defined(__mn10300__)

/*
 * Use Linux system call.
 */

#define SYS_exit          1
#define SYS_fork          2
#define SYS_wait4       114
#define SYS_kill         37
#define SYS_execve       11

#define SYS_read          3
#define SYS_write         4
#define SYS_open          5
#define SYS_close         6

#define SYS_dup          41
#define SYS_pipe         42
#define SYS_dup2         63
#define SYS_pipe2       332

#define SYS_sigaction    67 /* rt_sigaction is 174 */
#define SYS_sigprocmask 126 /* rt_sigprocmask is 175 */
#define SYS_sigreturn   119 /* rt_sigreturn is 173 */

#define SYS_getpid       20
#define SYS_getppid      64
#define SYS_getsid      147
#define SYS_setsid       66
#define SYS_getpgid     132
#define SYS_setpgid      57
#define SYS_getpgrp      65

#define SYS_unlink       10
#define SYS_chdir        12
#define SYS_fchdir      133
#define SYS_chmod        15
#define SYS_chown       182
#define SYS_lseek        19
#define SYS_access       33
#define SYS_sync         36
#define SYS_fcntl        55
#define SYS_fsync       118
#define SYS_fchown       95
#define SYS_fchmod       94
#define SYS_rename       38

#define SYS_mkdir        39
#define SYS_rmdir        40

#define SYS_mmap         90
#define SYS_munmap       91

#define SYS_truncate     92
#define SYS_ftruncate    93

#define SYS_select      142 /* newselect */
#define SYS_pselect     309

#define SYS_gettimeofday 78
#define SYS_settimeofday 79

#define SYS_ioctl        54
#define SYS_brk          45
#define SYS_getdents    141
#define SYS_getcwd      183

	.section .text

	.globl	____exit
	.type	____exit, @function
____exit:
	mov	SYS_exit, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fork
	.type	___fork, @function
___fork:
	mov	SYS_fork, d0
	syscall
	mov	d1, d0
	rets

	.globl	___wait4
	.type	___wait4, @function
___wait4:
	mov	SYS_wait4, d0
	syscall
	mov	d1, d0
	rets

	.globl	___kill
	.type	___kill, @function
___kill:
	mov	SYS_kill, d0
	syscall
	mov	d1, d0
	rets

	.globl	___execve
	.type	___execve, @function
___execve:
	mov	SYS_execve, d0
	syscall
	mov	d1, d0
	rets

	.globl	___read
	.type	___read, @function
___read:
	mov	SYS_read, d0
	syscall
	mov	d1, d0
	rets

	.globl	___write
	.type	___write, @function
___write:
	mov	SYS_write, d0
	syscall
	mov	d1, d0
	rets

	.globl	___open
	.type	___open, @function
___open:
	mov	SYS_open, d0
	syscall
	mov	d1, d0
	rets

	.globl	___close
	.type	___close, @function
___close:
	mov	SYS_close, d0
	syscall
	mov	d1, d0
	rets

	.globl	___dup
	.type	___dup, @function
___dup:
	mov	SYS_dup, d0
	syscall
	mov	d1, d0
	rets

	.globl	___pipe
	.type	___pipe, @function
___pipe:
	mov	SYS_pipe, d0
	syscall
	mov	d1, d0
	rets

	.globl	___dup2
	.type	___dup2, @function
___dup2:
	mov	SYS_dup2, d0
	syscall
	mov	d1, d0
	rets

	.globl	___pipe2
	.type	___pipe2, @function
___pipe2:
	mov	SYS_pipe2, d0
	syscall
	mov	d1, d0
	rets

	.globl	___sigaction
	.type	___sigaction, @function
___sigaction:
	mov	SYS_sigaction, d0
	syscall
	mov	d1, d0
	rets

	.globl	___sigprocmask
	.type	___sigprocmask, @function
___sigprocmask:
	mov	SYS_sigprocmask, d0
	syscall
	mov	d1, d0
	rets

	.globl	___sigreturn
	.type	___sigreturn, @function
___sigreturn:
	mov	SYS_sigreturn, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getpid
	.type	___getpid, @function
___getpid:
	mov	SYS_getpid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getppid
	.type	___getppid, @function
___getppid:
	mov	SYS_getppid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getsid
	.type	___getsid, @function
___getsid:
	mov	SYS_getsid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___setsid
	.type	___setsid, @function
___setsid:
	mov	SYS_setsid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getpgid
	.type	___getpgid, @function
___getpgid:
	mov	SYS_getpgid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___setpgid
	.type	___setpgid, @function
___setpgid:
	mov	SYS_setpgid, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getpgrp
	.type	___getpgrp, @function
___getpgrp:
	mov	SYS_getpgrp, d0
	syscall
	mov	d1, d0
	rets

	.globl	___unlink
	.type	___unlink, @function
___unlink:
	mov	SYS_unlink, d0
	syscall
	mov	d1, d0
	rets

	.globl	___chdir
	.type	___chdir, @function
___chdir:
	mov	SYS_chdir, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fchdir
	.type	___fchdir, @function
___fchdir:
	mov	SYS_fchdir, d0
	syscall
	mov	d1, d0
	rets

	.globl	___chmod
	.type	___chmod, @function
___chmod:
	mov	SYS_chmod, d0
	syscall
	mov	d1, d0
	rets

	.globl	___chown
	.type	___chown, @function
___chown:
	mov	SYS_chown, d0
	syscall
	mov	d1, d0
	rets

	.globl	___lseek
	.type	___lseek, @function
___lseek:
	mov	SYS_lseek, d0
	syscall
	mov	d1, d0
	rets

	.globl	___access
	.type	___access, @function
___access:
	mov	SYS_access, d0
	syscall
	mov	d1, d0
	rets

	.globl	___sync
	.type	___sync, @function
___sync:
	mov	SYS_sync, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fcntl
	.type	___fcntl, @function
___fcntl:
	mov	SYS_fcntl, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fsync
	.type	___fsync, @function
___fsync:
	mov	SYS_fsync, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fchown
	.type	___fchown, @function
___fchown:
	mov	SYS_fchown, d0
	syscall
	mov	d1, d0
	rets

	.globl	___fchmod
	.type	___fchmod, @function
___fchmod:
	mov	SYS_fchmod, d0
	syscall
	mov	d1, d0
	rets

	.globl	___rename
	.type	___rename, @function
___rename:
	mov	SYS_rename, d0
	syscall
	mov	d1, d0
	rets

	.globl	___mkdir
	.type	___mkdir, @function
___mkdir:
	mov	SYS_mkdir, d0
	syscall
	mov	d1, d0
	rets

	.globl	___rmdir
	.type	___rmdir, @function
___rmdir:
	mov	SYS_rmdir, d0
	syscall
	mov	d1, d0
	rets

	.globl	___mmap
	.type	___mmap, @function
___mmap:
	mov	SYS_mmap, d0
	syscall
	mov	d1, d0
	rets

	.globl	___munmap
	.type	___munmap, @function
___munmap:
	mov	SYS_munmap, d0
	syscall
	mov	d1, d0
	rets

	.globl	___truncate
	.type	___truncate, @function
___truncate:
	mov	SYS_truncate, d0
	syscall
	mov	d1, d0
	rets

	.globl	___ftruncate
	.type	___ftruncate, @function
___ftruncate:
	mov	SYS_ftruncate, d0
	syscall
	mov	d1, d0
	rets

	.globl	___select
	.type	___select, @function
___select:
	mov	SYS_select, d0
	syscall
	mov	d1, d0
	rets

	.globl	___pselect
	.type	___pselect, @function
___pselect:
	mov	SYS_pselect, d0
	syscall
	mov	d1, d0
	rets

	.globl	___gettimeofday
	.type	___gettimeofday, @function
___gettimeofday:
	mov	SYS_gettimeofday, d0
	syscall
	mov	d1, d0
	rets

	.globl	___settimeofday
	.type	___settimeofday, @function
___settimeofday:
	mov	SYS_settimeofday, d0
	syscall
	mov	d1, d0
	rets

	.globl	___ioctl
	.type	___ioctl, @function
___ioctl:
	mov	SYS_ioctl, d0
	syscall
	mov	d1, d0
	rets

	.globl	___brk
	.type	___brk, @function
___brk:
	mov	SYS_brk, d0
	syscall
	mov	d1, d0
	rets

	.globl	___getdents
	.type	___getdents, @function
___getdents:
	mov	SYS_getdents, d0
	syscall
	mov	d1, d0
	rets

	.globl	_____getcwd
	.type	_____getcwd, @function
_____getcwd:
	mov	SYS_getcwd, d0
	syscall
	mov	d1, d0
	rets
#endif
#endif
