No point in having our private atomic ops, just use the ones now
available in libc.
This commit is contained in:
parent
59334248e2
commit
d22cdb027a
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.rumpkern,v 1.9 2008/09/30 19:25:56 pooka Exp $
|
||||
# $NetBSD: Makefile.rumpkern,v 1.10 2008/10/09 17:58:33 pooka Exp $
|
||||
#
|
||||
|
||||
.include "${RUMPTOP}/Makefile.rump"
|
||||
@ -15,7 +15,7 @@ INCS+= rump.h rumpdefs.h rump_syscalls.h rumpvnode_if.h
|
||||
${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs
|
||||
|
||||
# implement something
|
||||
SRCS= rump.c atomic.c emul.c intr.c genfs_io.c locks.c \
|
||||
SRCS= rump.c emul.c intr.c genfs_io.c locks.c \
|
||||
ltsleep.c pool.c specfs.c vfs.c vm.c
|
||||
|
||||
# just stubs
|
||||
|
@ -1,90 +0,0 @@
|
||||
/* $NetBSD: atomic.c,v 1.5 2008/07/29 13:17:47 pooka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Andrew Doran.
|
||||
*
|
||||
* 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/param.h>
|
||||
#include <sys/atomic.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
#include <rump/rump.h>
|
||||
#include <rump/rumpuser.h>
|
||||
|
||||
kmutex_t rump_atomic_lock;
|
||||
|
||||
void
|
||||
atomic_add_int(volatile unsigned *ptr, int val)
|
||||
{
|
||||
|
||||
mutex_enter(&rump_atomic_lock);
|
||||
(*ptr) += val;
|
||||
mutex_exit(&rump_atomic_lock);
|
||||
}
|
||||
|
||||
void
|
||||
atomic_inc_uint(volatile unsigned *ptr)
|
||||
{
|
||||
|
||||
mutex_enter(&rump_atomic_lock);
|
||||
(*ptr)++;
|
||||
mutex_exit(&rump_atomic_lock);
|
||||
}
|
||||
|
||||
void
|
||||
atomic_dec_uint(volatile unsigned *ptr)
|
||||
{
|
||||
|
||||
mutex_enter(&rump_atomic_lock);
|
||||
(*ptr)--;
|
||||
mutex_exit(&rump_atomic_lock);
|
||||
}
|
||||
|
||||
unsigned
|
||||
atomic_inc_uint_nv(volatile unsigned *ptr)
|
||||
{
|
||||
unsigned rv;
|
||||
|
||||
mutex_enter(&rump_atomic_lock);
|
||||
rv = (++(*ptr));
|
||||
mutex_exit(&rump_atomic_lock);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
unsigned
|
||||
atomic_dec_uint_nv(volatile unsigned *ptr)
|
||||
{
|
||||
unsigned rv;
|
||||
|
||||
mutex_enter(&rump_atomic_lock);
|
||||
rv = (--(*ptr));
|
||||
mutex_exit(&rump_atomic_lock);
|
||||
|
||||
return rv;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rump.c,v 1.61 2008/10/07 23:21:02 pooka Exp $ */
|
||||
/* $NetBSD: rump.c,v 1.62 2008/10/09 17:58:33 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
@ -93,7 +93,6 @@ _rump_init(int rump_version)
|
||||
{
|
||||
extern char hostname[];
|
||||
extern size_t hostnamelen;
|
||||
extern kmutex_t rump_atomic_lock;
|
||||
char buf[256];
|
||||
struct proc *p;
|
||||
struct lwp *l;
|
||||
@ -119,8 +118,6 @@ _rump_init(int rump_version)
|
||||
rump_threads = *buf != '0';
|
||||
}
|
||||
|
||||
mutex_init(&rump_atomic_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
|
||||
rumpvm_init();
|
||||
rump_sleepers_init();
|
||||
#ifdef RUMP_USE_REAL_KMEM
|
||||
|
Loading…
Reference in New Issue
Block a user