mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-09 04:15:52 +00:00
NOVA: cleanup - remove _first_sel special handling
Replace dislocation of extern variables with simplistic convention
This commit is contained in:
parent
f1202139f9
commit
ec66788f11
@ -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,
|
||||
};
|
||||
|
||||
/**
|
||||
|
18
base-nova/src/base/env/cap_sel_alloc.cc
vendored
18
base-nova/src/base/env/cap_sel_alloc.cc
vendored
@ -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;
|
||||
|
@ -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__
|
||||
|
@ -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_ */
|
||||
|
@ -75,9 +75,6 @@
|
||||
__l4_sys_direct_sycalls;
|
||||
l4_atomic_cmpxchg;
|
||||
|
||||
/* Nova */
|
||||
__first_free_cap_selector;
|
||||
|
||||
extern "C++" {
|
||||
main_thread_utcb*;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user