./buildrump.sh/buildrump.sh -${BUILDXEN_QUIET:-q} ${STDJ} -k \
-V MKPIC=no -s rumpsrc -T rumptools -o rumpobj -N \
-V RUMP_KERNEL_IS_LIBC=1 tools
-# FIXME to be able to specify this as part of previous cmdline
-echo 'CPPFLAGS+=-DMAXPHYS=32768' >> rumptools/mk.conf
-# set some special variables currently required by libpthread. Doing
-# it this way preserves the ability to compile libpthread during development
-# cycles with just "rumpmake"
+# set some special variables.
cat >> rumptools/mk.conf << EOF
+# maxphys = 32k is a Xen limitation (64k - overhead)
+CPPFLAGS+=-DMAXPHYS=32768
.if defined(LIB) && \${LIB} == "pthread"
-CPPFLAGS+= -D_PLATFORM_MAKECONTEXT=_lwp_rumpxen_makecontext
-CPPFLAGS+= -D_PLATFORM_GETTCB=_lwp_rumpxen_gettcb
+.PATH: $(pwd)
+PTHREAD_MAKELWP=pthread_makelwp_rumprunxen.c
+CPPFLAGS+= -D_PTHREAD_GETTCB_EXT=_lwp_rumpxen_gettcb
.endif # LIB == pthread
EOF
return 0;
}
-void _lwp_rumpxen_makecontext(ucontext_t *, void (*)(void *),
- void *, void *, void *, size_t);
void
-_lwp_rumpxen_makecontext(ucontext_t *nbuctx, void (*start)(void *),
- void *arg, void *private, void *stack_base, size_t stack_size)
+rumprunxen_makelwp(void (*start)(void *), void *arg, void *private,
+ void *stack_base, size_t stack_size, unsigned long flag, lwpid_t *lid)
{
struct schedulable *scd = private;
unsigned long thestack = (unsigned long)stack_base;
-
- scd->scd_start = start;
- scd->scd_arg = arg;
+ scd->scd_lwpid = ++curlwpid;
/* XXX: stack_base is not guaranteed to be aligned */
thestack = (thestack & ~(STACK_SIZE-1)) + STACK_SIZE;
- scd->scd_stack = (void *)thestack;
assert(stack_size == 2*STACK_SIZE);
- /* thread uctx -> schedulable mapping this way */
- *(struct schedulable **)nbuctx = scd;
+ scd->scd_thread = minios_create_thread("lwp", scd,
+ start, arg, (void *)thestack);
+ if (scd->scd_thread == NULL)
+ return EBUSY; /* ??? */
+ *lid = scd->scd_lwpid;
+ TAILQ_INSERT_TAIL(&scheds, scd, entries);
+ return 0;
}
static struct schedulable *
return NULL;
}
-int
-_lwp_create(const ucontext_t *ucp, unsigned long flags, lwpid_t *lid)
-{
- struct schedulable *scd = *(struct schedulable **)ucp;
- *lid = ++curlwpid;
-
- scd->scd_lwpid = *lid;
- scd->scd_thread = minios_create_thread("lwp", scd,
- scd->scd_start, scd->scd_arg, scd->scd_stack);
- if (scd->scd_thread == NULL)
- return EBUSY; /* ??? */
- TAILQ_INSERT_TAIL(&scheds, scd, entries);
-
- return 0;
-}
-
int
_lwp_unpark(lwpid_t lid, const void *hint)
{
--- /dev/null
+#include "pthread_makelwp.h"
+#include "rumprunxen_makelwp.h"
+
+int
+pthread__makelwp(void (*start)(void *), void *arg, void *private,
+ void *stack_base, size_t stack_size, unsigned long flags, lwpid_t *lid)
+{
+
+ return rumprunxen_makelwp(start, arg, private,
+ stack_base, stack_size, flags, lid);
+}