Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Implement rumpcomp_sync_icache() hyprecall for arm and add



details:   https://anonhg.NetBSD.org/src/rev/c16bf658fd34
branches:  trunk
changeset: 330828:c16bf658fd34
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Wed Jul 23 07:16:14 2014 +0000

description:
Implement rumpcomp_sync_icache() hyprecall for arm and add
a barebone implementation of arm cache ops to librumpkern_sljit.

diffstat:

 external/bsd/sljit/Makefile.inc                  |   8 +++-
 sys/rump/kern/lib/libsljit/Makefile              |  14 ++++++-
 sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c    |  52 ++++++++++++++++++++++++
 sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c |  47 +++++++++++++++++++++
 4 files changed, 119 insertions(+), 2 deletions(-)

diffs (153 lines):

diff -r b87aac856802 -r c16bf658fd34 external/bsd/sljit/Makefile.inc
--- a/external/bsd/sljit/Makefile.inc   Wed Jul 23 06:10:40 2014 +0000
+++ b/external/bsd/sljit/Makefile.inc   Wed Jul 23 07:16:14 2014 +0000
@@ -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 @@
 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
diff -r b87aac856802 -r c16bf658fd34 sys/rump/kern/lib/libsljit/Makefile
--- a/sys/rump/kern/lib/libsljit/Makefile       Wed Jul 23 06:10:40 2014 +0000
+++ b/sys/rump/kern/lib/libsljit/Makefile       Wed Jul 23 07:16:14 2014 +0000
@@ -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_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>
diff -r b87aac856802 -r c16bf658fd34 sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsljit/arch/arm/cpufunc.c     Wed Jul 23 07:16:14 2014 +0000
@@ -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);
+}
diff -r b87aac856802 -r c16bf658fd34 sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/kern/lib/libsljit/arch/arm/sljit_rump.c  Wed Jul 23 07:16:14 2014 +0000
@@ -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



Home | Main Index | Thread Index | Old Index