base: remove kernel-specific base/sleep.h

With this patch, the platform differences reside solely in the
implementation of the base library.

Issue #1832
This commit is contained in:
Norman Feske 2016-01-20 17:29:51 +01:00 committed by Christian Helmuth
parent 62b1c55399
commit be496c6dc1
13 changed files with 72 additions and 61 deletions

View File

@ -22,6 +22,7 @@ SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread

View File

@ -6,26 +6,23 @@
*/
/*
* Copyright (C) 2006-2014 Genode Labs GmbH
* Copyright (C) 2006-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__SLEEP_H_
#define _INCLUDE__BASE__SLEEP_H_
/* Genode includes */
#include <base/sleep.h>
#include <base/lock.h>
/* L4/Fiasco includes */
namespace Fiasco {
#include <l4/sys/ipc.h>
}
namespace Genode {
__attribute__((noreturn)) inline void sleep_forever()
{
while (true) Fiasco::l4_ipc_sleep((Fiasco::l4_timeout_t){0});
}
void Genode::sleep_forever()
{
while (true) Fiasco::l4_ipc_sleep((Fiasco::l4_timeout_t){0});
}
#endif /* _INCLUDE__BASE__SLEEP_H_ */

View File

@ -22,6 +22,7 @@ SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock

View File

@ -29,6 +29,7 @@ SRC_CC += thread/bootstrap.cc
SRC_CC += thread/trace.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += kernel/interface.cc
SRC_CC += sleep.cc
# add include paths
INC_DIR += $(REP_DIR)/src/base/lock

View File

@ -21,6 +21,7 @@ SRC_CC += signal/signal.cc signal/common.cc signal/platform.cc
SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/trace.cc thread/thread_env.cc thread/context_allocator.cc
SRC_CC += irq/platform.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock $(BASE_DIR)/src/base/lock
INC_DIR += $(REP_DIR)/src/base/ipc

View File

@ -1,41 +0,0 @@
/*
* \brief Lay back and relax
* \author Norman Feske
* \author Alexander Boettcher
* \date 2010-02-01
*/
/*
* Copyright (C) 2010-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__SLEEP_H_
#define _INCLUDE__BASE__SLEEP_H_
/* Genode includes */
#include <base/thread.h>
/* NOVA includes */
#include <nova/syscalls.h>
#include <nova/util.h>
namespace Genode {
__attribute__((noreturn)) inline void sleep_forever()
{
using namespace Nova;
Thread_base *myself = Thread_base::myself();
addr_t sem = myself ? myself->tid().exc_pt_sel + SM_SEL_EC : SM_SEL_EC;
while (1) {
if (Nova::sm_ctrl(sem, SEMAPHORE_DOWNZERO))
nova_die();
}
}
}
#endif /* _INCLUDE__BASE__SLEEP_H_ */

View File

@ -21,6 +21,7 @@ SRC_CC += server/server.cc
SRC_CC += thread/thread.cc thread/thread_context.cc thread/trace.cc
SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc env/cap_map.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock

View File

@ -0,0 +1,34 @@
/*
* \brief Lay back and relax
* \author Norman Feske
* \author Christian Helmuth
* \date 2006-07-19
*/
/*
* Copyright (C) 2006-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <base/sleep.h>
#include <base/lock.h>
/* NOVA includes */
#include <nova/syscalls.h>
#include <nova/util.h>
void Genode::sleep_forever()
{
using namespace Nova;
Thread_base *myself = Thread_base::myself();
addr_t sem = myself ? myself->tid().exc_pt_sel + SM_SEL_EC : SM_SEL_EC;
while (1) {
if (Nova::sm_ctrl(sem, SEMAPHORE_DOWNZERO))
nova_die();
}
}

View File

@ -22,6 +22,7 @@ SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/thread_bootstrap.cc thread/trace.cc
SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock

View File

@ -22,6 +22,7 @@ SRC_CC += server/server.cc server/common.cc
SRC_CC += thread/thread.cc thread/trace.cc thread/thread_bootstrap.cc
SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock

View File

@ -24,6 +24,7 @@ SRC_CC += thread/myself.cc
SRC_CC += thread/context_allocator.cc
SRC_CC += thread/thread_bootstrap.cc
SRC_CC += env/capability.cc
SRC_CC += sleep.cc
INC_DIR += $(REP_DIR)/src/base
INC_DIR += $(REP_DIR)/src/base/lock

View File

@ -15,15 +15,6 @@
#ifndef _INCLUDE__BASE__SLEEP_H_
#define _INCLUDE__BASE__SLEEP_H_
#include <base/lock.h>
namespace Genode {
__attribute__((noreturn)) inline void sleep_forever()
{
Lock sleep;
while (true) sleep.lock();
}
}
namespace Genode { __attribute__((noreturn)) void sleep_forever(); }
#endif /* _INCLUDE__BASE__SLEEP_H_ */

View File

@ -0,0 +1,22 @@
/*
* \brief Lay back and relax
* \author Norman Feske
* \author Christian Helmuth
* \date 2006-07-19
*/
/*
* Copyright (C) 2006-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <base/sleep.h>
#include <base/lock.h>
void Genode::sleep_forever()
{
Lock sleep;
while (true) sleep.lock();
}