svn commit: r211796 - projects/arm_eabi/sys/compat/arm

Andrew Turner andrew at FreeBSD.org
Wed Aug 25 07:24:52 UTC 2010


Author: andrew
Date: Wed Aug 25 07:24:52 2010
New Revision: 211796
URL: http://svn.freebsd.org/changeset/base/211796

Log:
  Add the start of the OABI syscalls. These will be used when the kernel is
  built for EABI but the userland is built for OABI.
  
  The syscalls that have been implemented allow me boot FreeBSD into
  multi-user mode and allow me to log in. Not all syscalls that need to be
  implemented have been yet.

Added:
  projects/arm_eabi/sys/compat/arm/
  projects/arm_eabi/sys/compat/arm/Makefile   (contents, props changed)
  projects/arm_eabi/sys/compat/arm/freebsd_oabi.h   (contents, props changed)
  projects/arm_eabi/sys/compat/arm/freebsd_oabi_misc.c   (contents, props changed)
  projects/arm_eabi/sys/compat/arm/syscalls.conf   (contents, props changed)
  projects/arm_eabi/sys/compat/arm/syscalls.master   (contents, props changed)

Added: projects/arm_eabi/sys/compat/arm/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/compat/arm/Makefile	Wed Aug 25 07:24:52 2010	(r211796)
@@ -0,0 +1,21 @@
+# Makefile for syscall tables
+#
+# $FreeBSD$
+
+all:
+	@echo "make sysent only"
+
+sysent:  freebsd_oabi_sysent.c freebsd_oabi_syscall.h freebsd_oabi_proto.h
+
+freebsd_oabi_sysent.c freebsd_oabi_syscalls.c freebsd_oabi_syscall.h \
+freebsd_oabi_proto.h: \
+	    ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+	-mv -f freebsd_oabi_sysent.c freebsd_oabi_sysent.c.bak
+	-mv -f freebsd_oabi_syscalls.c freebsd_oabi_syscalls.c.bak
+	-mv -f freebsd_oabi_syscall.h freebsd_oabi_syscall.h.bak
+	-mv -f freebsd_oabi_proto.h freebsd_oabi_proto.h.bak
+	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+
+clean:
+	rm -f freebsd_oabi_sysent.c freebsd_oabi_syscalls.c
+	rm -f freebsd_oabi_syscall.h freebsd_oabi_proto.h

Added: projects/arm_eabi/sys/compat/arm/freebsd_oabi.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/compat/arm/freebsd_oabi.h	Wed Aug 25 07:24:52 2010	(r211796)
@@ -0,0 +1,141 @@
+/*-
+ * Copyright (c) 2001 Doug Rabson
+ * Copyright (C) 2010 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ */
+
+#ifndef _COMPAT_ARM_FREEBSD_OABI_H_
+#define _COMPAT_ARM_FREEBSD_OABI_H_
+
+#define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
+
+#define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32))
+
+/* Copy an 64 bit type split into two 32 bit argunemts, e.g. off_t */
+#define CP64(src,dst,fld) do {				\
+	(dst).fld = (src).fld ## 1;			\
+	(dst).fld |= ((uint64_t)(src).fld ## 2) << 32;	\
+} while (0)
+
+struct timeval_oabi {
+        time_t          tv_sec;
+        suseconds_t     tv_usec;
+} __packed;
+#define TV_CP(src,dst,fld) do {			\
+	CP((src).fld,(dst).fld,tv_sec);		\
+	CP((src).fld,(dst).fld,tv_usec);	\
+} while (0)
+
+struct itimerval_oabi {
+	struct timeval_oabi it_interval;
+	struct timeval_oabi it_value;
+};
+
+struct timespec_oabi {
+	time_t	tv_sec;
+	long	tv_nsec;
+} __packed;
+#define TS_CP(src,dst,fld) do {			\
+	CP((src).fld,(dst).fld,tv_sec);		\
+	CP((src).fld,(dst).fld,tv_nsec);	\
+} while (0);
+
+struct rusage_oabi {
+	struct timeval_oabi ru_utime;
+	struct timeval_oabi ru_stime;
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+} __packed;
+
+struct stat_oabi {
+	__dev_t	  st_dev;
+	ino_t	  st_ino;
+	mode_t	  st_mode;
+	nlink_t	  st_nlink;
+	uid_t	  st_uid;
+	gid_t	  st_gid;
+	__dev_t	  st_rdev;
+	struct timespec_oabi st_atim;
+	struct timespec_oabi st_mtim;
+	struct timespec_oabi st_ctim;
+	off_t	  st_size;
+	blkcnt_t  st_blocks;
+	blksize_t st_blksize;
+	fflags_t  st_flags;
+	__uint32_t st_gen;
+	__int32_t st_lspare;
+	struct timespec_oabi st_birthtim;
+	unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec_oabi));
+	unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec_oabi));
+} __packed;
+
+struct __aiocb_private {
+	long	status;
+	long	error;
+	void	*kernelinfo;
+};
+
+struct aiocb_oabi {
+	int	aio_fildes;
+	off_t	aio_offset;
+	volatile void *aio_buf;
+	size_t	aio_nbytes;
+	int	__spare__[2];
+	void	*__spare2__;
+	int	aio_lio_opcode;
+	int	aio_reqprio;
+	struct	__aiocb_private	_aiocb_private;
+	struct	sigevent aio_sigevent;
+} __packed;
+
+struct msqid_ds_oabi {
+	struct	ipc_perm msg_perm;	/* msg queue permission bits */
+	struct	msg *msg_first;	/* first message in the queue */
+	struct	msg *msg_last;	/* last message in the queue */
+	msglen_t msg_cbytes;	/* number of bytes in use on the queue */
+	msgqnum_t msg_qnum;	/* number of msgs in the queue */
+	msglen_t msg_qbytes;	/* max # of bytes on the queue */
+	pid_t	msg_lspid;	/* pid of last msgsnd() */
+	pid_t	msg_lrpid;	/* pid of last msgrcv() */
+	time_t	msg_stime;	/* time of last msgsnd() */
+	time_t	msg_rtime;	/* time of last msgrcv() */
+	time_t	msg_ctime;	/* time of last msgctl() */
+} __packed;
+
+#endif /* _COMPAT_ARM_FREEBSD_OABI_H_ */

Added: projects/arm_eabi/sys/compat/arm/freebsd_oabi_misc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/compat/arm/freebsd_oabi_misc.c	Wed Aug 25 07:24:52 2010	(r211796)
@@ -0,0 +1,540 @@
+/*-
+ * Copyright (c) 2002 Doug Rabson
+ * Copyright (C) 2010 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_compat.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/clock.h>
+#include <sys/exec.h>
+#include <sys/fcntl.h>
+#include <sys/filedesc.h>
+#include <sys/imgact.h>
+#include <sys/jail.h>
+#include <sys/kernel.h>
+#include <sys/limits.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/file.h>		/* Must come after sys/malloc.h */
+#include <sys/imgact.h>
+#include <sys/mbuf.h>
+#include <sys/mman.h>
+#include <sys/module.h>
+#include <sys/mount.h>
+#include <sys/mqueue.h>
+#include <sys/mutex.h>
+#include <sys/namei.h>
+#include <sys/proc.h>
+#include <sys/reboot.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
+#include <sys/selinfo.h>
+#include <sys/eventvar.h>	/* Must come after sys/selinfo.h */
+#include <sys/pipe.h>		/* Must come after sys/selinfo.h */
+#include <sys/signal.h>
+#include <sys/signalvar.h>
+#include <sys/socket.h>
+#include <sys/socketvar.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/syscallsubr.h>
+#include <sys/sysctl.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+#include <sys/systm.h>
+#include <sys/thr.h>
+#include <sys/unistd.h>
+#include <sys/ucontext.h>
+#include <sys/vnode.h>
+#include <sys/wait.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+
+#ifdef INET
+#include <netinet/in.h>
+#endif
+
+#include <vm/vm.h>
+#include <vm/vm_param.h>
+#include <vm/pmap.h>
+#include <vm/vm_map.h>
+#include <vm/vm_object.h>
+#include <vm/vm_extern.h>
+
+#include <machine/cpu.h>
+#include <machine/elf.h>
+
+#include <security/audit/audit.h>
+
+#include <compat/arm/freebsd_oabi.h>
+#include <compat/arm/freebsd_oabi_proto.h>
+
+CTASSERT(sizeof(struct aiocb_oabi) == 96);
+CTASSERT(sizeof(fd_set) == 128);
+CTASSERT(sizeof(struct fhandle) == 28);
+CTASSERT(sizeof(struct iovec) == 8);
+CTASSERT(sizeof(struct itimerval_oabi) == 24);
+CTASSERT(sizeof(struct jail) == 32);
+CTASSERT(sizeof(struct kevent) == 20);
+CTASSERT(sizeof(struct mq_attr) == 32);
+CTASSERT(sizeof(struct msqid_ds_oabi) == 76);
+CTASSERT(sizeof(struct msghdr) == 28);
+CTASSERT(sizeof(struct sf_hdtr) == 16);
+CTASSERT(sizeof(sigset_t) == 16);
+CTASSERT(sizeof(struct sigaltstack) == 12);
+CTASSERT(sizeof(struct sigvec) == 12);
+CTASSERT(sizeof(struct sockaddr) == 16);
+CTASSERT(sizeof(struct stat_oabi) == 108);
+CTASSERT(sizeof(struct statfs) == 472);
+CTASSERT(sizeof(struct thr_param) == 52);
+CTASSERT(sizeof(struct rusage_oabi) == 80);
+CTASSERT(sizeof(struct sigaction) == 24);
+CTASSERT(sizeof(struct timespec) == 12);
+CTASSERT(sizeof(struct timeval_oabi) == 12);
+CTASSERT(sizeof(struct timezone) == 8);
+
+static void copy_rusage(const struct rusage *, struct rusage_oabi *);
+static void copy_stat( struct stat *in, struct stat_oabi *out);
+
+static void
+copy_rusage(const struct rusage *s, struct rusage_oabi *s_oabi)
+{
+
+	TV_CP(*s, *s_oabi, ru_utime);
+	TV_CP(*s, *s_oabi, ru_stime);
+	CP(*s, *s_oabi, ru_maxrss);
+	CP(*s, *s_oabi, ru_ixrss);
+	CP(*s, *s_oabi, ru_idrss);
+	CP(*s, *s_oabi, ru_isrss);
+	CP(*s, *s_oabi, ru_minflt);
+	CP(*s, *s_oabi, ru_majflt);
+	CP(*s, *s_oabi, ru_nswap);
+	CP(*s, *s_oabi, ru_inblock);
+	CP(*s, *s_oabi, ru_oublock);
+	CP(*s, *s_oabi, ru_msgsnd);
+	CP(*s, *s_oabi, ru_msgrcv);
+	CP(*s, *s_oabi, ru_nsignals);
+	CP(*s, *s_oabi, ru_nvcsw);
+	CP(*s, *s_oabi, ru_nivcsw);
+}
+int
+freebsd_oabi_wait4(struct thread *td, struct freebsd_oabi_wait4_args *uap)
+{
+	struct rusage_oabi ru_oabi;
+	struct rusage ru, *rup;
+	int error, status;
+
+	if (uap->rusage != NULL)
+		rup = &ru;
+	else
+		rup = NULL;
+	error = kern_wait(td, uap->pid, &status, uap->options, rup);
+	if (uap->status != NULL && error == 0)
+		error = copyout(&status, uap->status, sizeof(status));
+	if (uap->rusage != NULL && error == 0) {
+		copy_rusage(&ru, &ru_oabi);
+		error = copyout(&ru_oabi, uap->rusage, sizeof(ru_oabi));
+	}
+	return (error);
+}
+
+int
+freebsd_oabi_getitimer(struct thread *td, struct freebsd_oabi_getitimer_args *uap)
+{
+	struct itimerval aitv;
+	struct itimerval_oabi aitv_oabi;
+	int error;
+
+	error = kern_getitimer(td, uap->which, &aitv);
+	if (error != 0)
+		return (error);
+	TV_CP(aitv, aitv_oabi, it_interval);
+	TV_CP(aitv, aitv_oabi, it_value);
+	return (copyout(&aitv_oabi, uap->itv, sizeof (struct itimerval_oabi)));
+}
+
+int
+freebsd_oabi_setitimer(struct thread *td, struct freebsd_oabi_setitimer_args *uap)
+{
+	struct itimerval aitv, oitv;
+	struct itimerval_oabi aitv_oabi, oitv_oabi;
+	int error;
+
+	if (uap->itv == NULL) {
+		uap->itv = uap->oitv;
+		return (freebsd_oabi_getitimer(td,
+		    (struct freebsd_oabi_getitimer_args *)uap));
+	}
+
+	if ((error = copyin(uap->itv, &aitv_oabi,
+	    sizeof(struct itimerval_oabi))))
+		return (error);
+	TV_CP(aitv_oabi, aitv, it_interval);
+	TV_CP(aitv_oabi, aitv, it_value);
+
+	error = kern_setitimer(td, uap->which, &aitv, &oitv);
+	if (error != 0 || uap->oitv == NULL)
+		return (error);
+
+	TV_CP(oitv, oitv_oabi, it_interval);
+	TV_CP(oitv, oitv_oabi, it_value);
+	return (copyout(&oitv_oabi, uap->oitv, sizeof(struct itimerval_oabi)));
+}
+
+int
+freebsd_oabi_select(struct thread *td, struct freebsd_oabi_select_args *uap)
+{
+	struct timeval tv, *tvp;
+	struct timeval_oabi tv_oabi;
+	int error;
+
+	if (uap->tv != NULL) {
+		error = copyin(uap->tv, &tv_oabi, sizeof(tv_oabi));
+		if (error)
+			return (error);
+		CP(tv_oabi, tv, tv_sec);
+		CP(tv_oabi, tv, tv_usec);
+		tvp = &tv;
+	} else
+		tvp = NULL;
+
+	return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp,
+	    NFDBITS));
+}
+
+int
+freebsd_oabi_gettimeofday(struct thread *td,
+    struct freebsd_oabi_gettimeofday_args *uap)
+{
+	struct timeval atv;
+	struct timeval_oabi atv_oabi;
+	struct timezone rtz;
+	int error = 0;
+
+	if (uap->tp) {
+		microtime(&atv);
+		CP(atv, atv_oabi, tv_sec);
+		CP(atv, atv_oabi, tv_usec);
+		error = copyout(&atv_oabi, uap->tp, sizeof (atv_oabi));
+	}
+	if (error == 0 && uap->tzp != NULL) {
+		rtz.tz_minuteswest = tz_minuteswest;
+		rtz.tz_dsttime = tz_dsttime;
+		error = copyout(&rtz, uap->tzp, sizeof (rtz));
+	}
+	return (error);
+}
+
+int
+freebsd_oabi_settimeofday(struct thread *td,
+		       struct freebsd_oabi_settimeofday_args *uap)
+{
+	struct timeval atv, *tvp;
+	struct timeval_oabi atv_oabi;
+	struct timezone atz, *tzp;
+	int error;
+
+	if (uap->tv) {
+		error = copyin(uap->tv, &atv_oabi, sizeof(atv_oabi));
+		if (error)
+			return (error);
+		CP(atv_oabi, atv, tv_sec);
+		CP(atv_oabi, atv, tv_usec);
+		tvp = &atv;
+	} else
+		tvp = NULL;
+	if (uap->tzp) {
+		error = copyin(uap->tzp, &atz, sizeof(atz));
+		if (error)
+			return (error);
+		tzp = &atz;
+	} else
+		tzp = NULL;
+	return (kern_settimeofday(td, tvp, tzp));
+}
+
+int
+freebsd_oabi_getrusage(struct thread *td, struct freebsd_oabi_getrusage_args *uap)
+{
+	struct rusage_oabi ru_oabi;
+	struct rusage ru;
+	int error;
+
+	error = kern_getrusage(td, uap->who, &ru);
+	if (error == 0) {
+		copy_rusage(&ru, &ru_oabi);
+		error = copyout(&ru_oabi, uap->rusage,
+		    sizeof(struct rusage_oabi));
+	}
+	return (error);
+}
+
+int
+freebsd_oabi_utimes(struct thread *td, struct freebsd_oabi_utimes_args *uap)
+{
+	panic("freebsd_oabi_utimes");
+}
+
+int
+freebsd_oabi_lutimes(struct thread *td, struct freebsd_oabi_lutimes_args *uap)
+{
+	panic("freebsd_oabi_lutimes");
+}
+
+int
+freebsd_oabi_futimes(struct thread *td, struct freebsd_oabi_futimes_args *uap)
+{
+	panic("freebsd_oabi_futimes");
+}
+
+int
+freebsd_oabi_futimesat(struct thread *td, struct freebsd_oabi_futimesat_args *uap)
+{
+	panic("freebsd_oabi_futimesat");
+}
+
+int
+freebsd_oabi_adjtime(struct thread *td, struct freebsd_oabi_adjtime_args *uap)
+{
+	panic("freebsd_oabi_adjtime");
+}
+
+int
+freebsd_oabi_preadv(struct thread *td, struct freebsd_oabi_preadv_args *uap)
+{
+	struct uio *auio;
+	off_t offset;
+	int error;
+
+	error = copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	offset = PAIR32TO64(off_t, uap->offset);
+	error = kern_preadv(td, uap->fd, auio, offset);
+	free(auio, M_IOV);
+	return (error);
+}
+
+int
+freebsd_oabi_pwritev(struct thread *td, struct freebsd_oabi_pwritev_args *uap)
+{
+	struct uio *auio;
+	off_t offset;
+	int error;
+
+	error = copyinuio(uap->iovp, uap->iovcnt, &auio);
+	if (error)
+		return (error);
+	offset = PAIR32TO64(off_t, uap->offset);
+	error = kern_pwritev(td, uap->fd, auio, offset);
+	free(auio, M_IOV);
+	return(error);
+}
+
+int
+freebsd_oabi_pread(struct thread *td, struct freebsd_oabi_pread_args *uap)
+{
+	struct uio auio;
+	struct iovec aiov;
+	off_t offset;
+	int error;
+
+	if (uap->nbyte > INT_MAX)
+		return (EINVAL);
+	aiov.iov_base = uap->buf;
+	aiov.iov_len = uap->nbyte;
+	auio.uio_iov = &aiov;
+	auio.uio_iovcnt = 1;
+	auio.uio_resid = uap->nbyte;
+	auio.uio_segflg = UIO_USERSPACE;
+	offset = PAIR32TO64(off_t, uap->offset);
+	error = kern_preadv(td, uap->fd, &auio, offset);
+	return(error);
+}
+
+int
+freebsd_oabi_pwrite(struct thread *td, struct freebsd_oabi_pwrite_args *uap)
+{
+	struct uio auio;
+	struct iovec aiov;
+	off_t offset;
+	int error;
+
+	if (uap->nbyte > INT_MAX)
+		return (EINVAL);
+	aiov.iov_base = (void *)(uintptr_t)uap->buf;
+	aiov.iov_len = uap->nbyte;
+	auio.uio_iov = &aiov;
+	auio.uio_iovcnt = 1;
+	auio.uio_resid = uap->nbyte;
+	auio.uio_segflg = UIO_USERSPACE;
+	offset = PAIR32TO64(off_t, uap->offset);
+	error = kern_pwritev(td, uap->fd, &auio, offset);
+	return(error);
+}
+
+int
+freebsd_oabi_mmap(struct thread *td, struct freebsd_oabi_mmap_args *uap)
+{
+	struct mmap_args ap;
+
+	CP(*uap, ap, addr);
+	CP(*uap, ap, len);
+	CP(*uap, ap, prot);
+	CP(*uap, ap, flags);
+	CP(*uap, ap, fd);
+
+	ap.pos = PAIR32TO64(off_t, uap->pos);
+	return mmap(td, &ap);
+}
+
+int
+freebsd_oabi_lseek(struct thread *td, struct freebsd_oabi_lseek_args *uap)
+{
+	struct lseek_args ap;
+
+	CP(*uap, ap, fd);
+	CP64(*uap, ap, offset);
+	CP(*uap, ap, whence);
+	return lseek(td, &ap);
+}
+
+int
+freebsd_oabi_truncate(struct thread *td, struct freebsd_oabi_truncate_args *uap)
+{
+	off_t length;
+
+	length = PAIR32TO64(off_t, uap->length);
+	return (kern_truncate(td, uap->path, UIO_USERSPACE, length));
+}
+
+int
+freebsd_oabi_ftruncate(struct thread *td,
+    struct freebsd_oabi_ftruncate_args *uap)
+{
+	off_t length;
+
+	length = PAIR32TO64(off_t, uap->length);
+	return (kern_ftruncate(td, uap->fd, length));
+}
+
+static void
+copy_stat(struct stat *in, struct stat_oabi *out)
+{
+	CP(*in, *out, st_dev);
+	CP(*in, *out, st_ino);
+	CP(*in, *out, st_mode);
+	CP(*in, *out, st_nlink);
+	CP(*in, *out, st_uid);
+	CP(*in, *out, st_gid);
+	CP(*in, *out, st_rdev);
+	TS_CP(*in, *out, st_atim);
+	TS_CP(*in, *out, st_mtim);
+	TS_CP(*in, *out, st_ctim);
+	CP(*in, *out, st_size);
+	CP(*in, *out, st_blocks);
+	CP(*in, *out, st_blksize);
+	CP(*in, *out, st_flags);
+	CP(*in, *out, st_gen);
+}
+
+int
+freebsd_oabi_stat(struct thread *td, struct freebsd_oabi_stat_args *uap)
+{
+	struct stat sb;
+	struct stat_oabi sb_oabi;
+	int error;
+
+	error = kern_stat(td, uap->path, UIO_USERSPACE, &sb);
+	if (error)
+		return (error);
+	copy_stat(&sb, &sb_oabi);
+	error = copyout(&sb_oabi, uap->ub, sizeof (sb_oabi));
+	return (error);
+}
+
+int
+freebsd_oabi_fstat(struct thread *td, struct freebsd_oabi_fstat_args *uap)
+{
+	struct stat ub;
+	struct stat_oabi ub_oabi;
+	int error;
+
+	error = kern_fstat(td, uap->fd, &ub);
+	if (error)
+		return (error);
+	copy_stat(&ub, &ub_oabi);
+	error = copyout(&ub_oabi, uap->ub, sizeof(ub_oabi));
+	return (error);
+}
+
+int
+freebsd_oabi_fstatat(struct thread *td, struct freebsd_oabi_fstatat_args *uap)
+{
+	struct stat ub;
+	struct stat_oabi ub_oabi;
+	int error;
+
+	error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE,
+	    &ub);
+	if (error)
+		return (error);
+	copy_stat(&ub, &ub_oabi);
+	error = copyout(&ub_oabi, uap->buf, sizeof(ub_oabi));
+	return (error);
+}
+
+int
+freebsd_oabi_lstat(struct thread *td, struct freebsd_oabi_lstat_args *uap)
+{
+	struct stat sb;
+	struct stat_oabi sb_oabi;
+	int error;
+
+	error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb);
+	if (error)
+		return (error);
+	copy_stat(&sb, &sb_oabi);
+	error = copyout(&sb_oabi, uap->ub, sizeof (sb_oabi));
+	return (error);
+}
+
+int
+freebsd_oabi_cpuset_setid(struct thread *td,
+    struct freebsd_oabi_cpuset_setid_args *uap)
+{
+	panic("freebsd_oabi_cpuset_setid");
+}
+

Added: projects/arm_eabi/sys/compat/arm/syscalls.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/compat/arm/syscalls.conf	Wed Aug 25 07:24:52 2010	(r211796)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+sysnames="freebsd_oabi_syscalls.c"
+sysproto="freebsd_oabi_proto.h"
+sysproto_h=_FREEBSD32_SYSPROTO_H_
+syshdr="freebsd_oabi_syscall.h"
+syssw="freebsd_oabi_sysent.c"
+sysmk="/dev/null"
+syscallprefix="FREEBSD_OABI_SYS_"
+switchname="freebsd_oabi_sysent"
+namesname="freebsd_oabi_syscallnames"
+systrace="/dev/null"

Added: projects/arm_eabi/sys/compat/arm/syscalls.master
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/arm_eabi/sys/compat/arm/syscalls.master	Wed Aug 25 07:24:52 2010	(r211796)
@@ -0,0 +1,925 @@
+ $FreeBSD$
+;	from: @(#)syscalls.master	8.2 (Berkeley) 1/13/94
+;	from: src/sys/kern/syscalls.master 1.107
+;
+; System call name/number master file.
+; Processed to created init_sysent.c, syscalls.c and syscall.h.
+
+; Columns: number audit type name alt{name,tag,rtyp}/comments
+;	number	system call number, must be in order
+;	audit	the audit event associated with the system call
+;		A value of AUE_NULL means no auditing, but it also means that
+;		there is no audit event for the call at this time. For the
+;		case where the event exists, but we don't want auditing, the
+;		event should be #defined to AUE_NULL in audit_kevents.h.
+;	type	one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6,
+;		COMPAT7, NODEF, NOARGS, NOPROTO, NOSTD
+;		The COMPAT* options may be combined with one or more NO*
+;		options separated by '|' with no spaces (e.g. COMPAT|NOARGS)
+;	name	psuedo-prototype of syscall routine
+;		If one of the following alts is different, then all appear:
+;	altname	name of system call if different
+;	alttag	name of args struct tag if different from [o]`name'"_args"
+;	altrtyp	return type if not int (bogus - syscalls always return int)
+;		for UNIMPL/OBSOL, name continues with comments
+
+; types:
+;	STD	always included
+;	COMPAT	included on COMPAT #ifdef
+;	COMPAT4	included on COMPAT4 #ifdef (FreeBSD 4 compat)
+;	COMPAT6	included on COMPAT6 #ifdef (FreeBSD 6 compat)
+;	COMPAT7	included on COMPAT7 #ifdef (FreeBSD 7 compat)
+;	OBSOL	obsolete, not included in system, only specifies name
+;	UNIMPL	not implemented, placeholder only
+;	NOSTD	implemented but as a lkm that can be statically
+;		compiled in; sysent entry will be filled with lkmressys
+;		so the SYSCALL_MODULE macro works
+;	NOARGS	same as STD except do not create structure in sys/sysproto.h
+;	NODEF	same as STD except only have the entry in the syscall table
+;		added.  Meaning - do not create structure or function
+;		prototype in sys/sysproto.h
+;	NOPROTO	same as STD except do not create structure or
+;		function prototype in sys/sysproto.h.  Does add a
+;		definition to syscall.h besides adding a sysent.
+
+; #ifdef's, etc. may be included, and are copied to the output files.
+
+#include <sys/param.h>
+#include <sys/sysent.h>
+#include <sys/sysproto.h>
+#include <sys/mount.h>
+#include <sys/msg.h>
+#include <sys/socket.h>
+#include <compat/arm/freebsd_oabi.h>
+#include <compat/arm/freebsd_oabi_proto.h>
+
+#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#define PAD64_REQUIRED
+#endif
+
+; Reserved/unimplemented system calls in the range 0-150 inclusive
+; are reserved for use in future Berkeley releases.
+; Additional system calls implemented in vendor and other
+; redistributions should be placed in the reserved range at the end
+; of the current calls.
+
+0	AUE_NULL	NOPROTO	{ int nosys(void); } syscall nosys_args int
+1	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit \
+				    sys_exit_args void
+2	AUE_FORK	NOPROTO	{ int fork(void); }
+3	AUE_READ	NOPROTO	{ ssize_t read(int fd, void *buf, \
+				    size_t nbyte); }
+4	AUE_WRITE	NOPROTO	{ ssize_t write(int fd, const void *buf, \
+				    size_t nbyte); }
+5	AUE_OPEN_RWTC	NOPROTO	{ int open(char *path, int flags, \
+				    int mode); }
+6	AUE_CLOSE	NOPROTO	{ int close(int fd); }
+7	AUE_WAIT4	STD	{ int freebsd_oabi_wait4(int pid, int *status, \
+				    int options, struct rusage_oabi *rusage); }
+8	AUE_CREAT	OBSOL	old creat
+9	AUE_LINK	NOPROTO	{ int link(char *path, char *link); }
+10	AUE_UNLINK	NOPROTO	{ int unlink(char *path); }
+11	AUE_NULL	OBSOL	execv
+12	AUE_CHDIR	NOPROTO	{ int chdir(char *path); }
+13	AUE_FCHDIR	NOPROTO	{ int fchdir(int fd); }
+14	AUE_MKNOD	NOPROTO	{ int mknod(char *path, int mode, int dev); }
+15	AUE_CHMOD	NOPROTO	{ int chmod(char *path, int mode); }
+16	AUE_CHOWN	NOPROTO	{ int chown(char *path, int uid, int gid); }
+17	AUE_NULL	NOPROTO	{ int obreak(char *nsize); } break \
+				    obreak_args int
+18	AUE_GETFSSTAT	COMPAT4	{ int getfsstat( struct statfs *buf, \
+				    long bufsize, int flags); }
+19	AUE_LSEEK	OBSOL	olseek
+20	AUE_GETPID	NOPROTO	{ pid_t getpid(void); }
+21	AUE_MOUNT	NOPROTO	{ int mount(char *type, char *path, \
+				    int flags, caddr_t data); }
+22	AUE_UMOUNT	NOPROTO	{ int unmount(char *path, int flags); }
+23	AUE_SETUID	NOPROTO	{ int setuid(uid_t uid); }
+24	AUE_GETUID	NOPROTO	{ uid_t getuid(void); }
+25	AUE_GETEUID	NOPROTO	{ uid_t geteuid(void); }
+26	AUE_PTRACE	NOPROTO	{ int ptrace(int req, pid_t pid, \
+				    caddr_t addr, int data); }
+27	AUE_RECVMSG	NOPROTO	{ int recvmsg(int s, struct msghdr *msg, \
+				    int flags); }
+28	AUE_SENDMSG	NOPROTO	{ int sendmsg(int s, struct msghdr *msg, \
+				    int flags); }
+29	AUE_RECVFROM	NOPROTO	{ int recvfrom(int s, caddr_t buf, \
+				    size_t len, int flags, \
+				    struct sockaddr * __restrict from, \
+				    __socklen_t * __restrict fromlenaddr); }
+30	AUE_ACCEPT	NOPROTO	{ int accept(int s, caddr_t name, \
+				    int *anamelen); }
+31	AUE_GETPEERNAME	NOPROTO	{ int getpeername(int fdes, caddr_t asa, \
+				    int *alen); }
+32	AUE_GETSOCKNAME	NOPROTO	{ int getsockname(int fdes, caddr_t asa, \
+				    int *alen); }
+33	AUE_ACCESS	NOPROTO	{ int access(char *path, int flags); }
+34	AUE_CHFLAGS	NOPROTO	{ int chflags(char *path, int flags); }
+35	AUE_FCHFLAGS	NOPROTO	{ int fchflags(int fd, int flags); }
+36	AUE_SYNC	NOPROTO	{ int sync(void); }
+37	AUE_KILL	NOPROTO	{ int kill(int pid, int signum); }
+38	AUE_STAT	UNIMPL	ostat
+39	AUE_GETPPID	NOPROTO	{ pid_t getppid(void); }
+40	AUE_LSTAT	UNIMPL	olstat
+41	AUE_DUP		NOPROTO	{ int dup(u_int fd); }
+42	AUE_PIPE	NOPROTO	{ int pipe(void); }
+43	AUE_GETEGID	NOPROTO	{ gid_t getegid(void); }
+44	AUE_PROFILE	NOPROTO	{ int profil(caddr_t samples, size_t size, \
+				    size_t offset, u_int scale); }
+45	AUE_KTRACE	NOPROTO	{ int ktrace(const char *fname, int ops, \
+				    int facs, int pid); }
+46	AUE_SIGACTION	COMPAT	{ int sigaction( int signum, \
+				   struct osigaction *nsa, \
+				   struct osigaction *osa); }
+47	AUE_GETGID	NOPROTO	{ gid_t getgid(void); }
+48	AUE_SIGPROCMASK	COMPAT	{ int freebsd_oabi_sigprocmask(int how, \
+				   osigset_t mask); }
+49	AUE_GETLOGIN	NOPROTO	{ int getlogin(char *namebuf, \
+				    u_int namelen); }
+50	AUE_SETLOGIN	NOPROTO	{ int setlogin(char *namebuf); }
+51	AUE_ACCT	NOPROTO	{ int acct(char *path); }
+52	AUE_SIGPENDING	NOPROTO|COMPAT	{ int sigpending(void); }
+53	AUE_SIGALTSTACK	NOPROTO	{ int sigaltstack(stack_t *ss, \
+				    stack_t *oss); }
+; XXX: Check
+54	AUE_NULL	NOPROTO	{ int ioctl(int fd, uint32_t com, \
+				    struct ioctl *data); }
+55	AUE_REBOOT	NOPROTO	{ int reboot(int opt); }
+56	AUE_REVOKE	NOPROTO	{ int revoke(char *path); }
+57	AUE_SYMLINK	NOPROTO	{ int symlink(char *path, char *link); }
+58	AUE_READLINK	NOPROTO	{ ssize_t readlink(char *path, char *buf, \
+				    size_t count); }
+59	AUE_EXECVE	NOPROTO	{ int execve(char *fname, char **argv, \
+				    char **envv); }
+60	AUE_UMASK	NOPROTO	{ int umask(int newmask); } umask \
+				    umask_args int
+61	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
+62	AUE_FSTAT	OBSOL	ofstat
+63	AUE_NULL	OBSOL	ogetkerninfo
+64	AUE_NULL	OBSOL	ogetpagesize
+65	AUE_MSYNC	NOPROTO	{ int msync(void *addr, size_t len, \
+				    int flags); }
+66	AUE_VFORK	NOPROTO	{ int vfork(void); }
+67	AUE_NULL	OBSOL	vread
+68	AUE_NULL	OBSOL	vwrite
+69	AUE_SBRK	NOPROTO	{ int sbrk(int incr); }
+70	AUE_SSTK	NOPROTO	{ int sstk(int incr); }
+71	AUE_MMAP	OBSOL	ommap
+72	AUE_O_VADVISE	NOPROTO	{ int ovadvise(int anom); } vadvise \
+				    ovadvise_args int
+73	AUE_MUNMAP	NOPROTO	{ int munmap(void *addr, size_t len); }
+74	AUE_MPROTECT	NOPROTO	{ int mprotect(const void *addr, \
+				    size_t len, int prot); }
+75	AUE_MADVISE	NOPROTO	{ int madvise(void *addr, size_t len, \
+				    int behav); }
+76	AUE_NULL	OBSOL	vhangup
+77	AUE_NULL	OBSOL	vlimit
+78	AUE_MINCORE	NOPROTO	{ int mincore(const void *addr, size_t len, \
+				    char *vec); }
+79	AUE_GETGROUPS	NOPROTO	{ int getgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+80	AUE_SETGROUPS	NOPROTO	{ int setgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+81	AUE_GETPGRP	NOPROTO	{ int getpgrp(void); }
+82	AUE_SETPGRP	NOPROTO	{ int setpgid(int pid, int pgid); }
+83	AUE_SETITIMER	STD	{ int freebsd_oabi_setitimer(u_int which, \
+				    struct itimerval_oabi *itv, \
+				    struct itimerval_oabi *oitv); }
+84	AUE_NULL	OBSOL	owait
+; XXX implement
+85	AUE_SWAPON	NOPROTO	{ int swapon(char *name); }
+86	AUE_GETITIMER	STD	{ int freebsd_oabi_getitimer(u_int which, \
+				    struct itimerval_oabi *itv); }
+87	AUE_O_GETHOSTNAME	OBSOL	ogethostname
+88	AUE_O_SETHOSTNAME	OBSOL	osethostname
+89	AUE_GETDTABLESIZE	NOPROTO	{ int getdtablesize(void); }
+90	AUE_DUP2	NOPROTO	{ int dup2(u_int from, u_int to); }
+91	AUE_NULL	UNIMPL	getdopt
+92	AUE_FCNTL	NOPROTO	{ int fcntl(int fd, int cmd, long arg); }
+93	AUE_SELECT	STD	{ int freebsd_oabi_select(int nd, fd_set *in, \
+				    fd_set *ou, fd_set *ex, \
+				    struct timeval_oabi *tv); }
+94	AUE_NULL	UNIMPL	setdopt
+95	AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
+96	AUE_SETPRIORITY	NOPROTO	{ int setpriority(int which, int who, \
+				    int prio); }
+97	AUE_SOCKET	NOPROTO	{ int socket(int domain, int type, \
+				    int protocol); }
+98	AUE_CONNECT	NOPROTO	{ int connect(int s, caddr_t name, \
+				    int namelen); }
+99	AUE_NULL	OBSOL	oaccept
+100	AUE_GETPRIORITY	NOPROTO	{ int getpriority(int which, int who); }
+101	AUE_NULL	OBSOL	osend
+102	AUE_NULL	OBSOL	orecv
+103	AUE_NULL	OBSOL	osigreturn
+104	AUE_BIND	NOPROTO	{ int bind(int s, caddr_t name, \
+				    int namelen); }
+105	AUE_SETSOCKOPT	NOPROTO	{ int setsockopt(int s, int level, \
+				    int name, caddr_t val, int valsize); }
+106	AUE_LISTEN	NOPROTO	{ int listen(int s, int backlog); }
+107	AUE_NULL	OBSOL	vtimes
+108	AUE_O_SIGVEC	COMPAT	{ int freebsd_oabi_sigvec(int signum, \
+				     struct sigvec *nsv, \
+				     struct sigvec *osv); }
+109	AUE_O_SIGBLOCK	COMPAT	{ int freebsd_oabi_sigblock(int mask); }
+110	AUE_O_SIGSETMASK	COMPAT	{ int freebsd_oabi_sigsetmask( int mask); }
+111	AUE_SIGSUSPEND	COMPAT	{ int freebsd_oabi_sigsuspend( int mask); }
+112	AUE_O_SIGSTACK	COMPAT	{ int freebsd_oabi_sigstack( \
+				     struct sigstack32 *nss, \
+				     struct sigstack32 *oss); }
+113	AUE_NULL	OBSOL	orecvmsg
+114	AUE_NULL	OBSOL	osendmsg
+115	AUE_NULL	OBSOL	vtrace
+116	AUE_GETTIMEOFDAY	STD	{ int freebsd_oabi_gettimeofday( \
+				    struct timeval_oabi *tp, \
+				    struct timezone *tzp); }
+117	AUE_GETRUSAGE	STD	{ int freebsd_oabi_getrusage(int who, \
+				    struct rusage_oabi *rusage); }
+118	AUE_GETSOCKOPT	NOPROTO	{ int getsockopt(ine s, int level, \
+				    int name, caddr_t val, int *avalsize); }
+119	AUE_NULL	UNIMPL	resuba (BSD/OS 2.x)
+120	AUE_READV	NOPROTO	{ int readv(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+121	AUE_WRITEV	NOPROTO	{ int writev(int fd, struct iovec *iovp, \
+				    u_int iovcnt); }
+122	AUE_SETTIMEOFDAY	STD	{ int freebsd_oabi_settimeofday( \
+				    struct timeval_oabi *tv, \
+				    struct timezone *tzp); }
+123	AUE_FCHOWN	NOPROTO	{ int fchown(int fd, int uid, int gid); }
+124	AUE_FCHMOD	NOPROTO	{ int fchmod(int fd, int mode); }
+125	AUE_RECVFROM	OBSOL	orecvfrom
+126	AUE_SETREUID	NOPROTO	{ int setreuid(int ruid, int euid); }
+127	AUE_SETREGID	NOPROTO	{ int setregid(int rgid, int egid); }
+128	AUE_RENAME	NOPROTO	{ int rename(char *from, char *to); }
+129	AUE_TRUNCATE	OBSOL	otruncate
+130	AUE_FTRUNCATE	OBSOL	ftruncate
+131	AUE_FLOCK	NOPROTO	{ int flock(int fd, int how); }
+132	AUE_MKFIFO	NOPROTO	{ int mkfifo(char *path, int mode); }
+133	AUE_SENDTO	NOPROTO	{ int sendto(int s, caddr_t buf, \
+				    size_t len, int flags, caddr_t to, \
+				    int tolen); }
+134	AUE_SHUTDOWN	NOPROTO	{ int shutdown(int s, int how); }
+135	AUE_SOCKETPAIR	NOPROTO	{ int socketpair(int domain, int type, \
+				    int protocol, int *rsv); }
+136	AUE_MKDIR	NOPROTO	{ int mkdir(char *path, int mode); }
+137	AUE_RMDIR	NOPROTO	{ int rmdir(char *path); }
+138	AUE_UTIMES	STD	{ int freebsd_oabi_utimes(char *path, \
+				    struct timeval32 *tptr); }
+139	AUE_NULL	OBSOL	4.2 sigreturn
+140	AUE_ADJTIME	STD	{ int freebsd_oabi_adjtime( \
+				    struct timeval32 *delta, \
+				    struct timeval32 *olddelta); }
+141	AUE_GETPEERNAME	OBSOL	ogetpeername

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list