genode/base-linux/src/platform/_main_helper.h

48 lines
1.2 KiB
C
Raw Normal View History

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;
/**
* Natively aligned memory location used in the lock implementation
*/
int main_thread_futex_counter __attribute__((aligned(sizeof(Genode::addr_t))));
static inline void main_thread_bootstrap()
2011-12-22 16:19:25 +01:00
{
using namespace Genode;
/* reserve context area */
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_ */