Module Name: src Committed By: alnsn Date: Wed Jul 23 07:16:14 UTC 2014
Modified Files: src/external/bsd/sljit: Makefile.inc src/sys/rump/kern/lib/libsljit: Makefile Added Files: src/sys/rump/kern/lib/libsljit/arch/arm: cpufunc.c sljit_rump.c Log Message: Implement rumpcomp_sync_icache() hyprecall for arm and add a barebone implementation of arm cache ops to librumpkern_sljit. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/sljit/Makefile.inc cvs rdiff -u -r1.2 -r1.3 src/sys/rump/kern/lib/libsljit/Makefile cvs rdiff -u -r0 -r1.1 src/sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c \ src/sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/sljit/Makefile.inc diff -u src/external/bsd/sljit/Makefile.inc:1.1 src/external/bsd/sljit/Makefile.inc:1.2 --- src/external/bsd/sljit/Makefile.inc:1.1 Mon Nov 5 00:23:18 2012 +++ src/external/bsd/sljit/Makefile.inc Wed Jul 23 07:16:14 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.1 2012/11/05 00:23:18 alnsn Exp $ +# $NetBSD: Makefile.inc,v 1.2 2014/07/23 07:16:14 alnsn Exp $ .include <bsd.own.mk> @@ -6,3 +6,9 @@ SLJITDIST= ${NETBSDSRCDIR}/sys/external/ LIBSLJITDIR!= cd ${NETBSDSRCDIR}/external/bsd/sljit/lib && ${PRINTOBJDIR} CPPFLAGS+= -I${SLJITDIST}/sljit_src + +# Link to libarm to get arm_sync_icache(2), for mips it's not +# required because _cacheflush() is in libc. +.if !empty(MACHINE_ARCH:Marm*) || !empty(MACHINE_ARCH:Mearm*) +LDADD+= -larm +.endif Index: src/sys/rump/kern/lib/libsljit/Makefile diff -u src/sys/rump/kern/lib/libsljit/Makefile:1.2 src/sys/rump/kern/lib/libsljit/Makefile:1.3 --- src/sys/rump/kern/lib/libsljit/Makefile:1.2 Tue Jul 22 20:25:13 2014 +++ src/sys/rump/kern/lib/libsljit/Makefile Wed Jul 23 07:16:14 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2014/07/22 20:25:13 alnsn Exp $ +# $NetBSD: Makefile,v 1.3 2014/07/23 07:16:14 alnsn Exp $ # # Public Domain. # @@ -23,5 +23,17 @@ RUMPCOMP_INCS_DIR:= ${.PARSEDIR} RUMPCOMP_USER_CPPFLAGS=-I${RUMPCOMP_INCS_DIR} .endif +.if !empty(MACHINE_ARCH:Marm*) || !empty(MACHINE_ARCH:Mearm*) +SRCS+= cpufunc.c +RUMPCOMP_USER_SRCS= sljit_rump.c +.PATH: ${.CURDIR}/arch/arm + +RUMPCOMP_INCS_DIR:= ${.PARSEDIR} +RUMPCOMP_USER_CPPFLAGS=-I${RUMPCOMP_INCS_DIR} + +# Link to libarm to get arm_sync_icache(2) +LDADD+= -larm +.endif + .include <bsd.lib.mk> .include <bsd.klinks.mk> Added files: Index: src/sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c diff -u /dev/null src/sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c:1.1 --- /dev/null Wed Jul 23 07:16:14 2014 +++ src/sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c Wed Jul 23 07:16:14 2014 @@ -0,0 +1,52 @@ +/* $NetBSD: cpufunc.c,v 1.1 2014/07/23 07:16:14 alnsn Exp $ */ + +/*- + * Copyright (c) 2014 Alexander Nasonov. + * 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 ``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> +__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.1 2014/07/23 07:16:14 alnsn Exp $"); + +/* + * Barebone implementation of arm cpufunc routines for rump. + */ + +#include <machine/types.h> +#include <arm/cpufunc.h> + +#include "sljit_rump.h" + +static void icache_sync_range(vaddr_t, vsize_t); + +struct cpu_functions cpufuncs = { + .cf_icache_sync_range = &icache_sync_range +}; + +static void +icache_sync_range(vaddr_t va, vsize_t sz) +{ + + (void)rumpcomp_sync_icache((void *)va, (uint64_t)sz); +} Index: src/sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c diff -u /dev/null src/sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c:1.1 --- /dev/null Wed Jul 23 07:16:14 2014 +++ src/sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c Wed Jul 23 07:16:14 2014 @@ -0,0 +1,47 @@ +/* $NetBSD: sljit_rump.c,v 1.1 2014/07/23 07:16:14 alnsn Exp $ */ + +/*- + * Copyright (c) 2014 Alexander Nasonov. + * 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 ``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> +__KERNEL_RCSID(0, "$NetBSD: sljit_rump.c,v 1.1 2014/07/23 07:16:14 alnsn Exp $"); + +#ifndef _KERNEL + +#include <sys/types.h> + +#include <machine/sysarch.h> +#include <machine/types.h> + +#include "sljit_rump.h" + +int +rumpcomp_sync_icache(void *addr, uint64_t len) +{ + + return arm_sync_icache((uintptr_t)addr, (size_t)len); +} +#endif