hw: static constexpr function when reinterpret cast is used

Issue #1511
This commit is contained in:
Christian Prochaska 2015-05-11 22:18:50 +02:00 committed by Christian Helmuth
parent e84284c0cd
commit e7f869611c
4 changed files with 8 additions and 5 deletions

View File

@ -315,9 +315,12 @@ namespace Genode
static constexpr addr_t VIRT_ADDR_SPACE_START = 0x1000;
static constexpr size_t VIRT_ADDR_SPACE_SIZE = 0xfffef000;
static constexpr Native_utcb * UTCB_MAIN_THREAD = (Native_utcb *)
static constexpr Native_utcb * utcb_main_thread()
{
return (Native_utcb *)
((VIRT_ADDR_SPACE_START + VIRT_ADDR_SPACE_SIZE - sizeof(Native_utcb))
& ~((1 << MIN_MAPPING_SIZE_LOG2) - 1));
}
}
#endif /* _BASE__NATIVE_TYPES_H_ */

View File

@ -66,7 +66,7 @@ void prepare_reinit_main_thread() { prepare_init_main_thread(); }
Native_utcb * Thread_base::utcb()
{
if (this) { return &_context->utcb; }
return UTCB_MAIN_THREAD;
return utcb_main_thread();
}

View File

@ -239,7 +239,7 @@ void init_kernel_mp_primary()
/* initialize UTCB and map it */
Native_utcb * utcb = Kernel::core_main_thread_utcb_phys_addr();
Genode::map_local((addr_t)utcb, (addr_t)UTCB_MAIN_THREAD,
Genode::map_local((addr_t)utcb, (addr_t)utcb_main_thread(),
sizeof(Native_utcb) / get_page_size());
static Kernel::Thread t(Cpu_priority::max, 0, "core");
@ -249,7 +249,7 @@ void init_kernel_mp_primary()
t.ip = (addr_t)&_core_start;
t.sp = (addr_t)s + STACK_SIZE;
t.init(cpu_pool()->primary_cpu(), core_pd(),
(Native_utcb*)Genode::UTCB_MAIN_THREAD, 1);
Genode::utcb_main_thread(), 1);
/* kernel initialization finished */
Genode::printf("kernel initialized\n");

View File

@ -182,7 +182,7 @@ int Platform_thread::start(void * const ip, void * const sp)
{
/* attach UTCB in case of a main thread */
if (_main_thread) {
_utcb_pd_addr = UTCB_MAIN_THREAD;
_utcb_pd_addr = utcb_main_thread();
if (!_rm_client) {
PERR("invalid RM client");
return -1;