mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-22 10:21:04 +00:00
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:
parent
62b1c55399
commit
be496c6dc1
@ -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
|
||||
|
@ -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_ */
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
@ -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
|
||||
|
34
repos/base-nova/src/base/sleep.cc
Normal file
34
repos/base-nova/src/base/sleep.cc
Normal 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();
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
||||
|
22
repos/base/src/base/sleep.cc
Normal file
22
repos/base/src/base/sleep.cc
Normal 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();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user