mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-11 13:22:33 +00:00
base-nova: Coding style
This commit is contained in:
parent
bef78dd9f8
commit
8fe0c6c91c
base-nova
include
32bit/nova
64bit/nova
base
nova_cpu_session
src
base
core
@ -198,6 +198,7 @@ namespace Nova {
|
||||
return syscall_0(NOVA_EC_CTRL, 0, ec);
|
||||
}
|
||||
|
||||
|
||||
ALWAYS_INLINE
|
||||
inline uint8_t create_sc(unsigned sc, unsigned pd, unsigned ec, Qpd qpd)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ namespace Nova {
|
||||
|
||||
asm volatile ("syscall"
|
||||
: "+D" (status)
|
||||
:
|
||||
:
|
||||
: "rcx", "r11", "memory");
|
||||
return status;
|
||||
}
|
||||
@ -68,7 +68,7 @@ namespace Nova {
|
||||
|
||||
asm volatile ("syscall"
|
||||
: "+D" (status), "+S" (p1)
|
||||
:
|
||||
:
|
||||
: "rcx", "r11", "memory");
|
||||
if (p2) *p2 = p1;
|
||||
return status;
|
||||
@ -125,7 +125,7 @@ namespace Nova {
|
||||
|
||||
asm volatile ("syscall"
|
||||
: "+D" (status), "+S"(p3), "+d"(p4)
|
||||
:
|
||||
:
|
||||
: "rcx", "r11", "memory");
|
||||
return status;
|
||||
}
|
||||
@ -174,6 +174,7 @@ namespace Nova {
|
||||
return syscall_0(NOVA_EC_CTRL, 0, ec);
|
||||
}
|
||||
|
||||
|
||||
ALWAYS_INLINE
|
||||
inline uint8_t create_sc(mword_t sc, mword_t pd, mword_t ec, Qpd qpd)
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ namespace Genode {
|
||||
class Bit_allocator
|
||||
{
|
||||
protected:
|
||||
|
||||
Bit_array<WORDS> _array;
|
||||
|
||||
void _reserve(addr_t bit_start, size_t const num_cap)
|
||||
@ -40,8 +41,7 @@ namespace Genode {
|
||||
|
||||
try {
|
||||
/*
|
||||
* Throws exception if array is
|
||||
* accessed outside bounds
|
||||
* Throws exception if array is * accessed outside bounds
|
||||
*/
|
||||
while (true) {
|
||||
if (_array.get(i, step)) {
|
||||
|
@ -75,10 +75,11 @@ namespace Genode {
|
||||
|
||||
struct Raw
|
||||
{
|
||||
Dst dst;
|
||||
/*
|
||||
* It is obsolete and unused in NOVA,
|
||||
* however still used by generic base part
|
||||
Dst dst;
|
||||
|
||||
/*
|
||||
* It is obsolete and unused in NOVA, however still used by
|
||||
* generic base part
|
||||
*/
|
||||
addr_t local_name;
|
||||
};
|
||||
|
@ -44,12 +44,12 @@ namespace Genode {
|
||||
*/
|
||||
Signal_context_capability _exception_sigh;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Portal selector for object cleanup/destruction
|
||||
*/
|
||||
addr_t _pt_cleanup;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Semaphore selector to synchronize pause/state/resume operations
|
||||
*/
|
||||
addr_t _sm_state_notify;
|
||||
@ -57,7 +57,8 @@ namespace Genode {
|
||||
addr_t _initial_esp;
|
||||
addr_t _initial_eip;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
struct Thread_state thread;
|
||||
addr_t sel_client_ec;
|
||||
bool valid;
|
||||
|
@ -28,7 +28,7 @@ namespace Genode {
|
||||
* \param priority designated priority of all threads created
|
||||
* with this CPU session
|
||||
*/
|
||||
Nova_cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY)
|
||||
Nova_cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY)
|
||||
:
|
||||
Connection<Cpu_session>(
|
||||
session("priority=0x%lx, ram_quota=32K, label=\"%s\"",
|
||||
|
@ -23,11 +23,10 @@ namespace Genode {
|
||||
{
|
||||
virtual ~Nova_cpu_session() { }
|
||||
|
||||
virtual
|
||||
Native_capability native_cap(Thread_capability cap) = 0;
|
||||
virtual Native_capability native_cap(Thread_capability cap) = 0;
|
||||
|
||||
virtual Native_capability pause_sync(Thread_capability) = 0;
|
||||
|
||||
virtual
|
||||
Native_capability pause_sync(Thread_capability) = 0;
|
||||
|
||||
/*********************
|
||||
** RPC declaration **
|
||||
|
1
base-nova/src/base/env/cap_sel_alloc.cc
vendored
1
base-nova/src/base/env/cap_sel_alloc.cc
vendored
@ -42,6 +42,7 @@ addr_t Cap_selector_allocator::alloc(size_t num_caps_log2)
|
||||
return ret_base;
|
||||
}
|
||||
|
||||
|
||||
void Cap_selector_allocator::free(addr_t cap, size_t num_caps_log2)
|
||||
{
|
||||
alloc_lock()->lock();
|
||||
|
@ -27,6 +27,7 @@ using namespace Nova;
|
||||
enum { PF_HANDLER_STACK_SIZE = sizeof(addr_t) * 1024 };
|
||||
extern Genode::addr_t __core_pd_sel;
|
||||
|
||||
|
||||
Utcb * Pager_object::_check_handler(Thread_base *&myself, Pager_object *&obj)
|
||||
{
|
||||
Utcb * utcb;
|
||||
@ -49,6 +50,7 @@ Utcb * Pager_object::_check_handler(Thread_base *&myself, Pager_object *&obj)
|
||||
sleep_forever();
|
||||
}
|
||||
|
||||
|
||||
void Pager_object::_page_fault_handler()
|
||||
{
|
||||
Ipc_pager ipc_pager;
|
||||
@ -80,6 +82,7 @@ void Pager_object::_page_fault_handler()
|
||||
ipc_pager.reply_and_wait_for_fault();
|
||||
}
|
||||
|
||||
|
||||
void Pager_object::_exception_handler(addr_t portal_id)
|
||||
{
|
||||
Thread_base *myself;
|
||||
@ -100,6 +103,7 @@ void Pager_object::_exception_handler(addr_t portal_id)
|
||||
reply(myself->stack_top());
|
||||
}
|
||||
|
||||
|
||||
void Pager_object::_recall_handler()
|
||||
{
|
||||
Thread_base *myself;
|
||||
@ -139,6 +143,7 @@ void Pager_object::_recall_handler()
|
||||
reply(myself->stack_top());
|
||||
}
|
||||
|
||||
|
||||
void Pager_object::_startup_handler()
|
||||
{
|
||||
Thread_base *myself;
|
||||
@ -169,7 +174,7 @@ void Pager_object::_invoke_handler()
|
||||
if (event < PT_SEL_PARENT || event == PT_SEL_STARTUP ||
|
||||
event == SM_SEL_EC || event == PT_SEL_RECALL) {
|
||||
|
||||
/**
|
||||
/*
|
||||
* Caller is requesting the SM cap of thread
|
||||
* this object is paging - it is stored at SM_SEL_EC_CLIENT
|
||||
*/
|
||||
@ -188,14 +193,16 @@ void Pager_object::_invoke_handler()
|
||||
void Pager_object::wake_up() { cancel_blocking(); }
|
||||
|
||||
|
||||
void Pager_object::client_cancel_blocking() {
|
||||
void Pager_object::client_cancel_blocking()
|
||||
{
|
||||
uint8_t res = sm_ctrl(exc_pt_sel() + SM_SEL_EC_CLIENT, SEMAPHORE_UP);
|
||||
if (res != NOVA_OK)
|
||||
PWRN("cancel blocking failed");
|
||||
}
|
||||
|
||||
|
||||
uint8_t Pager_object::client_recall() {
|
||||
uint8_t Pager_object::client_recall()
|
||||
{
|
||||
return ec_ctrl(_state.sel_client_ec);
|
||||
}
|
||||
|
||||
@ -217,7 +224,7 @@ Pager_object::Pager_object(unsigned long badge)
|
||||
/* creates local EC */
|
||||
Thread_base::start();
|
||||
|
||||
/* Create portal for exception handlers 0x0 - 0xd */
|
||||
/* create portal for exception handlers 0x0 - 0xd */
|
||||
for (unsigned i = 0; i < PT_SEL_PAGE_FAULT; i++) {
|
||||
res = create_pt(exc_pt_sel() + i, pd_sel, _tid.ec_sel,
|
||||
Mtd(0), (addr_t)_exception_handler);
|
||||
@ -241,7 +248,7 @@ Pager_object::Pager_object(unsigned long badge)
|
||||
throw Create_page_fault_pt_failed();
|
||||
}
|
||||
|
||||
/* Create portal for exception handlers 0xf - 0x19 */
|
||||
/* create portal for exception handlers 0xf - 0x19 */
|
||||
for (unsigned i = PT_SEL_PAGE_FAULT + 1; i < PT_SEL_PARENT; i++) {
|
||||
res = create_pt(exc_pt_sel() + i, pd_sel, _tid.ec_sel,
|
||||
Mtd(0), (addr_t)_exception_handler);
|
||||
@ -261,7 +268,7 @@ Pager_object::Pager_object(unsigned long badge)
|
||||
throw Create_startup_pt_failed();
|
||||
}
|
||||
|
||||
/* Create portal for recall handler */
|
||||
/* create portal for recall handler */
|
||||
Mtd mtd(Mtd::ESP | Mtd::EIP | Mtd::ACDB | Mtd::EFL | Mtd::EBSD | Mtd::FSGS);
|
||||
res = create_pt(exc_pt_sel() + PT_SEL_RECALL, pd_sel, _tid.ec_sel,
|
||||
mtd, (addr_t)_recall_handler);
|
||||
@ -271,7 +278,7 @@ Pager_object::Pager_object(unsigned long badge)
|
||||
throw Create_recall_pt_failed();
|
||||
}
|
||||
|
||||
/* Create portal for final cleanup call used during destruction */
|
||||
/* create portal for final cleanup call used during destruction */
|
||||
res = create_pt(_pt_cleanup, pd_sel, _tid.ec_sel, Mtd(0),
|
||||
reinterpret_cast<addr_t>(_invoke_handler));
|
||||
if (res) {
|
||||
@ -287,9 +294,10 @@ Pager_object::Pager_object(unsigned long badge)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Pager_object::~Pager_object()
|
||||
{
|
||||
/**
|
||||
/*
|
||||
* Revoke all portals of Pager_object from others.
|
||||
* The portals will be finally revoked during thread destruction.
|
||||
*/
|
||||
@ -302,7 +310,8 @@ Pager_object::~Pager_object()
|
||||
sm_ctrl(sm_cap, SEMAPHORE_UP);
|
||||
revoke(Obj_crd(sm_cap, 0));
|
||||
|
||||
/* Make sure nobody is in the handler anymore by doing an IPC to a
|
||||
/*
|
||||
* Make sure nobody is in the handler anymore by doing an IPC to a
|
||||
* local cap pointing to same serving thread (if not running in the
|
||||
* context of the serving thread). When the call returns
|
||||
* we know that nobody is handled by this object anymore, because
|
||||
@ -315,7 +324,7 @@ Pager_object::~Pager_object()
|
||||
PERR("failure - cleanup call failed res=%d", res);
|
||||
}
|
||||
|
||||
/* Revoke portal used for the cleanup call */
|
||||
/* revoke portal used for the cleanup call */
|
||||
revoke(Obj_crd(_pt_cleanup, 0));
|
||||
cap_selector_allocator()->free(_pt_cleanup, 0);
|
||||
cap_selector_allocator()->free(sm_cap, 0);
|
||||
|
@ -21,14 +21,14 @@ using namespace Genode;
|
||||
|
||||
void Pager_object::_copy_state(Nova::Utcb * utcb)
|
||||
{
|
||||
_state.thread.ebp = utcb->bp;
|
||||
_state.thread.eax = utcb->ax;
|
||||
_state.thread.ebx = utcb->bx;
|
||||
_state.thread.ecx = utcb->cx;
|
||||
_state.thread.edx = utcb->dx;
|
||||
_state.thread.esi = utcb->si;
|
||||
_state.thread.edi = utcb->di;
|
||||
_state.thread.ebp = utcb->bp;
|
||||
_state.thread.eax = utcb->ax;
|
||||
_state.thread.ebx = utcb->bx;
|
||||
_state.thread.ecx = utcb->cx;
|
||||
_state.thread.edx = utcb->dx;
|
||||
_state.thread.esi = utcb->si;
|
||||
_state.thread.edi = utcb->di;
|
||||
|
||||
_state.thread.gs = utcb->gs.sel;
|
||||
_state.thread.fs = utcb->fs.sel;
|
||||
_state.thread.gs = utcb->gs.sel;
|
||||
_state.thread.fs = utcb->fs.sel;
|
||||
}
|
||||
|
@ -21,22 +21,22 @@ using namespace Genode;
|
||||
|
||||
void Pager_object::_copy_state(Nova::Utcb * utcb)
|
||||
{
|
||||
_state.thread.rbp = utcb->bp;
|
||||
_state.thread.rax = utcb->ax;
|
||||
_state.thread.rbx = utcb->bx;
|
||||
_state.thread.rcx = utcb->cx;
|
||||
_state.thread.rdx = utcb->dx;
|
||||
_state.thread.rsi = utcb->si;
|
||||
_state.thread.rdi = utcb->di;
|
||||
_state.thread.rbp = utcb->bp;
|
||||
_state.thread.rax = utcb->ax;
|
||||
_state.thread.rbx = utcb->bx;
|
||||
_state.thread.rcx = utcb->cx;
|
||||
_state.thread.rdx = utcb->dx;
|
||||
_state.thread.rsi = utcb->si;
|
||||
_state.thread.rdi = utcb->di;
|
||||
|
||||
_state.thread.r8 = utcb->r8;
|
||||
_state.thread.r9 = utcb->r9;
|
||||
_state.thread.r10 = utcb->r10;
|
||||
_state.thread.r11 = utcb->r11;
|
||||
_state.thread.r12 = utcb->r12;
|
||||
_state.thread.r13 = utcb->r13;
|
||||
_state.thread.r14 = utcb->r14;
|
||||
_state.thread.r15 = utcb->r15;
|
||||
_state.thread.r8 = utcb->r8;
|
||||
_state.thread.r9 = utcb->r9;
|
||||
_state.thread.r10 = utcb->r10;
|
||||
_state.thread.r11 = utcb->r11;
|
||||
_state.thread.r12 = utcb->r12;
|
||||
_state.thread.r13 = utcb->r13;
|
||||
_state.thread.r14 = utcb->r14;
|
||||
_state.thread.r15 = utcb->r15;
|
||||
|
||||
_state.thread.ss = utcb->ss.sel;
|
||||
_state.thread.ss = utcb->ss.sel;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/***********************
|
||||
** Server entrypoint **
|
||||
***********************/
|
||||
@ -62,13 +63,11 @@ void Rpc_entrypoint::_dissolve(Rpc_object_base *obj)
|
||||
remove_locked(obj);
|
||||
|
||||
/*
|
||||
* The activation may execute a blocking operation
|
||||
* in a dispatch function. Before resolving the
|
||||
* corresponding object, we need to ensure that
|
||||
* it is no longer used by an activation. Therefore,
|
||||
* we to need cancel an eventually blocking operation
|
||||
* and let the activation leave the context of the
|
||||
* object.
|
||||
* The activation may execute a blocking operation in a dispatch function.
|
||||
* Before resolving the corresponding object, we need to ensure that it is
|
||||
* no longer used by an activation. Therefore, we to need cancel an
|
||||
* eventually blocking operation and let the activation leave the context
|
||||
* of the object.
|
||||
*/
|
||||
_leave_server_object(obj);
|
||||
|
||||
@ -123,7 +122,9 @@ void Rpc_entrypoint::_activation_entry()
|
||||
ep->_curr_obj = curr_obj;
|
||||
}
|
||||
if (!ep->_curr_obj) {
|
||||
/* Badge is used to suppress error message solely.
|
||||
|
||||
/*
|
||||
* Badge is used to suppress error message solely.
|
||||
* It's non zero during cleanup call of an
|
||||
* rpc_object_base object, see _leave_server_object.
|
||||
*/
|
||||
@ -205,7 +206,7 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
_delay_start(Lock::LOCKED),
|
||||
_cap_session(cap_session)
|
||||
{
|
||||
/**
|
||||
/*
|
||||
* Create thread if we aren't running in core.
|
||||
*
|
||||
* For core this code can't be performed since the sessions aren't
|
||||
@ -242,7 +243,7 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
request_event_portal(pager_cap, _tid.exc_pt_sel,
|
||||
Nova::PT_SEL_RECALL);
|
||||
|
||||
/**
|
||||
/*
|
||||
* Request native thread cap, _thread_cap only a token.
|
||||
* The native thread cap is required to attach new rpc objects
|
||||
* (to create portals bound to the ec)
|
||||
@ -254,7 +255,7 @@ Rpc_entrypoint::Rpc_entrypoint(Cap_session *cap_session, size_t stack_size,
|
||||
_tid.ec_sel = ec_cap.local_name();
|
||||
}
|
||||
else
|
||||
/**
|
||||
/*
|
||||
* Required for core threads (creates local EC)
|
||||
*/
|
||||
Thread_base::start();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Native_capability
|
||||
Cpu_session_component::native_cap(Thread_capability thread_cap)
|
||||
{
|
||||
@ -30,6 +31,7 @@ Cpu_session_component::native_cap(Thread_capability thread_cap)
|
||||
return thread->platform_thread()->native_cap();
|
||||
}
|
||||
|
||||
|
||||
Native_capability
|
||||
Cpu_session_component::pause_sync(Thread_capability thread_cap)
|
||||
{
|
||||
@ -41,6 +43,7 @@ Cpu_session_component::pause_sync(Thread_capability thread_cap)
|
||||
return thread->platform_thread()->pause();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Cpu_session_component::single_step(Thread_capability thread_cap, bool enable)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
|
||||
/* Core includes */
|
||||
/* core includes */
|
||||
#include <cpu_session_component.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
@ -28,6 +28,7 @@ enum {
|
||||
ECHO_EXC_BASE = 0
|
||||
};
|
||||
|
||||
|
||||
inline void *echo_stack_top()
|
||||
{
|
||||
static char echo_stack[ECHO_STACK_SIZE];
|
||||
|
@ -29,12 +29,9 @@ namespace Genode {
|
||||
|
||||
static long _unique_id_cnt;
|
||||
|
||||
class Cap_object : public Native_capability,
|
||||
public List<Cap_object>::Element
|
||||
struct Cap_object : Native_capability, List<Cap_object>::Element
|
||||
{
|
||||
public:
|
||||
|
||||
Cap_object(addr_t cap_sel) : Native_capability(cap_sel) {}
|
||||
Cap_object(addr_t cap_sel) : Native_capability(cap_sel) {}
|
||||
};
|
||||
|
||||
Tslab<Cap_object, 128> _cap_slab;
|
||||
@ -47,8 +44,7 @@ namespace Genode {
|
||||
* Constructor
|
||||
*/
|
||||
Cap_session_component(Allocator *md_alloc, const char *args)
|
||||
:
|
||||
_cap_slab(md_alloc) { }
|
||||
: _cap_slab(md_alloc) { }
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -71,9 +67,9 @@ namespace Genode {
|
||||
addr_t pt_sel = cap_selector_allocator()->alloc(0);
|
||||
addr_t pd_sel = Platform_pd::pd_core_sel();
|
||||
addr_t ec_sel = ep.local_name();
|
||||
|
||||
|
||||
using namespace Nova;
|
||||
|
||||
|
||||
Lock::Guard cap_lock(_cap_lock);
|
||||
|
||||
/* create cap object */
|
||||
@ -105,7 +101,8 @@ namespace Genode {
|
||||
return Native_capability::invalid_cap();
|
||||
}
|
||||
|
||||
void free(Native_capability cap) {
|
||||
void free(Native_capability cap)
|
||||
{
|
||||
if (!cap.valid()) return;
|
||||
|
||||
Lock::Guard cap_lock(_cap_lock);
|
||||
@ -120,7 +117,7 @@ namespace Genode {
|
||||
}
|
||||
}
|
||||
PDBG("invalid cap object");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,7 @@ inline int map_local(Nova::Utcb *utcb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unmap pages from the local address space
|
||||
*
|
||||
|
@ -88,7 +88,6 @@ namespace Genode {
|
||||
* \return PD selector
|
||||
*/
|
||||
static addr_t pd_core_sel() { return __core_pd_sel; }
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -117,11 +117,11 @@ class Genode::Irq_proxy_component : public Irq_proxy<Irq_thread>
|
||||
{
|
||||
/* alloc slector where IRQ will be mapped */
|
||||
_irq_sel = cap_selector_allocator()->alloc();
|
||||
|
||||
|
||||
/* since we run in APIC mode translate IRQ 0 (PIT) to 2 */
|
||||
if (!_irq_number)
|
||||
_irq_number = 2;
|
||||
|
||||
|
||||
/* map IRQ number to selector */
|
||||
int ret = map_local((Nova::Utcb *)Thread_base::myself()->utcb(),
|
||||
Nova::Obj_crd(platform_specific()->gsi_base_sel() + _irq_number, 0),
|
||||
@ -131,7 +131,7 @@ class Genode::Irq_proxy_component : public Irq_proxy<Irq_thread>
|
||||
PERR("Could not map IRQ %ld", _irq_number);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* assign IRQ to CPU */
|
||||
enum { CPU = 0 };
|
||||
Nova::assign_gsi(_irq_sel, 0, CPU);
|
||||
|
@ -36,6 +36,7 @@ enum { verbose_boot_info = true };
|
||||
|
||||
Native_utcb *main_thread_utcb();
|
||||
|
||||
|
||||
/**
|
||||
* Initial value of esp register, saved by the crt0 startup code
|
||||
*
|
||||
@ -304,7 +305,7 @@ Platform::Platform() :
|
||||
Native_config::context_area_virtual_base() +
|
||||
Native_config::context_area_virtual_size(), check[i]);
|
||||
nova_die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize core's physical-memory and I/O memory allocator */
|
||||
@ -392,7 +393,7 @@ Platform::Platform() :
|
||||
|
||||
addr_t core_local_addr =
|
||||
_map_page(trunc_page(mem_desc->addr) >> get_page_size_log2(),
|
||||
(round_page(mem_desc->addr + mem_desc->size) -
|
||||
(round_page(mem_desc->addr + mem_desc->size) -
|
||||
trunc_page(mem_desc->addr)) >> get_page_size_log2());
|
||||
if (!core_local_addr) {
|
||||
PERR("could not map multi boot module");
|
||||
@ -410,7 +411,7 @@ Platform::Platform() :
|
||||
if (trunc_page(mem_desc->addr) <= mem_desc->aux &&
|
||||
mem_desc->aux < round_page(mem_desc->addr + mem_desc->size)) {
|
||||
aux = core_local_addr + (mem_desc->aux - mem_desc->addr);
|
||||
} else {
|
||||
} else {
|
||||
curr_cmd_line_page = mem_desc->aux >> get_page_size_log2();
|
||||
if (curr_cmd_line_page != prev_cmd_line_page) {
|
||||
mapped_cmd_line = _map_page(curr_cmd_line_page, 2);
|
||||
@ -425,7 +426,6 @@ Platform::Platform() :
|
||||
Rom_module *rom_module = new (core_mem_alloc())
|
||||
Rom_module(core_local_addr, mem_desc->size, name);
|
||||
_rom_fs.insert(rom_module);
|
||||
|
||||
}
|
||||
|
||||
/* export hypervisor info page as ROM module */
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/***************************
|
||||
** Public object members **
|
||||
***************************/
|
||||
|
@ -64,7 +64,7 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
return -3;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Create semaphore required for Genode locking.
|
||||
* It is created at the root pager exception base +
|
||||
* SM_SEL_EC_CLIENT and can be later on requested by the thread
|
||||
@ -127,14 +127,14 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
|
||||
uint8_t res;
|
||||
|
||||
/* Create lock for EC used by lock_helper */
|
||||
/* create lock for EC used by lock_helper */
|
||||
res = create_sm(sm_ec_sel, pd_core_sel, 0);
|
||||
if (res != NOVA_OK) {
|
||||
PERR("could not create semaphore for new thread");
|
||||
goto cleanup_base;
|
||||
}
|
||||
|
||||
/* Remap exception portals for first thread */
|
||||
/* remap exception portals for first thread */
|
||||
if (map_local((Utcb *)Thread_base::myself()->utcb(),
|
||||
Obj_crd(_pager->exc_pt_sel(), 4),
|
||||
Obj_crd(_sel_exc_base, 4)))
|
||||
@ -155,7 +155,7 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
goto cleanup_base;
|
||||
}
|
||||
|
||||
/* Remap Genode specific, RECALL and STARTUP portals for first thread */
|
||||
/* remap Genode specific, RECALL and STARTUP portals for first thread */
|
||||
for (unsigned i = 0; i < sizeof(remap_dst)/sizeof(remap_dst[0]); i++) {
|
||||
if (map_local((Utcb *)Thread_base::myself()->utcb(),
|
||||
Obj_crd(remap_src[i], 0),
|
||||
@ -172,7 +172,7 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
goto cleanup_pd;
|
||||
}
|
||||
|
||||
/* Create first thread in task */
|
||||
/* create first thread in task */
|
||||
enum { THREAD_GLOBAL = true };
|
||||
res = create_ec(_sel_ec(), pd_sel, _cpu_no, pd_utcb, 0, 0,
|
||||
THREAD_GLOBAL);
|
||||
@ -181,7 +181,7 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
goto cleanup_pd;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* We have to assign the pd here, because after create_sc the thread
|
||||
* becomes running immediately.
|
||||
*/
|
||||
@ -190,10 +190,10 @@ int Platform_thread::start(void *ip, void *sp)
|
||||
_pager->initial_eip((addr_t)ip);
|
||||
_pager->initial_esp((addr_t)sp);
|
||||
|
||||
/* Let the thread run */
|
||||
/* let the thread run */
|
||||
res = create_sc(_sel_sc(), pd_sel, _sel_ec(), Qpd());
|
||||
if (res != NOVA_OK) {
|
||||
/**
|
||||
/*
|
||||
* Reset pd cap since thread got not running and pd cap will
|
||||
* be revoked during cleanup.
|
||||
*/
|
||||
@ -257,13 +257,15 @@ void Platform_thread::resume()
|
||||
_pager->wake_up();
|
||||
}
|
||||
|
||||
|
||||
Thread_state Platform_thread::state()
|
||||
{
|
||||
Thread_state s;
|
||||
if (!_pager) throw Cpu_session::State_access_failed();
|
||||
_pager->copy_thread_state(&s);
|
||||
return s;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::state(Thread_state s)
|
||||
{
|
||||
@ -274,7 +276,7 @@ void Platform_thread::state(Thread_state s)
|
||||
if (_sel_exc_base != Native_thread::INVALID_INDEX)
|
||||
throw Cpu_session::State_access_failed();
|
||||
|
||||
/**
|
||||
/*
|
||||
* _sel_exc_base exception base of thread in caller
|
||||
* protection domain - not in Core !
|
||||
* _is_vcpu If true it will run as vCPU,
|
||||
@ -282,7 +284,8 @@ void Platform_thread::state(Thread_state s)
|
||||
*/
|
||||
_sel_exc_base = s.sel_exc_base;
|
||||
_is_vcpu = s.is_vcpu;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::cancel_blocking()
|
||||
{
|
||||
@ -291,6 +294,7 @@ void Platform_thread::cancel_blocking()
|
||||
_pager->client_cancel_blocking();
|
||||
}
|
||||
|
||||
|
||||
void Platform_thread::single_step(bool on)
|
||||
{
|
||||
if (!_pager) return;
|
||||
@ -298,6 +302,7 @@ void Platform_thread::single_step(bool on)
|
||||
_pager->single_step(on);
|
||||
}
|
||||
|
||||
|
||||
unsigned long Platform_thread::pager_object_badge() const
|
||||
{
|
||||
return Native_thread::INVALID_INDEX;
|
||||
@ -305,9 +310,11 @@ unsigned long Platform_thread::pager_object_badge() const
|
||||
|
||||
|
||||
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id)
|
||||
: _pd(0), _pager(0), _id_base(cap_selector_allocator()->alloc(1)),
|
||||
_sel_exc_base(Native_thread::INVALID_INDEX), _cpu_no(0),
|
||||
_is_main_thread(false), _is_vcpu(false) { }
|
||||
:
|
||||
_pd(0), _pager(0), _id_base(cap_selector_allocator()->alloc(1)),
|
||||
_sel_exc_base(Native_thread::INVALID_INDEX), _cpu_no(0),
|
||||
_is_main_thread(false), _is_vcpu(false)
|
||||
{ }
|
||||
|
||||
|
||||
Platform_thread::~Platform_thread()
|
||||
|
@ -30,6 +30,7 @@ using namespace Genode;
|
||||
|
||||
void Ram_session_component::_export_ram_ds(Dataspace_component *ds) { }
|
||||
|
||||
|
||||
void Ram_session_component::_revoke_ram_ds(Dataspace_component *ds)
|
||||
{
|
||||
size_t page_rounded_size = (ds->size() + get_page_size() - 1) & get_page_mask();
|
||||
@ -48,6 +49,7 @@ void Ram_session_component::_revoke_ram_ds(Dataspace_component *ds)
|
||||
ds->assign_core_local_addr(0);
|
||||
}
|
||||
|
||||
|
||||
void Ram_session_component::_clear_ds(Dataspace_component *ds)
|
||||
{
|
||||
/*
|
||||
|
@ -24,6 +24,7 @@ using namespace Genode;
|
||||
|
||||
static const bool verbose = false;
|
||||
|
||||
|
||||
void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
|
||||
{
|
||||
addr_t const core_local_end = core_local_base + (size - 1);
|
||||
@ -48,7 +49,7 @@ void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
|
||||
+ (0x1000 << crd.order()); /* size of mapping */
|
||||
} else {
|
||||
|
||||
/* This can happen if the region has never been touched */
|
||||
/* this can happen if the region has never been touched */
|
||||
|
||||
if (verbose)
|
||||
PINF("Nothing mapped at local: %08lx virt: %08lx",
|
||||
|
@ -36,6 +36,7 @@ void Signal_source_component::release(Signal_context_component *context)
|
||||
_signal_queue.remove(context);
|
||||
}
|
||||
|
||||
|
||||
void Signal_source_component::submit(Signal_context_component *context,
|
||||
Ipc_ostream *ostream,
|
||||
int cnt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user