Implement rumpuser_sync_icache hypercall.
This commit is contained in:
parent
369c9ae716
commit
bb8c3186cb
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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.
|
||||
|
@ -228,6 +228,11 @@ typedef int (*rump_symload_fn)(void *, uint64_t, char *, uint64_t);
|
|||
typedef void (*rump_compload_fn)(const struct rump_component *);
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue