Module Name:    src
Committed By:   alnsn
Date:           Tue Jun 17 06:31:47 UTC 2014

Modified Files:
        src/lib/librumpuser: Makefile
        src/sys/rump/include/rump: rumpuser.h
        src/sys/rump/librump/rumpkern/arch/arm: Makefile.inc
Added Files:
        src/lib/librumpuser: rumpuser_cache.c
        src/sys/rump/librump/rumpkern/arch/arm: cpufunc.c

Log Message:
Implement rumpuser_sync_icache hypercall.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/librumpuser/Makefile
cvs rdiff -u -r0 -r1.1 src/lib/librumpuser/rumpuser_cache.c
cvs rdiff -u -r1.111 -r1.112 src/sys/rump/include/rump/rumpuser.h
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpkern/arch/arm/cpufunc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/Makefile
diff -u src/lib/librumpuser/Makefile:1.16 src/lib/librumpuser/Makefile:1.17
--- src/lib/librumpuser/Makefile:1.16	Thu Feb 20 00:42:27 2014
+++ src/lib/librumpuser/Makefile	Tue Jun 17 06:31:47 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2014/02/20 00:42:27 pooka Exp $
+#	$NetBSD: Makefile,v 1.17 2014/06/17 06:31:47 alnsn Exp $
 #
 
 .include <bsd.own.mk>
@@ -20,6 +20,7 @@ CPPFLAGS+=	-DLIBRUMPUSER
 SRCS=		rumpuser.c
 SRCS+=		rumpuser_pth.c
 SRCS+=		rumpuser_component.c rumpuser_bio.c
+SRCS+=		rumpuser_cache.c
 
 SRCS+=		rumpuser_errtrans.c rumpuser_sigtrans.c
 

Index: src/sys/rump/include/rump/rumpuser.h
diff -u src/sys/rump/include/rump/rumpuser.h:1.111 src/sys/rump/include/rump/rumpuser.h:1.112
--- src/sys/rump/include/rump/rumpuser.h:1.111	Sun Apr 27 15:18:59 2014
+++ src/sys/rump/include/rump/rumpuser.h	Tue Jun 17 06:31:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser.h,v 1.111 2014/04/27 15:18:59 pooka Exp $	*/
+/*	$NetBSD: rumpuser.h,v 1.112 2014/06/17 06:31:47 alnsn Exp $	*/
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -229,6 +229,11 @@ typedef void (*rump_compload_fn)(const s
 void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn);
 
 /*
+ * cache management
+ */
+int rumpuser_sync_icache(void *addr, uint64_t len);
+
+/*
  * misc management
  */
 

Index: src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.2 src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.3
--- src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.2	Wed Feb 12 22:28:43 2014
+++ src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc	Tue Jun 17 06:31:47 2014
@@ -1,7 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.2 2014/02/12 22:28:43 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.3 2014/06/17 06:31:47 alnsn Exp $
 
 CPPFLAGS+=	-DARCH_ELFSIZE=32
 
+SRCS+=		cpufunc.c
+
 .PATH:  ${RUMPTOP}/../arch/arm/arm32
 SRCS+=  	kobj_machdep.c
 

Added files:

Index: src/lib/librumpuser/rumpuser_cache.c
diff -u /dev/null src/lib/librumpuser/rumpuser_cache.c:1.1
--- /dev/null	Tue Jun 17 06:31:47 2014
+++ src/lib/librumpuser/rumpuser_cache.c	Tue Jun 17 06:31:47 2014
@@ -0,0 +1,61 @@
+/*	$NetBSD: rumpuser_cache.c,v 1.1 2014/06/17 06:31:47 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 "rumpuser_port.h"
+
+#if !defined(lint)
+__RCSID("$NetBSD: rumpuser_cache.c,v 1.1 2014/06/17 06:31:47 alnsn Exp $");
+#endif /* !lint */
+
+#include <sys/types.h>
+
+#include <machine/sysarch.h>
+#include <machine/types.h>
+
+#include <rump/rumpuser.h>
+
+
+int
+rumpuser_sync_icache(void *addr, uint64_t len)
+{
+#if defined(__arm__)
+	/*
+	 * arm_sync_icache is recommended over sysarch but
+	 * it adds a link dependency -l${MACHINE_CPU}.
+	 */
+	struct arm_sync_icache_args args;
+
+	args.addr = (uintptr_t)addr;
+	args.len = (size_t)len;
+
+	return sysarch(ARM_SYNC_ICACHE, (void *)&args);
+#else /* XXX mips_icache_sync_range */
+
+	return 0;
+#endif
+}

Index: src/sys/rump/librump/rumpkern/arch/arm/cpufunc.c
diff -u /dev/null src/sys/rump/librump/rumpkern/arch/arm/cpufunc.c:1.1
--- /dev/null	Tue Jun 17 06:31:47 2014
+++ src/sys/rump/librump/rumpkern/arch/arm/cpufunc.c	Tue Jun 17 06:31:47 2014
@@ -0,0 +1,52 @@
+/*	$NetBSD: cpufunc.c,v 1.1 2014/06/17 06:31:47 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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/06/17 06:31:47 alnsn Exp $");
+
+/*
+ * Barebone implementation of arm cpufunc routines for rump.
+ */
+
+#include <machine/types.h>
+#include <arm/cpufunc.h>
+
+#include <rump/rumpuser.h>
+
+static void rump_icache_sync_range(vaddr_t, vsize_t);
+
+struct cpu_functions cpufuncs = {
+	.cf_icache_sync_range = &rump_icache_sync_range
+};
+
+static void
+rump_icache_sync_range(vaddr_t va, vsize_t sz)
+{
+
+	(void)rumpuser_sync_icache((void *)va, (uint64_t)sz);
+}

Reply via email to