Index: head/lib/libc/aarch64/Symbol.map =================================================================== --- head/lib/libc/aarch64/Symbol.map (revision 285351) +++ head/lib/libc/aarch64/Symbol.map (revision 285352) @@ -1,38 +1,40 @@ /* * $FreeBSD$ */ /* * This only needs to contain symbols that are not listed in * symbol maps from other parts of libc (i.e., not found in * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...). */ FBSD_1.0 { /* PSEUDO syscalls */ _exit; _setjmp; _longjmp; fabs; __flt_rounds; fpgetmask; fpsetmask; setjmp; longjmp; sigsetjmp; siglongjmp; htonl; htons; ntohl; ntohs; vfork; brk; sbrk; + makecontext; }; FBSDprivate_1.0 { _set_tp; _end; curbrk; minbrk; + __makecontext; }; Index: head/lib/libc/aarch64/gen/Makefile.inc =================================================================== --- head/lib/libc/aarch64/gen/Makefile.inc (revision 285351) +++ head/lib/libc/aarch64/gen/Makefile.inc (revision 285352) @@ -1,12 +1,14 @@ # $FreeBSD$ -SRCS+= fabs.S \ +SRCS+= _ctx_start.S \ + fabs.S \ flt_rounds.c \ fpgetmask.c \ fpsetmask.c \ ldexp.c \ + makecontext.c \ _setjmp.S \ _set_tp.c \ setjmp.S \ sigsetjmp.S \ trivial-getcontextx.c Index: head/lib/libc/aarch64/gen/_ctx_start.S =================================================================== --- head/lib/libc/aarch64/gen/_ctx_start.S (nonexistent) +++ head/lib/libc/aarch64/gen/_ctx_start.S (revision 285352) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2015 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * 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 +__FBSDID("$FreeBSD$"); + +ENTRY(_ctx_start) + blr x19 /* Call func from makecontext */ + mov x0, x20 /* Load ucp saved in makecontext */ + bl _C_LABEL(ctx_done) + bl _C_LABEL(abort) +END(_ctx_start) Property changes on: head/lib/libc/aarch64/gen/_ctx_start.S ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/lib/libc/aarch64/gen/makecontext.c =================================================================== --- head/lib/libc/aarch64/gen/makecontext.c (nonexistent) +++ head/lib/libc/aarch64/gen/makecontext.c (revision 285352) @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2015 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Andrew Turner under + * sponsorship from the FreeBSD Foundation. + * + * 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 +__FBSDID("$FreeBSD$"); + +#include + +#include + +#include +#include +#include +#include + +void _ctx_start(void); + +void +ctx_done(ucontext_t *ucp) +{ + + if (ucp->uc_link == NULL) { + exit(0); + } else { + setcontext((const ucontext_t *)ucp->uc_link); + abort(); + } +} + +__weak_reference(__makecontext, makecontext); + +void +__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) +{ + struct gpregs *gp; + va_list ap; + int i; + + /* A valid context is required. */ + if (ucp == NULL) + return; + + if ((argc < 0) || (argc > 8)) + return; + + gp = &ucp->uc_mcontext.mc_gpregs; + + va_start(ap, argc); + /* Pass up to eight arguments in x0-7. */ + for (i = 0; i < argc && i < 8; i++) + gp->gp_x[i] = va_arg(ap, uint64_t); + va_end(ap); + + /* Set the stack */ + gp->gp_sp = STACKALIGN(ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); + /* Arrange for return via the trampoline code. */ + gp->gp_elr = (__register_t)_ctx_start; + gp->gp_x[19] = (__register_t)func; + gp->gp_x[20] = (__register_t)ucp; +} Property changes on: head/lib/libc/aarch64/gen/makecontext.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/lib/libc/tests/sys/Makefile =================================================================== --- head/lib/libc/tests/sys/Makefile (revision 285351) +++ head/lib/libc/tests/sys/Makefile (revision 285352) @@ -1,87 +1,85 @@ # $FreeBSD$ .include TESTSDIR= ${TESTSBASE}/lib/libc/sys # TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg, # swapcontext NETBSD_ATF_TESTS_C+= access_test NETBSD_ATF_TESTS_C+= chroot_test NETBSD_ATF_TESTS_C+= clock_gettime_test NETBSD_ATF_TESTS_C+= connect_test NETBSD_ATF_TESTS_C+= dup_test NETBSD_ATF_TESTS_C+= fsync_test -.if ${MACHINE} != "arm64" # ARM64TODO: Missing makecontext NETBSD_ATF_TESTS_C+= getcontext_test -.endif NETBSD_ATF_TESTS_C+= getgroups_test NETBSD_ATF_TESTS_C+= getitimer_test NETBSD_ATF_TESTS_C+= getlogin_test NETBSD_ATF_TESTS_C+= getpid_test NETBSD_ATF_TESTS_C+= getrusage_test NETBSD_ATF_TESTS_C+= getsid_test NETBSD_ATF_TESTS_C+= gettimeofday_test NETBSD_ATF_TESTS_C+= issetugid_test NETBSD_ATF_TESTS_C+= kevent_test NETBSD_ATF_TESTS_C+= kill_test NETBSD_ATF_TESTS_C+= link_test NETBSD_ATF_TESTS_C+= listen_test NETBSD_ATF_TESTS_C+= mincore_test NETBSD_ATF_TESTS_C+= mkdir_test NETBSD_ATF_TESTS_C+= mkfifo_test NETBSD_ATF_TESTS_C+= mknod_test NETBSD_ATF_TESTS_C+= mlock_test NETBSD_ATF_TESTS_C+= mmap_test NETBSD_ATF_TESTS_C+= mprotect_test NETBSD_ATF_TESTS_C+= msgctl_test NETBSD_ATF_TESTS_C+= msgget_test NETBSD_ATF_TESTS_C+= msgrcv_test NETBSD_ATF_TESTS_C+= msgsnd_test NETBSD_ATF_TESTS_C+= msync_test NETBSD_ATF_TESTS_C+= nanosleep_test NETBSD_ATF_TESTS_C+= pipe_test NETBSD_ATF_TESTS_C+= pipe2_test NETBSD_ATF_TESTS_C+= poll_test NETBSD_ATF_TESTS_C+= revoke_test NETBSD_ATF_TESTS_C+= select_test NETBSD_ATF_TESTS_C+= setrlimit_test NETBSD_ATF_TESTS_C+= setuid_test NETBSD_ATF_TESTS_C+= sigaction_test NETBSD_ATF_TESTS_C+= sigqueue_test NETBSD_ATF_TESTS_C+= sigtimedwait_test NETBSD_ATF_TESTS_C+= socketpair_test NETBSD_ATF_TESTS_C+= stat_test NETBSD_ATF_TESTS_C+= timer_create_test NETBSD_ATF_TESTS_C+= truncate_test NETBSD_ATF_TESTS_C+= ucontext_test NETBSD_ATF_TESTS_C+= umask_test NETBSD_ATF_TESTS_C+= unlink_test NETBSD_ATF_TESTS_C+= write_test DPADD.getpid_test+= ${LIBPTHREAD} LDADD.getpid_test+= -lpthread DPADD.timer_create_test+= ${LIBRT} LDADD.timer_create_test+= -lrt .include "../Makefile.netbsd-tests" .if ${COMPILER_TYPE} == "gcc" WARNS?= 3 .else WARNS?= 4 .endif FILESGROUPS= FILES truncate_test_FILES truncate_test_FILES= truncate_test.root_owned truncate_test_FILESDIR= ${TESTSDIR} truncate_test_FILESMODE= 0600 truncate_test_FILESOWNER= root truncate_test_FILESGRP= wheel CLEANFILES= truncate_test.root_owned truncate_test.root_owned: dd if=/dev/null bs=1 count=1 of=${.TARGET} .include