NOVA: cleanup - remove _first_sel special handling

Replace dislocation of extern variables with simplistic convention
This commit is contained in:
Alexander Boettcher 2012-10-01 12:01:04 +02:00 committed by Norman Feske
parent f1202139f9
commit ec66788f11
5 changed files with 14 additions and 48 deletions

View File

@ -516,7 +516,8 @@ namespace Nova {
*/
enum {
NUM_INITIAL_PT_LOG2 = 5,
NUM_INITIAL_PT = 1 << NUM_INITIAL_PT_LOG2
NUM_INITIAL_PT = 1UL << NUM_INITIAL_PT_LOG2,
NUM_INITIAL_PT_RESERVED = 2 * NUM_INITIAL_PT,
};
/**

View File

@ -25,13 +25,6 @@
using namespace Genode;
/**
* First available capability selector for custom use
*
* Must be initialized by the startup code
*/
int __first_free_cap_selector;
/**
* Low-level lock to protect the allocator
*
@ -99,17 +92,16 @@ Cap_selector_allocator::Cap_selector_allocator()
/* initialize lock */
alloc_lock();
/* the first free selector is used for the lock */
Bit_allocator::_reserve(0, __first_free_cap_selector + 1);
/**
* The first selectors are reserved for exception portals and special
* purpose usage as defined in the nova syscall header file
*/
Bit_allocator::_reserve(0, Nova::NUM_INITIAL_PT_RESERVED);
}
namespace Genode {
/**
* This function must not be called prior the initialization of
* '__first_free_cap_selector'.
*/
Cap_selector_allocator *cap_selector_allocator()
{
static Cap_selector_allocator inst;

View File

@ -44,12 +44,6 @@ Native_utcb *main_thread_utcb();
extern long __initial_sp;
/**
* First available capability selector for custom use
*/
extern int __first_free_cap_selector;
/**
* Pointer to the UTCB of the main thread
*/
@ -182,9 +176,6 @@ Platform::Platform() :
/* register UTCB of main thread */
__main_thread_utcb = (Utcb *)(__initial_sp - get_page_size());
/* register start of usable capability range */
__first_free_cap_selector = hip->sel_exc + hip->sel_gsi + 3;
/* set core pd selector */
__core_pd_sel = hip->sel_exc;
@ -200,6 +191,12 @@ Platform::Platform() :
* Now that we can access the I/O ports for comport 0, printf works...
*/
/* sanity checks */
if (hip->sel_exc + 3 > NUM_INITIAL_PT_RESERVED) {
printf("configuration error\n");
nova_die();
}
/* configure virtual address spaces */
_vm_base = get_page_size();
#ifdef __x86_64__

View File

@ -16,28 +16,7 @@
#define _PLATFORM___MAIN_HELPER_H_
#include <nova/syscalls.h>
#include <base/stdint.h>
/**
* Initial value of esp register, saved by the crt0 startup code
*
* This value contains the address of the hypervisor information page.
*/
extern long __initial_sp;
/**
* First available capability selector for custom use
*/
extern int __first_free_cap_selector;
static void main_thread_bootstrap()
{
/* register start of usable capability range */
enum { FIRST_FREE_PORTAL = 0x1000 };
/* this variable may be set by the dynamic linker (ldso) */
if (!__first_free_cap_selector)
__first_free_cap_selector = FIRST_FREE_PORTAL;
}
static void main_thread_bootstrap() {};
#endif /* _PLATFORM___MAIN_HELPER_H_ */

View File

@ -75,9 +75,6 @@
__l4_sys_direct_sycalls;
l4_atomic_cmpxchg;
/* Nova */
__first_free_cap_selector;
extern "C++" {
main_thread_utcb*;
};