diff --git a/repos/base-codezero/lib/mk/base.mk b/repos/base-codezero/lib/mk/base.mk index 1cd54b3fc1..7aea3ba229 100644 --- a/repos/base-codezero/lib/mk/base.mk +++ b/repos/base-codezero/lib/mk/base.mk @@ -1,4 +1,5 @@ SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread_start.cc diff --git a/repos/base-fiasco/lib/mk/base.mk b/repos/base-fiasco/lib/mk/base.mk index c364cd313e..2ea9bfcab0 100644 --- a/repos/base-fiasco/lib/mk/base.mk +++ b/repos/base-fiasco/lib/mk/base.mk @@ -7,6 +7,7 @@ LIBS += base-common SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread_start.cc diff --git a/repos/base-foc/lib/mk/base.mk b/repos/base-foc/lib/mk/base.mk index 93c6c060dd..44aa19f3ec 100644 --- a/repos/base-foc/lib/mk/base.mk +++ b/repos/base-foc/lib/mk/base.mk @@ -7,6 +7,7 @@ LIBS += base-common SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc \ env/cap_map_remove.cc env/cap_alloc.cc SRC_CC += thread/thread_start.cc diff --git a/repos/base-foc/src/base/cpu/cache.cc b/repos/base-foc/src/base/cpu/cache.cc new file mode 100644 index 0000000000..0cbbc5812d --- /dev/null +++ b/repos/base-foc/src/base/cpu/cache.cc @@ -0,0 +1,23 @@ +/* + * \brief Implementation of the cache operations + * \author Christian Prochaska + * \date 2014-05-13 + */ + +/* + * Copyright (C) 2014 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. + */ + +namespace Fiasco { +#include +} + +#include + +void Genode::cache_coherent(Genode::addr_t addr, Genode::size_t size) +{ + Fiasco::l4_cache_coherent(addr, addr + size); +} diff --git a/repos/base-hw/lib/mk/base.mk b/repos/base-hw/lib/mk/base.mk index 45094c4788..bd1d7242ae 100644 --- a/repos/base-hw/lib/mk/base.mk +++ b/repos/base-hw/lib/mk/base.mk @@ -7,6 +7,7 @@ LIBS += base-common startup SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread.cc thread_support.cc diff --git a/repos/base-hw/src/base/cpu/cache.cc b/repos/base-hw/src/base/cpu/cache.cc new file mode 100644 index 0000000000..a3fa969eab --- /dev/null +++ b/repos/base-hw/src/base/cpu/cache.cc @@ -0,0 +1,21 @@ +/* + * \brief Implementation of the cache operations + * \author Christian Prochaska + * \date 2014-05-13 + */ + +/* + * Copyright (C) 2014 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 + +#include + +void Genode::cache_coherent(Genode::addr_t addr, Genode::size_t size) +{ + Kernel::update_instr_region(addr, size); +} diff --git a/repos/base-linux/lib/mk/arm/base.mk b/repos/base-linux/lib/mk/arm/base.mk new file mode 100644 index 0000000000..c8020257b7 --- /dev/null +++ b/repos/base-linux/lib/mk/arm/base.mk @@ -0,0 +1,9 @@ +# +# \brief ARM-specific base lib parts that are not used by hybrid applications +# \author Christian Prochaska +# \date 2014-05-14 +# + +SRC_CC += cpu/arm/cache.cc + +include $(REP_DIR)/lib/mk/base.mk diff --git a/repos/base-linux/lib/mk/x86/base.mk b/repos/base-linux/lib/mk/x86/base.mk new file mode 100644 index 0000000000..3dbbc67cd0 --- /dev/null +++ b/repos/base-linux/lib/mk/x86/base.mk @@ -0,0 +1,9 @@ +# +# \brief x86-specific base lib parts that are not used by hybrid applications +# \author Christian Prochaska +# \date 2014-05-14 +# + +SRC_CC += cpu/cache.cc + +include $(REP_DIR)/lib/mk/base.mk diff --git a/repos/base-linux/src/base/cpu/arm/cache.cc b/repos/base-linux/src/base/cpu/arm/cache.cc new file mode 100644 index 0000000000..828ae1afed --- /dev/null +++ b/repos/base-linux/src/base/cpu/arm/cache.cc @@ -0,0 +1,21 @@ +/* + * \brief Implementation of the cache operations + * \author Christian Prochaska + * \date 2014-05-13 + */ + +/* + * Copyright (C) 2014 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 + +#include + +void Genode::cache_coherent(Genode::addr_t addr, Genode::size_t size) +{ + lx_syscall(__ARM_NR_cacheflush, addr, addr + size, 0); +} diff --git a/repos/base-nova/lib/mk/base.mk b/repos/base-nova/lib/mk/base.mk index a59981a15f..0b1ce6a00b 100644 --- a/repos/base-nova/lib/mk/base.mk +++ b/repos/base-nova/lib/mk/base.mk @@ -7,6 +7,7 @@ LIBS += base-common SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread_nova.cc diff --git a/repos/base-okl4/lib/mk/base.mk b/repos/base-okl4/lib/mk/base.mk index 2adc078d4d..91ace83206 100644 --- a/repos/base-okl4/lib/mk/base.mk +++ b/repos/base-okl4/lib/mk/base.mk @@ -1,4 +1,5 @@ SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread_start.cc diff --git a/repos/base-pistachio/lib/mk/base.mk b/repos/base-pistachio/lib/mk/base.mk index c364cd313e..2ea9bfcab0 100644 --- a/repos/base-pistachio/lib/mk/base.mk +++ b/repos/base-pistachio/lib/mk/base.mk @@ -7,6 +7,7 @@ LIBS += base-common SRC_CC += console/log_console.cc +SRC_CC += cpu/cache.cc SRC_CC += env/env.cc env/context_area.cc env/reinitialize.cc SRC_CC += thread/thread_start.cc diff --git a/repos/base/include/cpu/cache.h b/repos/base/include/cpu/cache.h new file mode 100644 index 0000000000..fdf24cb3d6 --- /dev/null +++ b/repos/base/include/cpu/cache.h @@ -0,0 +1,28 @@ +/* + * \brief Cache operations + * \author Christian Prochaska + * \date 2014-05-13 + */ + +/* + * Copyright (C) 2014 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__CPU__CACHE_H_ +#define _INCLUDE__CPU__CACHE_H_ + +#include + +namespace Genode { + + /* + * Make D-Cache and I-Cache coherent + */ + void cache_coherent(Genode::addr_t addr, Genode::size_t size); + +} + +#endif /* _INCLUDE__CPU__CACHE_H_ */ diff --git a/repos/base/src/base/cpu/cache.cc b/repos/base/src/base/cpu/cache.cc new file mode 100644 index 0000000000..7d4950ae76 --- /dev/null +++ b/repos/base/src/base/cpu/cache.cc @@ -0,0 +1,21 @@ +/* + * \brief Implementation of the cache operations + * \author Christian Prochaska + * \date 2014-05-13 + */ + +/* + * Copyright (C) 2014 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 + +/* + * This function needs to be implemented only for base platforms with ARM + * support right now, so the default implementation does nothing. + */ +void cache_coherent(Genode::addr_t, Genode::size_t) { } +