From 76db3b9c062a0fb78c1b74399086583482d39fa1 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 3 Mar 2016 17:57:29 +0100 Subject: [PATCH] base: retire 'Native_config' This commit moves the parameters of the stack area to the base-internal header 'stack_area.h'. Issue #1832 --- repos/base-fiasco/include/base/native_types.h | 17 +-------- repos/base-fiasco/src/core/platform.cc | 9 +++-- repos/base-foc/include/base/native_types.h | 1 - .../include/spec/arm/base/native_config.h | 38 ------------------- .../include/spec/x86/base/native_config.h | 38 ------------------- .../mk/{base-common.mk => base-common.inc} | 0 repos/base-foc/lib/mk/{base.mk => base.inc} | 0 repos/base-foc/lib/mk/spec/arm/base-common.mk | 4 ++ repos/base-foc/lib/mk/spec/arm/base.mk | 4 ++ repos/base-foc/lib/mk/spec/x86/base-common.mk | 1 + repos/base-foc/lib/mk/spec/x86/base.mk | 1 + repos/base-foc/src/core/include/platform_pd.h | 7 +++- repos/base-foc/src/core/platform.cc | 9 +++-- repos/base-foc/src/core/spec/arm/target.inc | 3 ++ .../spec/arm/base/internal/stack_area.h | 33 ++++++++++++++++ repos/base-hw/include/base/native_types.h | 19 ---------- repos/base-hw/src/base/thread/start.cc | 8 ++-- repos/base-hw/src/core/platform.cc | 8 ++-- .../src/include/base/internal/stack_area.h | 26 +++++++++++++ repos/base-linux/include/base/native_types.h | 30 --------------- .../src/base/env/rm_session_mmap.cc | 4 +- repos/base-linux/src/core/stack_area.cc | 3 +- .../src/include/base/internal/stack_area.h | 29 +++++++++++--- repos/base-nova/include/base/native_types.h | 16 -------- repos/base-nova/src/base/thread/stack.cc | 4 +- repos/base-nova/src/core/platform.cc | 29 +++++++------- repos/base-nova/src/core/platform_thread.cc | 6 ++- .../src/include/base/internal/stack_area.h | 26 +++++++++++++ repos/base-okl4/include/base/native_types.h | 16 -------- repos/base-okl4/src/core/platform.cc | 5 ++- .../include/base/native_types.h | 16 -------- repos/base-pistachio/src/core/platform.cc | 9 +++-- repos/base-sel4/include/base/native_types.h | 16 -------- repos/base-sel4/src/core/platform.cc | 7 +++- repos/base-sel4/src/core/stack_area.cc | 5 ++- repos/base/include/base/thread.h | 15 ++++++++ repos/base/src/base/env/stack_area.cc | 7 ++-- repos/base/src/base/thread/myself.cc | 6 +-- repos/base/src/base/thread/stack_allocator.cc | 12 +++--- repos/base/src/base/thread/thread.cc | 30 +++++++++++---- repos/base/src/core/stack_area.cc | 13 ++++--- .../include/base/internal/stack_allocator.h | 5 ++- .../src/include/base/internal/stack_area.h | 26 +++++++++++++ repos/base/src/lib/ldso/main.cc | 10 +++-- repos/base/src/test/thread/main.cc | 10 ++--- repos/ports-foc/src/lib/l4lx/startup.cc | 4 +- repos/ports/src/app/seoul/main.cc | 8 ++-- repos/ports/src/virtualbox/thread.cc | 2 +- 48 files changed, 292 insertions(+), 303 deletions(-) delete mode 100644 repos/base-foc/include/spec/arm/base/native_config.h delete mode 100644 repos/base-foc/include/spec/x86/base/native_config.h rename repos/base-foc/lib/mk/{base-common.mk => base-common.inc} (100%) rename repos/base-foc/lib/mk/{base.mk => base.inc} (100%) create mode 100644 repos/base-foc/lib/mk/spec/arm/base-common.mk create mode 100644 repos/base-foc/lib/mk/spec/arm/base.mk create mode 100644 repos/base-foc/lib/mk/spec/x86/base-common.mk create mode 100644 repos/base-foc/lib/mk/spec/x86/base.mk create mode 100644 repos/base-foc/src/include/spec/arm/base/internal/stack_area.h create mode 100644 repos/base-hw/src/include/base/internal/stack_area.h create mode 100644 repos/base-nova/src/include/base/internal/stack_area.h create mode 100644 repos/base/src/include/base/internal/stack_area.h diff --git a/repos/base-fiasco/include/base/native_types.h b/repos/base-fiasco/include/base/native_types.h index e0861c2d7d..a54adcb1b2 100644 --- a/repos/base-fiasco/include/base/native_types.h +++ b/repos/base-fiasco/include/base/native_types.h @@ -14,6 +14,7 @@ #ifndef _INCLUDE__BASE__NATIVE_TYPES_H_ #define _INCLUDE__BASE__NATIVE_TYPES_H_ +/* Genode includes */ #include #include @@ -73,22 +74,6 @@ namespace Genode { typedef Native_capability_tpl Native_capability; typedef Fiasco::l4_threadid_t Native_connection_state; - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x40000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - struct Native_pd_args { }; } diff --git a/repos/base-fiasco/src/core/platform.cc b/repos/base-fiasco/src/core/platform.cc index 40e8098393..fb98694df3 100644 --- a/repos/base-fiasco/src/core/platform.cc +++ b/repos/base-fiasco/src/core/platform.cc @@ -20,6 +20,7 @@ /* base-internal includes */ #include #include +#include /* core includes */ #include @@ -306,8 +307,8 @@ void Platform::_setup_mem_alloc() } region.start = addr; region.end = addr + size; - if (!region.intersects(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size())) { + if (!region.intersects(stack_area_virtual_base(), + stack_area_virtual_size())) { add_region(region, _ram_alloc); add_region(region, _core_address_ranges()); } @@ -412,8 +413,8 @@ void Platform::_setup_basics() _region_alloc.add_range(_vm_start, _vm_size); /* preserve stack area in core's virtual address space */ - _region_alloc.remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _region_alloc.remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); /* I/O memory could be the whole user address space */ /* FIXME if the kernel helps to find out max address - use info here */ diff --git a/repos/base-foc/include/base/native_types.h b/repos/base-foc/include/base/native_types.h index 257ab9cf43..c11c967214 100644 --- a/repos/base-foc/include/base/native_types.h +++ b/repos/base-foc/include/base/native_types.h @@ -14,7 +14,6 @@ #ifndef _INCLUDE__BASE__NATIVE_TYPES_H_ #define _INCLUDE__BASE__NATIVE_TYPES_H_ -#include #include namespace Fiasco { diff --git a/repos/base-foc/include/spec/arm/base/native_config.h b/repos/base-foc/include/spec/arm/base/native_config.h deleted file mode 100644 index 84aa2f0da5..0000000000 --- a/repos/base-foc/include/spec/arm/base/native_config.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * \brief Platform-specific stack area definitions - * \author Stefan Kalkowski - * \date 2014-01-24 - */ - -/* - * 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__SPEC__ARM__BASE__NATIVE_CONFIG_H_ -#define _INCLUDE__SPEC__ARM__BASE__NATIVE_CONFIG_H_ - -#include - -namespace Genode { - - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x20000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; -} - -#endif /* _INCLUDE__SPEC__ARM__BASE__NATIVE_CONFIG_H_ */ diff --git a/repos/base-foc/include/spec/x86/base/native_config.h b/repos/base-foc/include/spec/x86/base/native_config.h deleted file mode 100644 index 3036ae8603..0000000000 --- a/repos/base-foc/include/spec/x86/base/native_config.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * \brief Platform-specific stack area definitions - * \author Stefan Kalkowski - * \date 2014-01-24 - */ - -/* - * 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__SPEC__X86__BASE__NATIVE_CONFIG_H_ -#define _INCLUDE__SPEC__X86__BASE__NATIVE_CONFIG_H_ - -#include - -namespace Genode { - - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x40000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; -} - -#endif /* _INCLUDE__SPEC__X86__BASE__NATIVE_CONFIG_H_ */ diff --git a/repos/base-foc/lib/mk/base-common.mk b/repos/base-foc/lib/mk/base-common.inc similarity index 100% rename from repos/base-foc/lib/mk/base-common.mk rename to repos/base-foc/lib/mk/base-common.inc diff --git a/repos/base-foc/lib/mk/base.mk b/repos/base-foc/lib/mk/base.inc similarity index 100% rename from repos/base-foc/lib/mk/base.mk rename to repos/base-foc/lib/mk/base.inc diff --git a/repos/base-foc/lib/mk/spec/arm/base-common.mk b/repos/base-foc/lib/mk/spec/arm/base-common.mk new file mode 100644 index 0000000000..c64aa57068 --- /dev/null +++ b/repos/base-foc/lib/mk/spec/arm/base-common.mk @@ -0,0 +1,4 @@ +# override default stack-area location +INC_DIR += $(REP_DIR)/src/include/spec/arm + +include $(REP_DIR)/lib/mk/base-common.inc diff --git a/repos/base-foc/lib/mk/spec/arm/base.mk b/repos/base-foc/lib/mk/spec/arm/base.mk new file mode 100644 index 0000000000..250a6a96db --- /dev/null +++ b/repos/base-foc/lib/mk/spec/arm/base.mk @@ -0,0 +1,4 @@ +# override default stack-area location +INC_DIR += $(REP_DIR)/src/include/spec/arm + +include $(REP_DIR)/lib/mk/base.inc diff --git a/repos/base-foc/lib/mk/spec/x86/base-common.mk b/repos/base-foc/lib/mk/spec/x86/base-common.mk new file mode 100644 index 0000000000..7c6d23984f --- /dev/null +++ b/repos/base-foc/lib/mk/spec/x86/base-common.mk @@ -0,0 +1 @@ +include $(REP_DIR)/lib/mk/base-common.inc diff --git a/repos/base-foc/lib/mk/spec/x86/base.mk b/repos/base-foc/lib/mk/spec/x86/base.mk new file mode 100644 index 0000000000..50d968e030 --- /dev/null +++ b/repos/base-foc/lib/mk/spec/x86/base.mk @@ -0,0 +1 @@ +include $(REP_DIR)/lib/mk/base.inc diff --git a/repos/base-foc/src/core/include/platform_pd.h b/repos/base-foc/src/core/include/platform_pd.h index 4d362667a3..6a043616f3 100644 --- a/repos/base-foc/src/core/include/platform_pd.h +++ b/repos/base-foc/src/core/include/platform_pd.h @@ -29,6 +29,9 @@ #include #include +/* base-internal includes */ +#include + /* Fiasco.OC includes */ namespace Fiasco { #include @@ -48,8 +51,8 @@ namespace Genode { addr_t utcb_area_start() { - return (Native_config::stack_area_virtual_base() + - THREAD_MAX * Native_config::stack_virtual_size()); + return stack_area_virtual_base() + + THREAD_MAX*stack_virtual_size(); } Cap_mapping _task; diff --git a/repos/base-foc/src/core/platform.cc b/repos/base-foc/src/core/platform.cc index 5dfe65f4a4..e3ab1c0f58 100644 --- a/repos/base-foc/src/core/platform.cc +++ b/repos/base-foc/src/core/platform.cc @@ -20,6 +20,7 @@ /* base-internal includes */ #include +#include /* core includes */ #include @@ -327,8 +328,8 @@ void Platform::_setup_mem_alloc() } region.start = addr; region.end = addr + size; - if (!region.intersects(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size())) { + if (!region.intersects(stack_area_virtual_base(), + stack_area_virtual_size())) { add_region(region, _ram_alloc); add_region(region, _core_address_ranges()); } @@ -403,8 +404,8 @@ void Platform::_setup_basics() _region_alloc.add_range(_vm_start, _vm_size); /* preserve stack area in core's virtual address space */ - _region_alloc.remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _region_alloc.remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); /* preserve utcb- area in core's virtual address space */ _region_alloc.remove_range((addr_t)l4_utcb(), L4_PAGESIZE * 16); diff --git a/repos/base-foc/src/core/spec/arm/target.inc b/repos/base-foc/src/core/spec/arm/target.inc index cc0187d135..89518d79fc 100644 --- a/repos/base-foc/src/core/spec/arm/target.inc +++ b/repos/base-foc/src/core/spec/arm/target.inc @@ -2,6 +2,9 @@ REQUIRES += arm SRC_CC += spec/arm/platform_arm.cc \ spec/arm/ipc_pager.cc +# override default stack-area location +INC_DIR += $(REP_DIR)/src/include/spec/arm + include $(REP_DIR)/src/core/target.inc vpath platform_services.cc $(GEN_CORE_DIR) diff --git a/repos/base-foc/src/include/spec/arm/base/internal/stack_area.h b/repos/base-foc/src/include/spec/arm/base/internal/stack_area.h new file mode 100644 index 0000000000..c55e6960dc --- /dev/null +++ b/repos/base-foc/src/include/spec/arm/base/internal/stack_area.h @@ -0,0 +1,33 @@ +/* + * \brief Stack area layout parameters + * \author Norman Feske + * \date 2016-03-03 + */ + +/* + * Copyright (C) 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__INTERNAL__STACK_AREA_H_ +#define _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ + +#include + +namespace Genode { + + /* + * The base address of the context area differs between ARM and x86 because + * roottask on Fiasco.OC uses identity mappings. The virtual address range + * of the stack area must not overlap with physical memory. We pick an + * address range that lies outside of the RAM of the currently supported + * ARM platforms. + */ + static constexpr addr_t stack_area_virtual_base() { return 0x20000000UL; } + static constexpr addr_t stack_area_virtual_size() { return 0x10000000UL; } + static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } +} + +#endif /* _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ */ diff --git a/repos/base-hw/include/base/native_types.h b/repos/base-hw/include/base/native_types.h index e04a60ac0b..a71b2289b0 100644 --- a/repos/base-hw/include/base/native_types.h +++ b/repos/base-hw/include/base/native_types.h @@ -40,8 +40,6 @@ namespace Genode */ struct Native_region; - struct Native_config; - struct Native_pd_args { }; /** @@ -78,23 +76,6 @@ struct Genode::Native_region }; -struct Genode::Native_config -{ - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0xe0000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } -}; - - class Genode::Native_utcb { public: diff --git a/repos/base-hw/src/base/thread/start.cc b/repos/base-hw/src/base/thread/start.cc index 46dce2d9fd..ad074e7f62 100644 --- a/repos/base-hw/src/base/thread/start.cc +++ b/repos/base-hw/src/base/thread/start.cc @@ -48,7 +48,7 @@ void Thread_base::_init_platform_thread(size_t weight, Type type) } /* if we got reinitialized we have to get rid of the old UTCB */ size_t const utcb_size = sizeof(Native_utcb); - addr_t const stack_area = Native_config::stack_area_virtual_base(); + addr_t const stack_area = stack_area_virtual_base(); addr_t const utcb_new = (addr_t)&_stack->utcb() - stack_area; Rm_session * const rm = env_stack_area_rm_session(); @@ -76,8 +76,7 @@ void Thread_base::_deinit_platform_thread() /* detach userland stack */ size_t const size = sizeof(_stack->utcb()); addr_t utcb = Stack_allocator::addr_to_base(_stack) + - Native_config::stack_virtual_size() - size - - Native_config::stack_area_virtual_base(); + stack_virtual_size() - size - stack_area_virtual_base(); env_stack_area_rm_session()->detach(utcb); if (_pager_cap.valid()) { @@ -100,8 +99,7 @@ void Thread_base::start() Ram_dataspace_capability ds = _cpu_session->utcb(_thread_cap); size_t const size = sizeof(_stack->utcb()); addr_t dst = Stack_allocator::addr_to_base(_stack) + - Native_config::stack_virtual_size() - size - - Native_config::stack_area_virtual_base(); + stack_virtual_size() - size - stack_area_virtual_base(); env_stack_area_rm_session()->attach_at(ds, dst, size); } catch (...) { PERR("failed to attach userland stack"); diff --git a/repos/base-hw/src/core/platform.cc b/repos/base-hw/src/core/platform.cc index 1ad82bdfde..ba3692990b 100644 --- a/repos/base-hw/src/core/platform.cc +++ b/repos/base-hw/src/core/platform.cc @@ -29,6 +29,9 @@ #include #include +/* base-internal includes */ +#include + using namespace Genode; extern int _prog_img_beg; @@ -137,9 +140,8 @@ Platform::Platform() _core_only_ram_regions, get_page_size_log2()); /* preserve stack area in core's virtual address space */ - _core_mem_alloc.virt_alloc()->remove_range( - Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _core_mem_alloc.virt_alloc()->remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); _init_io_port_alloc(); diff --git a/repos/base-hw/src/include/base/internal/stack_area.h b/repos/base-hw/src/include/base/internal/stack_area.h new file mode 100644 index 0000000000..13e792902a --- /dev/null +++ b/repos/base-hw/src/include/base/internal/stack_area.h @@ -0,0 +1,26 @@ +/* + * \brief Stack area layout parameters + * \author Norman Feske + * \date 2016-03-03 + */ + +/* + * Copyright (C) 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__INTERNAL__STACK_AREA_H_ +#define _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ + +#include + +namespace Genode { + + static constexpr addr_t stack_area_virtual_base() { return 0xe0000000UL; } + static constexpr addr_t stack_area_virtual_size() { return 0x10000000UL; } + static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } +} + +#endif /* _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ */ diff --git a/repos/base-linux/include/base/native_types.h b/repos/base-linux/include/base/native_types.h index a859d2ad7d..591c4c190b 100644 --- a/repos/base-linux/include/base/native_types.h +++ b/repos/base-linux/include/base/native_types.h @@ -18,16 +18,6 @@ #include #include -/* - * We cannot just include and here - * because this would imply the nested inclusion of a myriad - * of Linux types and would pollute the namespace for everyone - * who includes this header file. We want to cleanly separate - * Genode from POSIX. - */ - -extern Genode::addr_t _stack_area_start; - namespace Genode { /** @@ -125,26 +115,6 @@ namespace Genode { enum { PARENT_SOCKET_HANDLE = 100 }; - struct Native_config - { - /** - * Stack area configuration - * - * Please update platform-specific files after changing these - * functions, e.g., 'base-linux/src/ld/stack_area.*.ld'. - */ - static addr_t stack_area_virtual_base() { - return align_addr((addr_t)&_stack_area_start, 20); } - - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - class Native_pd_args { public: diff --git a/repos/base-linux/src/base/env/rm_session_mmap.cc b/repos/base-linux/src/base/env/rm_session_mmap.cc index 687434c15b..ab0cb00a30 100644 --- a/repos/base-linux/src/base/env/rm_session_mmap.cc +++ b/repos/base-linux/src/base/env/rm_session_mmap.cc @@ -60,8 +60,8 @@ addr_t Platform_env_base::Rm_session_mmap::_reserve_local(bool use_loc { /* special handling for stack area */ if (use_local_addr - && local_addr == Native_config::stack_area_virtual_base() - && size == Native_config::stack_area_virtual_size()) { + && local_addr == stack_area_virtual_base() + && size == stack_area_virtual_size()) { /* * On the first request to reserve the stack area, we flush the diff --git a/repos/base-linux/src/core/stack_area.cc b/repos/base-linux/src/core/stack_area.cc index d6b4ea2936..fa57477c4d 100644 --- a/repos/base-linux/src/core/stack_area.cc +++ b/repos/base-linux/src/core/stack_area.cc @@ -50,8 +50,7 @@ class Stack_area_rm_session : public Genode::Rm_session using namespace Genode; /* convert stack-area-relative to absolute virtual address */ - addr_t addr = local_addr; - addr += Native_config::stack_area_virtual_base(); + addr_t addr = (addr_t)local_addr + stack_area_virtual_base(); /* use anonymous mmap for allocating stack backing store */ int flags = MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE; diff --git a/repos/base-linux/src/include/base/internal/stack_area.h b/repos/base-linux/src/include/base/internal/stack_area.h index b17b06aff2..8c30662491 100644 --- a/repos/base-linux/src/include/base/internal/stack_area.h +++ b/repos/base-linux/src/include/base/internal/stack_area.h @@ -1,5 +1,5 @@ /* - * \brief Linux-specific utilities for stack area + * \brief Linux-specific definitions and utilities for the stack area * \author Christian Helmuth * \date 2013-09-26 */ @@ -24,12 +24,31 @@ #include +extern Genode::addr_t _stack_area_start; + + +namespace Genode { + + /** + * Stack area base address + * + * Please update platform-specific files after changing these + * functions, e.g., 'base-linux/src/ld/stack_area.*.ld'. + */ + static addr_t stack_area_virtual_base() { + return align_addr((addr_t)&_stack_area_start, 20); } + + static constexpr addr_t stack_area_virtual_size() { return 0x10000000UL; } + static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } +} + + static inline void flush_stack_area() { using namespace Genode; - void * const base = (void *) Native_config::stack_area_virtual_base(); - size_t const size = Native_config::stack_area_virtual_size(); + void * const base = (void *)stack_area_virtual_base(); + size_t const size = stack_area_virtual_size(); int ret; if ((ret = lx_munmap(base, size)) < 0) { @@ -45,8 +64,8 @@ static inline Genode::addr_t reserve_stack_area() int const flags = MAP_ANONYMOUS | MAP_PRIVATE; int const prot = PROT_NONE; - size_t const size = Native_config::stack_area_virtual_size(); - void * const addr_in = (void *)Native_config::stack_area_virtual_base(); + size_t const size = stack_area_virtual_size(); + void * const addr_in = (void *)stack_area_virtual_base(); void * const addr_out = lx_mmap(addr_in, size, prot, flags, -1, 0); /* reserve at local address failed - unmap incorrect mapping */ diff --git a/repos/base-nova/include/base/native_types.h b/repos/base-nova/include/base/native_types.h index efdf315c69..5fbac73e3f 100644 --- a/repos/base-nova/include/base/native_types.h +++ b/repos/base-nova/include/base/native_types.h @@ -238,22 +238,6 @@ namespace Genode { typedef int Native_connection_state; - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0xa0000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - struct Native_pd_args { }; } diff --git a/repos/base-nova/src/base/thread/stack.cc b/repos/base-nova/src/base/thread/stack.cc index c3acea199f..c82a8069f6 100644 --- a/repos/base-nova/src/base/thread/stack.cc +++ b/repos/base-nova/src/base/thread/stack.cc @@ -23,6 +23,7 @@ /* base-internal includes */ #include +#include /* base-nova includes */ #include @@ -40,8 +41,7 @@ Native_utcb * main_thread_utcb() { using namespace Genode; return reinterpret_cast( - Native_config::stack_area_virtual_base() + - Native_config::stack_virtual_size() - Nova::PAGE_SIZE_BYTE); + stack_area_virtual_base() + stack_virtual_size() - Nova::PAGE_SIZE_BYTE); } diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index 984fac4e87..8876ab7179 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -27,6 +27,9 @@ #include #include +/* base-internal includes */ +#include + /* NOVA includes */ #include @@ -126,13 +129,13 @@ static void page_fault_handler() pf_type & Ipc_pager::ERR_W ? "W" : "w", pf_type & Ipc_pager::ERR_P ? "P" : "p"); - if ((Native_config::stack_area_virtual_base() <= pf_sp) && - (pf_sp < Native_config::stack_area_virtual_base() + - Native_config::stack_area_virtual_size())) + if ((stack_area_virtual_base() <= pf_sp) && + (pf_sp < stack_area_virtual_base() + + stack_area_virtual_size())) { - addr_t utcb_addr_f = pf_sp / Native_config::stack_virtual_size(); - utcb_addr_f *= Native_config::stack_virtual_size(); - utcb_addr_f += Native_config::stack_virtual_size(); + addr_t utcb_addr_f = pf_sp / stack_virtual_size(); + utcb_addr_f *= stack_virtual_size(); + utcb_addr_f += stack_virtual_size(); utcb_addr_f -= 4096; Nova::Utcb * utcb_fault = reinterpret_cast(utcb_addr_f); @@ -398,8 +401,8 @@ Platform::Platform() : region_alloc()->remove_range(BDA_VIRT_ADDR, 0x1000); /* preserve stack area in core's virtual address space */ - region_alloc()->remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + region_alloc()->remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); /* exclude utcb of core pager thread + empty guard pages before and after */ region_alloc()->remove_range(CORE_PAGER_UTCB_ADDR - get_page_size(), @@ -420,14 +423,12 @@ Platform::Platform() : }; for (unsigned i = 0; i < sizeof(check) / sizeof(check[0]); i++) { - if (Native_config::stack_area_virtual_base() <= check[i] && - check[i] < Native_config::stack_area_virtual_base() + - Native_config::stack_area_virtual_size()) + if (stack_area_virtual_base() <= check[i] && + check[i] < stack_area_virtual_base() + stack_area_virtual_size()) { PERR("overlapping area - [%lx, %lx) vs %lx", - Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_base() + - Native_config::stack_area_virtual_size(), check[i]); + stack_area_virtual_base(), stack_area_virtual_base() + + stack_area_virtual_size(), check[i]); nova_die(); } } diff --git a/repos/base-nova/src/core/platform_thread.cc b/repos/base-nova/src/core/platform_thread.cc index f311a7f0ba..064eb6c125 100644 --- a/repos/base-nova/src/core/platform_thread.cc +++ b/repos/base-nova/src/core/platform_thread.cc @@ -23,6 +23,9 @@ #include #include +/* base-internal includes */ +#include + /* NOVA includes */ #include #include @@ -119,8 +122,7 @@ int Platform_thread::start(void *ip, void *sp) _sel_exc_base = is_vcpu() ? _pager->exc_pt_vcpu() : _pager->exc_pt_sel_client(); if (!is_vcpu()) { - pd_utcb = Native_config::stack_area_virtual_base() + - Native_config::stack_virtual_size() - get_page_size(); + pd_utcb = stack_area_virtual_base() + stack_virtual_size() - get_page_size(); addr_t remap_src[] = { _pd->parent_pt_sel(), _pager->Object_pool::Entry::cap().local_name() }; addr_t remap_dst[] = { PT_SEL_PARENT, PT_SEL_MAIN_PAGER }; diff --git a/repos/base-nova/src/include/base/internal/stack_area.h b/repos/base-nova/src/include/base/internal/stack_area.h new file mode 100644 index 0000000000..725d6180e6 --- /dev/null +++ b/repos/base-nova/src/include/base/internal/stack_area.h @@ -0,0 +1,26 @@ +/* + * \brief Stack area layout parameters + * \author Norman Feske + * \date 2016-03-03 + */ + +/* + * Copyright (C) 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__INTERNAL__STACK_AREA_H_ +#define _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ + +#include + +namespace Genode { + + static constexpr addr_t stack_area_virtual_base() { return 0xa0000000UL; } + static constexpr addr_t stack_area_virtual_size() { return 0x10000000UL; } + static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } +} + +#endif /* _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ */ diff --git a/repos/base-okl4/include/base/native_types.h b/repos/base-okl4/include/base/native_types.h index 0365481062..0cba31a868 100644 --- a/repos/base-okl4/include/base/native_types.h +++ b/repos/base-okl4/include/base/native_types.h @@ -90,22 +90,6 @@ namespace Genode { typedef Native_capability_tpl Native_capability; typedef Okl4::L4_ThreadId_t Native_connection_state; - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x40000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - struct Native_pd_args { }; } diff --git a/repos/base-okl4/src/core/platform.cc b/repos/base-okl4/src/core/platform.cc index a57f3f5387..7f7f14ab38 100644 --- a/repos/base-okl4/src/core/platform.cc +++ b/repos/base-okl4/src/core/platform.cc @@ -19,6 +19,7 @@ /* base-internal includes */ #include +#include /* core includes */ #include @@ -272,8 +273,8 @@ Platform::Platform() : _io_port_alloc.add_range(0, 0x10000); /* preserve stack area in core's virtual address space */ - _core_mem_alloc.virt_alloc()->remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _core_mem_alloc.virt_alloc()->remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); _vm_start = 0x1000; _vm_size = 0xb0000000 - 0x1000; diff --git a/repos/base-pistachio/include/base/native_types.h b/repos/base-pistachio/include/base/native_types.h index 84bbfffe31..c3102a7db9 100644 --- a/repos/base-pistachio/include/base/native_types.h +++ b/repos/base-pistachio/include/base/native_types.h @@ -74,22 +74,6 @@ namespace Genode { typedef Pistachio::L4_ThreadId_t Native_connection_state; - struct Native_config - { - /** - * Stack area configuration - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x40000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - struct Native_pd_args { }; } diff --git a/repos/base-pistachio/src/core/platform.cc b/repos/base-pistachio/src/core/platform.cc index bd1c8b4ee2..ae2f6002a8 100644 --- a/repos/base-pistachio/src/core/platform.cc +++ b/repos/base-pistachio/src/core/platform.cc @@ -20,6 +20,7 @@ /* base-internal includes */ #include +#include /* core includes */ #include @@ -434,8 +435,8 @@ void Platform::_setup_mem_alloc() } else { region.start = addr; region.end = addr + size; - if (region.intersects(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()) || + if (region.intersects(stack_area_virtual_base(), + stack_area_virtual_size()) || intersects_kip_archdep(kip, addr, size)) { unmap_local(region.start, size >> get_page_size_log2()); } else { @@ -566,8 +567,8 @@ void Platform::_setup_basics() /* configure core's virtual memory, exclude KIP, stack area */ _region_alloc.add_range(_vm_start, _vm_size); _region_alloc.remove_range((addr_t)kip, kip_size); - _region_alloc.remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _region_alloc.remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); /* remove KIP and MBI area from region and IO_MEM allocator */ remove_region(Region((addr_t)kip, (addr_t)kip + kip_size), _region_alloc); diff --git a/repos/base-sel4/include/base/native_types.h b/repos/base-sel4/include/base/native_types.h index 193b0b661d..944ad590b1 100644 --- a/repos/base-sel4/include/base/native_types.h +++ b/repos/base-sel4/include/base/native_types.h @@ -126,22 +126,6 @@ namespace Genode { }; }; - struct Native_config - { - /** - * Stack-area configuration. - */ - static constexpr addr_t stack_area_virtual_base() { - return 0x40000000UL; } - static constexpr addr_t stack_area_virtual_size() { - return 0x10000000UL; } - - /** - * Size of virtual address region holding the stack of one thread - */ - static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } - }; - struct Native_pd_args { }; typedef int Native_connection_state; diff --git a/repos/base-sel4/src/core/platform.cc b/repos/base-sel4/src/core/platform.cc index 5e77b83302..ff35241730 100644 --- a/repos/base-sel4/src/core/platform.cc +++ b/repos/base-sel4/src/core/platform.cc @@ -23,6 +23,9 @@ #include #include +/* base-internal includes */ +#include + using namespace Genode; static bool const verbose_boot_info = true; @@ -156,8 +159,8 @@ void Platform::_init_allocators() } /* preserve stack area in core's virtual address space */ - _core_mem_alloc.virt_alloc()->remove_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size()); + _core_mem_alloc.virt_alloc()->remove_range(stack_area_virtual_base(), + stack_area_virtual_size()); } diff --git a/repos/base-sel4/src/core/stack_area.cc b/repos/base-sel4/src/core/stack_area.cc index 9b210a8db0..a52c2ea176 100644 --- a/repos/base-sel4/src/core/stack_area.cc +++ b/repos/base-sel4/src/core/stack_area.cc @@ -25,6 +25,9 @@ #include #include +/* base-internal includes */ +#include + using namespace Genode; @@ -76,7 +79,7 @@ class Stack_area_rm_session : public Rm_session } addr_t const core_local_addr = - Native_config::stack_area_virtual_base() + (addr_t)local_addr; + stack_area_virtual_base() + (addr_t)local_addr; if (verbose) PDBG("core_local_addr = %lx, phys_addr = %lx, size = 0x%zx", diff --git a/repos/base/include/base/thread.h b/repos/base/include/base/thread.h index 85c230923d..7b03a82a5d 100644 --- a/repos/base/include/base/thread.h +++ b/repos/base/include/base/thread.h @@ -280,6 +280,21 @@ class Genode::Thread_base */ void *stack_base() const; + /** + * Return virtual size reserved for each stack within the stack area + */ + static size_t stack_virtual_size(); + + /** + * Return the local base address of the stack area + */ + static addr_t stack_area_virtual_base(); + + /** + * Return total size of the stack area + */ + static size_t stack_area_virtual_size(); + /** * Return 'Thread_base' object corresponding to the calling thread * diff --git a/repos/base/src/base/env/stack_area.cc b/repos/base/src/base/env/stack_area.cc index 3542f5b712..da71743cf4 100644 --- a/repos/base/src/base/env/stack_area.cc +++ b/repos/base/src/base/env/stack_area.cc @@ -16,6 +16,7 @@ /* base-internal includes */ #include +#include using namespace Genode; @@ -39,10 +40,10 @@ struct Expanding_rm_connection : Connection, Expanding_rm_session_cl struct Stack_area_rm_session : Expanding_rm_connection { Stack_area_rm_session() - : Expanding_rm_connection(0, Native_config::stack_area_virtual_size()) + : Expanding_rm_connection(0, stack_area_virtual_size()) { - addr_t local_base = Native_config::stack_area_virtual_base(); - size_t size = Native_config::stack_area_virtual_size(); + addr_t const local_base = stack_area_virtual_base(); + size_t const size = stack_area_virtual_size(); env()->rm_session()->attach_at(dataspace(), local_base, size); } diff --git a/repos/base/src/base/thread/myself.cc b/repos/base/src/base/thread/myself.cc index e5ffad045d..6f2b13a304 100644 --- a/repos/base/src/base/thread/myself.cc +++ b/repos/base/src/base/thread/myself.cc @@ -16,6 +16,7 @@ /* base-internal includes */ #include +#include Genode::Thread_base *Genode::Thread_base::myself() @@ -28,9 +29,8 @@ Genode::Thread_base *Genode::Thread_base::myself() * thread. */ addr_t sp = (addr_t)(&dummy); - if (sp < Native_config::stack_area_virtual_base() || - sp >= Native_config::stack_area_virtual_base() + - Native_config::stack_area_virtual_size()) + if (sp < Genode::stack_area_virtual_base() || + sp >= Genode::stack_area_virtual_base() + Genode::stack_area_virtual_size()) return 0; addr_t base = Stack_allocator::addr_to_base(&dummy); diff --git a/repos/base/src/base/thread/stack_allocator.cc b/repos/base/src/base/thread/stack_allocator.cc index 56562801b4..eb1942e3b9 100644 --- a/repos/base/src/base/thread/stack_allocator.cc +++ b/repos/base/src/base/thread/stack_allocator.cc @@ -20,7 +20,7 @@ using namespace Genode; Stack *Stack_allocator::base_to_stack(addr_t base) { - addr_t result = base + Native_config::stack_virtual_size() + addr_t result = base + stack_virtual_size() - sizeof(Stack); return reinterpret_cast(result); } @@ -28,21 +28,19 @@ Stack *Stack_allocator::base_to_stack(addr_t base) addr_t Stack_allocator::addr_to_base(void *addr) { - return ((addr_t)addr) & ~(Native_config::stack_virtual_size() - 1); + return ((addr_t)addr) & ~(stack_virtual_size() - 1); } size_t Stack_allocator::base_to_idx(addr_t base) { - return (base - Native_config::stack_area_virtual_base()) / - Native_config::stack_virtual_size(); + return (base - stack_area_virtual_base()) / stack_virtual_size(); } addr_t Stack_allocator::idx_to_base(size_t idx) { - return Native_config::stack_area_virtual_base() + - idx * Native_config::stack_virtual_size(); + return stack_area_virtual_base() + idx * stack_virtual_size(); } @@ -51,7 +49,7 @@ Stack_allocator::alloc(Thread_base *thread_base, bool main_thread) { if (main_thread) /* the main-thread stack is the first one */ - return base_to_stack(Native_config::stack_area_virtual_base()); + return base_to_stack(stack_area_virtual_base()); try { Lock::Guard _lock_guard(_threads_lock); diff --git a/repos/base/src/base/thread/thread.cc b/repos/base/src/base/thread/thread.cc index c62711627c..9c97cfc378 100644 --- a/repos/base/src/base/thread/thread.cc +++ b/repos/base/src/base/thread/thread.cc @@ -56,8 +56,7 @@ void Stack::size(size_t const size) throw Thread_base::Stack_too_large(); /* allocate and attach backing store for the stack enhancement */ - addr_t const ds_addr = _base - ds_size - - Native_config::stack_area_virtual_base(); + addr_t const ds_addr = _base - ds_size - stack_area_virtual_base(); try { Ram_session * const ram = env_stack_area_ram_session(); Ram_dataspace_capability const ds_cap = ram->alloc(ds_size); @@ -96,7 +95,7 @@ Thread_base::_alloc_stack(size_t stack_size, char const *name, bool main_thread) enum { PAGE_SIZE_LOG2 = 12 }; size_t ds_size = align_addr(stack_size, PAGE_SIZE_LOG2); - if (stack_size >= Native_config::stack_virtual_size() - + if (stack_size >= stack_virtual_size() - sizeof(Native_utcb) - (1UL << PAGE_SIZE_LOG2)) throw Stack_too_large(); @@ -106,8 +105,7 @@ Thread_base::_alloc_stack(size_t stack_size, char const *name, bool main_thread) * The stack pointer is always located at the top of the stack header. */ addr_t ds_addr = Stack_allocator::addr_to_base(stack) + - Native_config::stack_virtual_size() - - ds_size; + stack_virtual_size() - ds_size; /* add padding for UTCB if defined for the platform */ if (sizeof(Native_utcb) >= (1 << PAGE_SIZE_LOG2)) @@ -117,7 +115,7 @@ Thread_base::_alloc_stack(size_t stack_size, char const *name, bool main_thread) Ram_dataspace_capability ds_cap; try { ds_cap = env_stack_area_ram_session()->alloc(ds_size); - addr_t attach_addr = ds_addr - Native_config::stack_area_virtual_base(); + addr_t attach_addr = ds_addr - stack_area_virtual_base(); if (attach_addr != (addr_t)env_stack_area_rm_session()->attach_at(ds_cap, attach_addr, ds_size)) throw Stack_alloc_failed(); } @@ -139,7 +137,7 @@ Thread_base::_alloc_stack(size_t stack_size, char const *name, bool main_thread) void Thread_base::_free_stack(Stack *stack) { - addr_t ds_addr = stack->base() - Native_config::stack_area_virtual_base(); + addr_t ds_addr = stack->base() - stack_area_virtual_base(); Ram_dataspace_capability ds_cap = stack->ds_cap(); /* call de-constructor explicitly before memory gets detached */ @@ -185,6 +183,24 @@ void *Thread_base::stack_base() const { return (void*)_stack->base(); } void Thread_base::stack_size(size_t const size) { _stack->size(size); } +size_t Thread_base::stack_virtual_size() +{ + return Genode::stack_virtual_size(); +} + + +addr_t Thread_base::stack_area_virtual_base() +{ + return Genode::stack_area_virtual_base(); +} + + +size_t Thread_base::stack_area_virtual_size() +{ + return Genode::stack_area_virtual_size(); +} + + Thread_base::Thread_base(size_t weight, const char *name, size_t stack_size, Type type, Cpu_session *cpu_session) : diff --git a/repos/base/src/core/stack_area.cc b/repos/base/src/core/stack_area.cc index 3ebb37b34f..642bd36270 100644 --- a/repos/base/src/core/stack_area.cc +++ b/repos/base/src/core/stack_area.cc @@ -19,6 +19,9 @@ #include #include +/* base-internal includes */ +#include + /* local includes */ #include #include @@ -80,8 +83,7 @@ class Stack_area_rm_session : public Rm_session return (addr_t)0; } - addr_t core_local_addr = Native_config::stack_area_virtual_base() + - (addr_t)local_addr; + addr_t core_local_addr = stack_area_virtual_base() + (addr_t)local_addr; if (verbose) PDBG("core_local_addr = %lx, phys_addr = %lx, size = 0x%zx", @@ -103,12 +105,11 @@ class Stack_area_rm_session : public Rm_session { using Genode::addr_t; - if ((addr_t)local_addr >= Native_config::stack_area_virtual_size()) + if ((addr_t)local_addr >= stack_area_virtual_size()) return; - addr_t const detach = Native_config::stack_area_virtual_base() + - (addr_t)local_addr; - addr_t const stack = Native_config::stack_virtual_size(); + addr_t const detach = stack_area_virtual_base() + (addr_t)local_addr; + addr_t const stack = stack_virtual_size(); addr_t const pages = ((detach & ~(stack - 1)) + stack - detach) >> get_page_size_log2(); diff --git a/repos/base/src/include/base/internal/stack_allocator.h b/repos/base/src/include/base/internal/stack_allocator.h index 4cce2554d0..d63d1f4acc 100644 --- a/repos/base/src/include/base/internal/stack_allocator.h +++ b/repos/base/src/include/base/internal/stack_allocator.h @@ -16,6 +16,7 @@ /* base-internal includes */ #include +#include namespace Genode { class Stack_allocator; } @@ -30,8 +31,8 @@ class Genode::Stack_allocator private: static constexpr size_t MAX_THREADS = - Native_config::stack_area_virtual_size() / - Native_config::stack_virtual_size(); + stack_area_virtual_size() / + stack_virtual_size(); struct Stack_bit_allocator : Bit_allocator { diff --git a/repos/base/src/include/base/internal/stack_area.h b/repos/base/src/include/base/internal/stack_area.h new file mode 100644 index 0000000000..25f31695e6 --- /dev/null +++ b/repos/base/src/include/base/internal/stack_area.h @@ -0,0 +1,26 @@ +/* + * \brief Stack area layout parameters + * \author Norman Feske + * \date 2016-03-03 + */ + +/* + * Copyright (C) 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__INTERNAL__STACK_AREA_H_ +#define _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ + +#include + +namespace Genode { + + static constexpr addr_t stack_area_virtual_base() { return 0x40000000UL; } + static constexpr addr_t stack_area_virtual_size() { return 0x10000000UL; } + static constexpr addr_t stack_virtual_size() { return 0x00100000UL; } +} + +#endif /* _INCLUDE__BASE__INTERNAL__STACK_AREA_H_ */ diff --git a/repos/base/src/lib/ldso/main.cc b/repos/base/src/lib/ldso/main.cc index c51c958582..b0ace26b47 100644 --- a/repos/base/src/lib/ldso/main.cc +++ b/repos/base/src/lib/ldso/main.cc @@ -11,12 +11,15 @@ * under the terms of the GNU General Public License version 2. */ +/* Genode includes */ #include #include #include #include #include +#include +/* local includes */ #include #include @@ -578,9 +581,10 @@ int main() /* print loaded object information */ try { if (Genode::config()->xml_node().attribute("ld_verbose").has_value("yes")) { - PINF(" %lx .. %lx: stack area", Genode::Native_config::stack_area_virtual_base(), - Genode::Native_config::stack_area_virtual_base() + - Genode::Native_config::stack_area_virtual_size() - 1); + PINF(" %lx .. %lx: stack area", + Genode::Thread_base::stack_area_virtual_base(), + Genode::Thread_base::stack_area_virtual_base() + + Genode::Thread_base::stack_area_virtual_size() - 1); dump_loaded(); } } catch (...) { } diff --git a/repos/base/src/test/thread/main.cc b/repos/base/src/test/thread/main.cc index fcf90d7e12..1a4ba07560 100644 --- a/repos/base/src/test/thread/main.cc +++ b/repos/base/src/test/thread/main.cc @@ -136,8 +136,8 @@ static void test_main_thread() printf("thread base %p\n", myself); /* check whether my stack is inside the first stack region */ - addr_t const stack_slot_base = Native_config::stack_area_virtual_base(); - addr_t const stack_slot_size = Native_config::stack_area_virtual_size(); + addr_t const stack_slot_base = Thread_base::stack_area_virtual_base(); + addr_t const stack_slot_size = Thread_base::stack_area_virtual_size(); addr_t const stack_slot_top = stack_slot_base + stack_slot_size; addr_t const stack_top = (addr_t)myself->stack_top(); @@ -271,10 +271,10 @@ static void test_create_as_many_threads() { printf("running '%s'\n", __func__); - addr_t const max = Native_config::stack_area_virtual_size() / - Native_config::stack_virtual_size(); + addr_t const max = Thread_base::stack_area_virtual_size() / + Thread_base::stack_virtual_size(); - static Cpu_helper * threads[max]; + Cpu_helper * threads[max]; static char thread_name[8]; unsigned i = 0; diff --git a/repos/ports-foc/src/lib/l4lx/startup.cc b/repos/ports-foc/src/lib/l4lx/startup.cc index 03a2d412af..3a6913ad67 100644 --- a/repos/ports-foc/src/lib/l4lx/startup.cc +++ b/repos/ports-foc/src/lib/l4lx/startup.cc @@ -127,8 +127,8 @@ static void register_reserved_areas() size_t bin_sz = (addr_t)&_prog_img_end - (addr_t)&_prog_img_beg; L4lx::Env::env()->rm()->reserve_range((addr_t)&_prog_img_beg, bin_sz, "Binary"); - L4lx::Env::env()->rm()->reserve_range(Native_config::stack_area_virtual_base(), - Native_config::stack_area_virtual_size(), + L4lx::Env::env()->rm()->reserve_range(Thread_base::stack_area_virtual_base(), + Thread_base::stack_area_virtual_size(), "Stack Area"); } diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc index 3ec6d3e584..ae55481cd2 100644 --- a/repos/ports/src/app/seoul/main.cc +++ b/repos/ports/src/app/seoul/main.cc @@ -1414,7 +1414,7 @@ int main(int argc, char **argv) * with the actual VM size which is determined below inside this scope. */ Vmm::Virtual_reservation - reservation(Genode::Native_config::stack_area_virtual_base()); + reservation(Genode::Thread_base::stack_area_virtual_base()); Genode::printf("--- Vancouver VMM starting ---\n"); @@ -1468,9 +1468,9 @@ int main(int argc, char **argv) fb_size / 1024 / 1024); Genode::printf("[0x%012lx, 0x%012lx) - Genode stack area\n", - Genode::Native_config::stack_area_virtual_base(), - Genode::Native_config::stack_area_virtual_base() + - Genode::Native_config::stack_area_virtual_size()); + Genode::Thread_base::stack_area_virtual_base(), + Genode::Thread_base::stack_area_virtual_base() + + Genode::Thread_base::stack_area_virtual_size()); Genode::printf("[0x%012lx, 0x%012lx) - VMM program image\n", (Genode::addr_t)&_prog_img_beg, diff --git a/repos/ports/src/virtualbox/thread.cc b/repos/ports/src/virtualbox/thread.cc index 05d6cfd213..cea061706d 100644 --- a/repos/ports/src/virtualbox/thread.cc +++ b/repos/ports/src/virtualbox/thread.cc @@ -68,7 +68,7 @@ static int create_thread(pthread_t *thread, const pthread_attr_t *attr, Assert(rtthread); - size_t stack_size = Genode::Native_config::stack_virtual_size() - + size_t stack_size = Genode::Thread_base::stack_virtual_size() - sizeof(Genode::Native_utcb) - 2 * (1UL << 12); if (rtthread->cbStack < stack_size)