Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Aug 2016 16:01:30 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r304564 - in head/sys: compat/cloudabi32 conf
Message-ID:  <201608211601.u7LG1U2n063681@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Sun Aug 21 16:01:30 2016
New Revision: 304564
URL: https://svnweb.freebsd.org/changeset/base/304564

Log:
  Add CPU independent code for running 32-bits CloudABI executables.
  
  Essentially, this is a literal copy of the code in sys/compat/cloudabi64,
  except that it now makes use of 32-bits datatypes and limits. In
  sys/conf/files, we now need to take care to build the code in
  sys/compat/cloudabi if either COMPAT_CLOUDABI32 or COMPAT_CLOUDABI64 is
  turned on.
  
  This change does not yet include any of the CPU dependent bits. Right
  now I have implementations for running i386 binaries both on i386 and
  x86-64, which I will send out for review separately.

Added:
  head/sys/compat/cloudabi32/
  head/sys/compat/cloudabi32/Makefile
     - copied, changed from r304561, head/sys/compat/cloudabi64/Makefile
  head/sys/compat/cloudabi32/cloudabi32_fd.c
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_fd.c
  head/sys/compat/cloudabi32/cloudabi32_module.c
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_module.c
  head/sys/compat/cloudabi32/cloudabi32_poll.c
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_poll.c
  head/sys/compat/cloudabi32/cloudabi32_sock.c
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_sock.c
  head/sys/compat/cloudabi32/cloudabi32_thread.c
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_thread.c
  head/sys/compat/cloudabi32/cloudabi32_util.h
     - copied, changed from r304561, head/sys/compat/cloudabi64/cloudabi64_util.h
  head/sys/compat/cloudabi32/syscalls.conf
     - copied, changed from r304561, head/sys/compat/cloudabi64/syscalls.conf
Modified:
  head/sys/conf/files
  head/sys/conf/options

Copied and modified: head/sys/compat/cloudabi32/Makefile (from r304561, head/sys/compat/cloudabi64/Makefile)
==============================================================================
--- head/sys/compat/cloudabi64/Makefile	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/Makefile	Sun Aug 21 16:01:30 2016	(r304564)
@@ -3,12 +3,12 @@
 all:
 	@echo "make sysent only"
 
-sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c
+sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
+    cloudabi32_syscalls.c cloudabi32_systrace_args.c
 
-cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
-    ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
+cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
+    cloudabi32_syscalls.c cloudabi32_systrace_args.c: \
+    ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
     syscalls.conf
-	sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
+	sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
 	    syscalls.conf

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_fd.c (from r304561, head/sys/compat/cloudabi64/cloudabi64_fd.c)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_fd.c	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_fd.c	Sun Aug 21 16:01:30 2016	(r304564)
@@ -34,17 +34,17 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/uio.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
-#include <compat/cloudabi64/cloudabi64_proto.h>
-#include <compat/cloudabi64/cloudabi64_util.h>
+#include <compat/cloudabi32/cloudabi32_proto.h>
+#include <compat/cloudabi32/cloudabi32_util.h>
 
-/* Copies in 64-bit iovec structures from userspace. */
+/* Copies in 32-bit iovec structures from userspace. */
 static int
-cloudabi64_copyinuio(const cloudabi64_iovec_t *iovp, size_t iovcnt,
+cloudabi32_copyinuio(const cloudabi32_iovec_t *iovp, size_t iovcnt,
     struct uio **uiop)
 {
-	cloudabi64_iovec_t iovobj;
+	cloudabi32_iovec_t iovobj;
 	struct uio *uio;
 	struct iovec *iov;
 	size_t i;
@@ -73,7 +73,7 @@ cloudabi64_copyinuio(const cloudabi64_io
 		}
 		iov[i].iov_base = TO_PTR(iovobj.iov_base);
 		iov[i].iov_len = iovobj.iov_len;
-		if (iov[i].iov_len > INT64_MAX - uio->uio_resid) {
+		if (iov[i].iov_len > INT32_MAX - uio->uio_resid) {
 			free(uio, M_IOV);
 			return (EINVAL);
 		}
@@ -85,13 +85,13 @@ cloudabi64_copyinuio(const cloudabi64_io
 }
 
 int
-cloudabi64_sys_fd_pread(struct thread *td,
-    struct cloudabi64_sys_fd_pread_args *uap)
+cloudabi32_sys_fd_pread(struct thread *td,
+    struct cloudabi32_sys_fd_pread_args *uap)
 {
 	struct uio *uio;
 	int error;
 
-	error = cloudabi64_copyinuio(uap->iov, uap->iovcnt, &uio);
+	error = cloudabi32_copyinuio(uap->iov, uap->iovcnt, &uio);
 	if (error != 0)
 		return (error);
 	error = kern_preadv(td, uap->fd, uio, uap->offset);
@@ -100,13 +100,13 @@ cloudabi64_sys_fd_pread(struct thread *t
 }
 
 int
-cloudabi64_sys_fd_pwrite(struct thread *td,
-    struct cloudabi64_sys_fd_pwrite_args *uap)
+cloudabi32_sys_fd_pwrite(struct thread *td,
+    struct cloudabi32_sys_fd_pwrite_args *uap)
 {
 	struct uio *uio;
 	int error;
 
-	error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
+	error = cloudabi32_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
 	if (error != 0)
 		return (error);
 	error = kern_pwritev(td, uap->fd, uio, uap->offset);
@@ -115,13 +115,13 @@ cloudabi64_sys_fd_pwrite(struct thread *
 }
 
 int
-cloudabi64_sys_fd_read(struct thread *td,
-    struct cloudabi64_sys_fd_read_args *uap)
+cloudabi32_sys_fd_read(struct thread *td,
+    struct cloudabi32_sys_fd_read_args *uap)
 {
 	struct uio *uio;
 	int error;
 
-	error = cloudabi64_copyinuio(uap->iov, uap->iovcnt, &uio);
+	error = cloudabi32_copyinuio(uap->iov, uap->iovcnt, &uio);
 	if (error != 0)
 		return (error);
 	error = kern_readv(td, uap->fd, uio);
@@ -130,13 +130,13 @@ cloudabi64_sys_fd_read(struct thread *td
 }
 
 int
-cloudabi64_sys_fd_write(struct thread *td,
-    struct cloudabi64_sys_fd_write_args *uap)
+cloudabi32_sys_fd_write(struct thread *td,
+    struct cloudabi32_sys_fd_write_args *uap)
 {
 	struct uio *uio;
 	int error;
 
-	error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
+	error = cloudabi32_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
 	if (error != 0)
 		return (error);
 	error = kern_writev(td, uap->fd, uio);

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_module.c (from r304561, head/sys/compat/cloudabi64/cloudabi64_module.c)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_module.c	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_module.c	Sun Aug 21 16:01:30 2016	(r304564)
@@ -36,17 +36,17 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysent.h>
 #include <sys/systm.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
 #include <compat/cloudabi/cloudabi_util.h>
 
-#include <compat/cloudabi64/cloudabi64_util.h>
+#include <compat/cloudabi32/cloudabi32_util.h>
 
-extern char _binary_cloudabi64_vdso_o_start[];
-extern char _binary_cloudabi64_vdso_o_end[];
+extern char _binary_cloudabi32_vdso_o_start[];
+extern char _binary_cloudabi32_vdso_o_end[];
 
 register_t *
-cloudabi64_copyout_strings(struct image_params *imgp)
+cloudabi32_copyout_strings(struct image_params *imgp)
 {
 	struct image_args *args;
 	uintptr_t begin;
@@ -61,10 +61,10 @@ cloudabi64_copyout_strings(struct image_
 }
 
 int
-cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
+cloudabi32_fixup(register_t **stack_base, struct image_params *imgp)
 {
 	char canarybuf[64];
-	Elf64_Auxargs *args;
+	Elf32_Auxargs *args;
 	struct thread *td;
 	void *argdata, *canary;
 	size_t argdatalen;
@@ -93,13 +93,13 @@ cloudabi64_fixup(register_t **stack_base
 	 * binary safe, we had to add a trailing null byte in
 	 * exec_copyin_data_fds(). Undo this by reducing the length.
 	 */
-	args = (Elf64_Auxargs *)imgp->auxargs;
+	args = (Elf32_Auxargs *)imgp->auxargs;
 	argdatalen = imgp->args->begin_envv - imgp->args->begin_argv;
 	if (argdatalen > 0)
 		--argdatalen;
 
 	/* Write out an auxiliary vector. */
-	cloudabi64_auxv_t auxv[] = {
+	cloudabi32_auxv_t auxv[] = {
 #define	VAL(type, val)	{ .a_type = (type), .a_val = (val) }
 #define	PTR(type, ptr)	{ .a_type = (type), .a_ptr = (uintptr_t)(ptr) }
 		PTR(CLOUDABI_AT_ARGDATA, argdata),
@@ -124,44 +124,44 @@ cloudabi64_fixup(register_t **stack_base
 		return (error);
 
 	/* Reserve space for storing the TCB. */
-	*stack_base -= howmany(sizeof(cloudabi64_tcb_t), sizeof(register_t));
+	*stack_base -= howmany(sizeof(cloudabi32_tcb_t), sizeof(register_t));
 	return (0);
 }
 
 static int
-cloudabi64_modevent(module_t mod, int type, void *data)
+cloudabi32_modevent(module_t mod, int type, void *data)
 {
 
 	switch (type) {
 	case MOD_LOAD:
-		cloudabi_vdso_init(cloudabi64_brand.sysvec,
-		    _binary_cloudabi64_vdso_o_start,
-		    _binary_cloudabi64_vdso_o_end);
-		if (elf64_insert_brand_entry(&cloudabi64_brand) < 0) {
+		cloudabi_vdso_init(cloudabi32_brand.sysvec,
+		    _binary_cloudabi32_vdso_o_start,
+		    _binary_cloudabi32_vdso_o_end);
+		if (elf32_insert_brand_entry(&cloudabi32_brand) < 0) {
 			printf("Failed to add CloudABI ELF brand handler\n");
 			return (EINVAL);
 		}
 		return (0);
 	case MOD_UNLOAD:
-		if (elf64_brand_inuse(&cloudabi64_brand))
+		if (elf32_brand_inuse(&cloudabi32_brand))
 			return (EBUSY);
-		if (elf64_remove_brand_entry(&cloudabi64_brand) < 0) {
+		if (elf32_remove_brand_entry(&cloudabi32_brand) < 0) {
 			printf("Failed to remove CloudABI ELF brand handler\n");
 			return (EINVAL);
 		}
-		cloudabi_vdso_destroy(cloudabi64_brand.sysvec);
+		cloudabi_vdso_destroy(cloudabi32_brand.sysvec);
 		return (0);
 	default:
 		return (EOPNOTSUPP);
 	}
 }
 
-static moduledata_t cloudabi64_module = {
-	"cloudabi64",
-	cloudabi64_modevent,
+static moduledata_t cloudabi32_module = {
+	"cloudabi32",
+	cloudabi32_modevent,
 	NULL
 };
 
-DECLARE_MODULE_TIED(cloudabi64, cloudabi64_module, SI_SUB_EXEC, SI_ORDER_ANY);
-MODULE_DEPEND(cloudabi64, cloudabi, 1, 1, 1);
-FEATURE(cloudabi64, "CloudABI 64bit support");
+DECLARE_MODULE_TIED(cloudabi32, cloudabi32_module, SI_SUB_EXEC, SI_ORDER_ANY);
+MODULE_DEPEND(cloudabi32, cloudabi, 1, 1, 1);
+FEATURE(cloudabi32, "CloudABI 32bit support");

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_poll.c (from r304561, head/sys/compat/cloudabi64/cloudabi64_poll.c)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_poll.c	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_poll.c	Sun Aug 21 16:01:30 2016	(r304564)
@@ -30,12 +30,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/proc.h>
 #include <sys/syscallsubr.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
 #include <compat/cloudabi/cloudabi_util.h>
 
-#include <compat/cloudabi64/cloudabi64_proto.h>
-#include <compat/cloudabi64/cloudabi64_util.h>
+#include <compat/cloudabi32/cloudabi32_proto.h>
+#include <compat/cloudabi32/cloudabi32_util.h>
 
 /* Converts a FreeBSD signal number to a CloudABI signal number. */
 static cloudabi_signal_t
@@ -76,18 +76,18 @@ convert_signal(int sig)
 	return (signals[sig]);
 }
 
-struct cloudabi64_kevent_args {
-	const cloudabi64_subscription_t *in;
-	cloudabi64_event_t *out;
+struct cloudabi32_kevent_args {
+	const cloudabi32_subscription_t *in;
+	cloudabi32_event_t *out;
 	bool once;
 };
 
 /* Converts CloudABI's subscription objects to FreeBSD's struct kevent. */
 static int
-cloudabi64_kevent_copyin(void *arg, struct kevent *kevp, int count)
+cloudabi32_kevent_copyin(void *arg, struct kevent *kevp, int count)
 {
-	cloudabi64_subscription_t sub;
-	struct cloudabi64_kevent_args *args;
+	cloudabi32_subscription_t sub;
+	struct cloudabi32_kevent_args *args;
 	cloudabi_timestamp_t ts;
 	int error;
 
@@ -163,10 +163,10 @@ cloudabi64_kevent_copyin(void *arg, stru
 
 /* Converts FreeBSD's struct kevent to CloudABI's event objects. */
 static int
-cloudabi64_kevent_copyout(void *arg, struct kevent *kevp, int count)
+cloudabi32_kevent_copyout(void *arg, struct kevent *kevp, int count)
 {
-	cloudabi64_event_t ev;
-	struct cloudabi64_kevent_args *args;
+	cloudabi32_event_t ev;
+	struct cloudabi32_kevent_args *args;
 	int error;
 
 	args = arg;
@@ -233,16 +233,16 @@ cloudabi64_kevent_copyout(void *arg, str
 }
 
 int
-cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
+cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
 {
-	struct cloudabi64_kevent_args args = {
+	struct cloudabi32_kevent_args args = {
 		.in	= uap->in,
 		.out	= uap->out,
 		.once	= true,
 	};
 	struct kevent_copyops copyops = {
-		.k_copyin	= cloudabi64_kevent_copyin,
-		.k_copyout	= cloudabi64_kevent_copyout,
+		.k_copyin	= cloudabi32_kevent_copyin,
+		.k_copyout	= cloudabi32_kevent_copyout,
 		.arg		= &args,
 	};
 
@@ -251,8 +251,8 @@ cloudabi64_sys_poll(struct thread *td, s
 	 * implemented through FreeBSD's kqueue().
 	 */
 	if (uap->nsubscriptions == 1) {
-		cloudabi64_subscription_t sub;
-		cloudabi64_event_t ev = {};
+		cloudabi32_subscription_t sub;
+		cloudabi32_event_t ev = {};
 		int error;
 
 		error = copyin(uap->in, &sub, sizeof(sub));
@@ -294,8 +294,8 @@ cloudabi64_sys_poll(struct thread *td, s
 			return (copyout(&ev, uap->out, sizeof(ev)));
 		}
 	} else if (uap->nsubscriptions == 2) {
-		cloudabi64_subscription_t sub[2];
-		cloudabi64_event_t ev[2] = {};
+		cloudabi32_subscription_t sub[2];
+		cloudabi32_event_t ev[2] = {};
 		int error;
 
 		error = copyin(uap->in, &sub, sizeof(sub));
@@ -371,20 +371,20 @@ cloudabi64_sys_poll(struct thread *td, s
 }
 
 int
-cloudabi64_sys_poll_fd(struct thread *td,
-    struct cloudabi64_sys_poll_fd_args *uap)
+cloudabi32_sys_poll_fd(struct thread *td,
+    struct cloudabi32_sys_poll_fd_args *uap)
 {
-	struct cloudabi64_kevent_args args = {
+	struct cloudabi32_kevent_args args = {
 		.in	= uap->in,
 		.out	= uap->out,
 		.once	= false,
 	};
 	struct kevent_copyops copyops = {
-		.k_copyin	= cloudabi64_kevent_copyin,
-		.k_copyout	= cloudabi64_kevent_copyout,
+		.k_copyin	= cloudabi32_kevent_copyin,
+		.k_copyout	= cloudabi32_kevent_copyout,
 		.arg		= &args,
 	};
-	cloudabi64_subscription_t subtimo;
+	cloudabi32_subscription_t subtimo;
 	struct timespec timeout;
 	int error;
 

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_sock.c (from r304561, head/sys/compat/cloudabi64/cloudabi64_sock.c)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_sock.c	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_sock.c	Sun Aug 21 16:01:30 2016	(r304564)
@@ -35,25 +35,25 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/uio.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
 #include <compat/cloudabi/cloudabi_util.h>
 
-#include <compat/cloudabi64/cloudabi64_proto.h>
-#include <compat/cloudabi64/cloudabi64_util.h>
+#include <compat/cloudabi32/cloudabi32_proto.h>
+#include <compat/cloudabi32/cloudabi32_util.h>
 
 static MALLOC_DEFINE(M_SOCKET, "socket", "CloudABI socket");
 
 int
-cloudabi64_sys_sock_recv(struct thread *td,
-    struct cloudabi64_sys_sock_recv_args *uap)
+cloudabi32_sys_sock_recv(struct thread *td,
+    struct cloudabi32_sys_sock_recv_args *uap)
 {
 	struct sockaddr_storage ss;
-	cloudabi64_recv_in_t ri;
-	cloudabi64_recv_out_t ro = {};
-	cloudabi64_iovec_t iovobj;
+	cloudabi32_recv_in_t ri;
+	cloudabi32_recv_out_t ro = {};
+	cloudabi32_iovec_t iovobj;
 	struct msghdr msghdr = {};
-	const cloudabi64_iovec_t *user_iov;
+	const cloudabi32_iovec_t *user_iov;
 	size_t i;
 	int error;
 
@@ -99,14 +99,14 @@ cloudabi64_sys_sock_recv(struct thread *
 }
 
 int
-cloudabi64_sys_sock_send(struct thread *td,
-    struct cloudabi64_sys_sock_send_args *uap)
+cloudabi32_sys_sock_send(struct thread *td,
+    struct cloudabi32_sys_sock_send_args *uap)
 {
-	cloudabi64_send_in_t si;
-	cloudabi64_send_out_t so = {};
-	cloudabi64_ciovec_t iovobj;
+	cloudabi32_send_in_t si;
+	cloudabi32_send_out_t so = {};
+	cloudabi32_ciovec_t iovobj;
 	struct msghdr msghdr = {};
-	const cloudabi64_ciovec_t *user_iov;
+	const cloudabi32_ciovec_t *user_iov;
 	size_t i;
 	int error, flags;
 

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_thread.c (from r304561, head/sys/compat/cloudabi64/cloudabi64_thread.c)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_thread.c	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_thread.c	Sun Aug 21 16:01:30 2016	(r304564)
@@ -30,14 +30,14 @@ __FBSDID("$FreeBSD$");
 #include <sys/proc.h>
 #include <sys/systm.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
-#include <compat/cloudabi64/cloudabi64_proto.h>
-#include <compat/cloudabi64/cloudabi64_util.h>
+#include <compat/cloudabi32/cloudabi32_proto.h>
+#include <compat/cloudabi32/cloudabi32_util.h>
 
 struct thread_create_args {
-	cloudabi64_threadattr_t attr;
-	uint64_t tcb;
+	cloudabi32_threadattr_t attr;
+	uint32_t tcb;
 	lwpid_t tid;
 };
 
@@ -50,12 +50,12 @@ initialize_thread(struct thread *td, voi
 	args->tid = td->td_tid;
 
 	/* Set up initial register contents. */
-	return (cloudabi64_thread_setregs(td, &args->attr, args->tcb));
+	return (cloudabi32_thread_setregs(td, &args->attr, args->tcb));
 }
 
 int
-cloudabi64_sys_thread_create(struct thread *td,
-    struct cloudabi64_sys_thread_create_args *uap)
+cloudabi32_sys_thread_create(struct thread *td,
+    struct cloudabi32_sys_thread_create_args *uap)
 {
 	struct thread_create_args args;
 	int error;
@@ -66,7 +66,7 @@ cloudabi64_sys_thread_create(struct thre
 
 	/* Remove some space on the top of the stack for the TCB. */
 	args.tcb = rounddown(args.attr.stack + args.attr.stack_size -
-	    sizeof(cloudabi64_tcb_t), _Alignof(cloudabi64_tcb_t));
+	    sizeof(cloudabi32_tcb_t), _Alignof(cloudabi32_tcb_t));
 	args.attr.stack_size = args.tcb - args.attr.stack;
 
 	error = thread_create(td, NULL, initialize_thread, &args);

Copied and modified: head/sys/compat/cloudabi32/cloudabi32_util.h (from r304561, head/sys/compat/cloudabi64/cloudabi64_util.h)
==============================================================================
--- head/sys/compat/cloudabi64/cloudabi64_util.h	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/cloudabi32_util.h	Sun Aug 21 16:01:30 2016	(r304564)
@@ -25,27 +25,27 @@
  * $FreeBSD$
  */
 
-#ifndef _CLOUDABI64_UTIL_H_
-#define	_CLOUDABI64_UTIL_H_
+#ifndef _CLOUDABI32_UTIL_H_
+#define	_CLOUDABI32_UTIL_H_
 
 #include <sys/types.h>
-#define	__ELF_WORD_SIZE	64
+#define	__ELF_WORD_SIZE	32
 #include <sys/imgact_elf.h>
 
-#include <contrib/cloudabi/cloudabi64_types.h>
+#include <contrib/cloudabi/cloudabi32_types.h>
 
 struct image_params;
 struct thread;
 
-extern Elf64_Brandinfo cloudabi64_brand;
+extern Elf32_Brandinfo cloudabi32_brand;
 
 #define	TO_PTR(x)	((void *)(uintptr_t)(x))
 
 /* Stack initialization during process execution. */
-register_t *cloudabi64_copyout_strings(struct image_params *);
-int	cloudabi64_fixup(register_t **, struct image_params *);
+register_t *cloudabi32_copyout_strings(struct image_params *);
+int	cloudabi32_fixup(register_t **, struct image_params *);
 
-int	cloudabi64_thread_setregs(struct thread *,
-    const cloudabi64_threadattr_t *, uint64_t);
+int	cloudabi32_thread_setregs(struct thread *,
+    const cloudabi32_threadattr_t *, uint32_t);
 
 #endif

Copied and modified: head/sys/compat/cloudabi32/syscalls.conf (from r304561, head/sys/compat/cloudabi64/syscalls.conf)
==============================================================================
--- head/sys/compat/cloudabi64/syscalls.conf	Sun Aug 21 15:41:19 2016	(r304561, copy source)
+++ head/sys/compat/cloudabi32/syscalls.conf	Sun Aug 21 16:01:30 2016	(r304564)
@@ -1,14 +1,14 @@
 # $FreeBSD$
-sysnames="cloudabi64_syscalls.c"
-sysproto="cloudabi64_proto.h"
-sysproto_h=_CLOUDABI64_SYSPROTO_H_
-syshdr="cloudabi64_syscall.h"
-syssw="cloudabi64_sysent.c"
+sysnames="cloudabi32_syscalls.c"
+sysproto="cloudabi32_proto.h"
+sysproto_h=_CLOUDABI32_SYSPROTO_H_
+syshdr="cloudabi32_syscall.h"
+syssw="cloudabi32_sysent.c"
 sysmk="/dev/null"
-syscallprefix="CLOUDABI64_SYS_"
-switchname="cloudabi64_sysent"
-namesname="cloudabi64_syscallnames"
-systrace="cloudabi64_systrace_args.c"
+syscallprefix="CLOUDABI32_SYS_"
+switchname="cloudabi32_sysent"
+namesname="cloudabi32_syscallnames"
+systrace="cloudabi32_systrace_args.c"
 
 # Allow all system calls in capabilities mode. Extract the names of the
 # system calls from syscalls.master.

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Sun Aug 21 15:56:19 2016	(r304563)
+++ head/sys/conf/files	Sun Aug 21 16:01:30 2016	(r304564)
@@ -274,17 +274,24 @@ cddl/dev/fbt/fbt.c			optional dtrace_fbt
 cddl/dev/systrace/systrace.c		optional dtrace_systrace | dtraceall compile-with "${CDDL_C}"
 cddl/dev/prototype.c			optional dtrace_prototype | dtraceall compile-with "${CDDL_C}"
 fs/nfsclient/nfs_clkdtrace.c		optional dtnfscl nfscl   | dtraceall nfscl compile-with "${CDDL_C}"
-compat/cloudabi/cloudabi_clock.c	optional compat_cloudabi64
-compat/cloudabi/cloudabi_errno.c	optional compat_cloudabi64
-compat/cloudabi/cloudabi_fd.c		optional compat_cloudabi64
-compat/cloudabi/cloudabi_file.c		optional compat_cloudabi64
-compat/cloudabi/cloudabi_futex.c	optional compat_cloudabi64
-compat/cloudabi/cloudabi_mem.c		optional compat_cloudabi64
-compat/cloudabi/cloudabi_proc.c		optional compat_cloudabi64
-compat/cloudabi/cloudabi_random.c	optional compat_cloudabi64
-compat/cloudabi/cloudabi_sock.c		optional compat_cloudabi64
-compat/cloudabi/cloudabi_thread.c	optional compat_cloudabi64
-compat/cloudabi/cloudabi_vdso.c		optional compat_cloudabi64
+compat/cloudabi/cloudabi_clock.c	optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_errno.c	optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_fd.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_file.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_futex.c	optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_mem.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_proc.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_random.c	optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_sock.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_thread.c	optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi/cloudabi_vdso.c		optional compat_cloudabi32 | compat_cloudabi64
+compat/cloudabi32/cloudabi32_fd.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_module.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_poll.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_sock.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_syscalls.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_sysent.c	optional compat_cloudabi32
+compat/cloudabi32/cloudabi32_thread.c	optional compat_cloudabi32
 compat/cloudabi64/cloudabi64_fd.c	optional compat_cloudabi64
 compat/cloudabi64/cloudabi64_module.c	optional compat_cloudabi64
 compat/cloudabi64/cloudabi64_poll.c	optional compat_cloudabi64

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Sun Aug 21 15:56:19 2016	(r304563)
+++ head/sys/conf/options	Sun Aug 21 16:01:30 2016	(r304564)
@@ -86,6 +86,7 @@ COMPAT_FREEBSD6	opt_compat.h
 COMPAT_FREEBSD7	opt_compat.h
 COMPAT_FREEBSD9	opt_compat.h
 COMPAT_FREEBSD10	opt_compat.h
+COMPAT_CLOUDABI32	opt_dontuse.h
 COMPAT_CLOUDABI64	opt_dontuse.h
 COMPAT_LINUXKPI	opt_compat.h
 COMPILING_LINT	opt_global.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608211601.u7LG1U2n063681>