2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Platform-specific helper functions for the _main() function
|
|
|
|
* \author Christian Prochaska
|
|
|
|
* \date 2009-08-05
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2009-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PLATFORM___MAIN_HELPER_H_
|
|
|
|
#define _PLATFORM___MAIN_HELPER_H_
|
|
|
|
|
|
|
|
#include <base/thread.h>
|
|
|
|
|
|
|
|
#include <linux_syscalls.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define 'lx_environ' pointer that is supposed to be initialized by the
|
|
|
|
* startup code.
|
|
|
|
*/
|
|
|
|
__attribute__((weak)) char **lx_environ = (char **)0;
|
|
|
|
|
|
|
|
|
2013-02-25 21:18:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Natively aligned memory location used in the lock implementation
|
|
|
|
*/
|
|
|
|
int main_thread_futex_counter __attribute__((aligned(sizeof(Genode::addr_t))));
|
|
|
|
|
|
|
|
|
2011-12-23 14:04:29 +01:00
|
|
|
static inline void main_thread_bootstrap()
|
2011-12-22 16:19:25 +01:00
|
|
|
{
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
/* reserve context area */
|
2012-08-29 14:42:56 +02:00
|
|
|
Genode::addr_t base = Native_config::context_area_virtual_base();
|
|
|
|
Genode::size_t size = Native_config::context_area_virtual_size();
|
2011-12-22 16:19:25 +01:00
|
|
|
if (lx_vm_reserve(base, size) != base)
|
|
|
|
PERR("reservation of context area [%lx,%lx) failed",
|
|
|
|
(unsigned long) base, (unsigned long) base + size);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _PLATFORM___MAIN_HELPER_H_ */
|