mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 23:42:32 +00:00
base-fiasco: coding style
This commit is contained in:
parent
6930372d55
commit
abd688097a
@ -1,4 +1 @@
|
||||
This repository contains the L4/Fiasco-specific implementation of Genode.
|
||||
|
||||
For instructions to build and start the Fiasco version of Genode, please
|
||||
consult the documentation located at 'base-fiasco/doc/fiasco.txt'.
|
||||
|
@ -14,7 +14,10 @@
|
||||
/* core includes */
|
||||
#include <core_log.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
void Genode::Core_log::out(char const c) { Fiasco::outchar(c); }
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
void Core_log::out(char const c) { Fiasco::outchar(c); }
|
||||
|
@ -27,15 +27,18 @@
|
||||
/* core includes */
|
||||
#include <util.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Mapping
|
||||
{
|
||||
class Mapping;
|
||||
class Ipc_pager;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Mapping
|
||||
{
|
||||
private:
|
||||
|
||||
addr_t _dst_addr;
|
||||
@ -83,14 +86,11 @@ namespace Genode {
|
||||
touch_read((unsigned char const volatile *)(core_local_addr + i));
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Special paging server class
|
||||
*/
|
||||
class Ipc_pager
|
||||
{
|
||||
class Genode::Ipc_pager
|
||||
{
|
||||
private:
|
||||
|
||||
Fiasco::l4_threadid_t _last { }; /* origin of last fault message */
|
||||
@ -174,7 +174,6 @@ namespace Genode {
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */
|
||||
|
@ -18,12 +18,8 @@
|
||||
#include <platform.h>
|
||||
#include <util.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
|
@ -15,9 +15,13 @@
|
||||
#ifndef _CORE__INCLUDE__PLATFORM_H_
|
||||
#define _CORE__INCLUDE__PLATFORM_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator_avl.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space.h>
|
||||
|
||||
/* core includes */
|
||||
#include <synced_range_allocator.h>
|
||||
#include <platform_generic.h>
|
||||
#include <platform_thread.h>
|
||||
@ -25,11 +29,11 @@
|
||||
#include <boot_modules.h>
|
||||
#include <assertion.h>
|
||||
|
||||
namespace Genode { class Platform; }
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Platform : public Platform_generic
|
||||
{
|
||||
class Genode::Platform : public Platform_generic
|
||||
{
|
||||
private:
|
||||
|
||||
/*
|
||||
@ -168,7 +172,6 @@ namespace Genode {
|
||||
size_t max_caps() const override { return Capability_space::max_caps(); }
|
||||
|
||||
void wait_for_exit() override;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__PLATFORM_H_ */
|
||||
|
@ -17,19 +17,25 @@
|
||||
#ifndef _CORE__INCLUDE__PLATFORM_PD_H_
|
||||
#define _CORE__INCLUDE__PLATFORM_PD_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
|
||||
/* core includes */
|
||||
#include <platform_thread.h>
|
||||
#include <address_space.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Platform_thread;
|
||||
class Platform_pd : public Address_space
|
||||
{
|
||||
class Platform_pd;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Platform_pd : public Address_space
|
||||
{
|
||||
private:
|
||||
|
||||
/*
|
||||
@ -198,7 +204,6 @@ namespace Genode {
|
||||
*****************************/
|
||||
|
||||
void flush(addr_t, size_t, Core_local_addr) override;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */
|
||||
|
@ -24,16 +24,18 @@
|
||||
#include <platform_pd.h>
|
||||
#include <assertion.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
class Platform_pd;
|
||||
class Platform_thread : Interface
|
||||
{
|
||||
class Platform_thread;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Platform_thread : Interface
|
||||
{
|
||||
private:
|
||||
|
||||
/*
|
||||
@ -143,6 +145,7 @@ namespace Genode {
|
||||
*/
|
||||
Affinity::Location affinity() const { return Affinity::Location(); }
|
||||
|
||||
|
||||
/************************
|
||||
** Accessor functions **
|
||||
************************/
|
||||
@ -184,7 +187,6 @@ namespace Genode {
|
||||
int thread_id() const { return _thread_id; }
|
||||
Fiasco::l4_threadid_t native_thread_id() const { return _l4_thread_id; }
|
||||
Name name() const { return _name; }
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__PLATFORM_THREAD_H_ */
|
||||
|
@ -14,11 +14,13 @@
|
||||
#ifndef _CORE__INCLUDE__RPC_CAP_FACTORY_H_
|
||||
#define _CORE__INCLUDE__RPC_CAP_FACTORY_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
#include <base/capability.h>
|
||||
|
||||
namespace Genode { class Rpc_cap_factory; }
|
||||
|
||||
|
||||
class Genode::Rpc_cap_factory
|
||||
{
|
||||
private:
|
||||
|
@ -25,13 +25,8 @@
|
||||
#include <base/internal/fiasco_thread_helper.h>
|
||||
#include <base/internal/page_size.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
#include <l4/sys/ktrace.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
|
@ -16,11 +16,8 @@
|
||||
#include <util.h>
|
||||
#include <io_mem_session_component.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sigma0/sigma0.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
@ -19,15 +19,12 @@
|
||||
#include <irq_root.h>
|
||||
#include <util.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
bool Irq_object::_associate()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
@ -74,7 +71,9 @@ void Irq_object::_wait_for_irq()
|
||||
L4_IPC_SHORT_MSG, &dw0, &dw1,
|
||||
L4_IPC_NEVER, &result);
|
||||
|
||||
if (L4_IPC_IS_ERROR(result)) error("Ipc error ", L4_IPC_ERROR(result));
|
||||
if (L4_IPC_IS_ERROR(result))
|
||||
error("Ipc error ", L4_IPC_ERROR(result));
|
||||
|
||||
} while (L4_IPC_IS_ERROR(result));
|
||||
}
|
||||
|
||||
@ -106,7 +105,7 @@ void Irq_object::entry()
|
||||
if (!_sig_cap.valid())
|
||||
continue;
|
||||
|
||||
Genode::Signal_transmitter(_sig_cap).submit(1);
|
||||
Signal_transmitter(_sig_cap).submit(1);
|
||||
|
||||
_sync_ack.block();
|
||||
}
|
||||
@ -142,7 +141,7 @@ Irq_session_component::Irq_session_component(Range_allocator &irq_alloc,
|
||||
|
||||
Irq_session_component::~Irq_session_component()
|
||||
{
|
||||
error("Not yet implemented.");
|
||||
error(__func__, " - not implemented");
|
||||
}
|
||||
|
||||
|
||||
@ -152,13 +151,13 @@ void Irq_session_component::ack_irq()
|
||||
}
|
||||
|
||||
|
||||
void Irq_session_component::sigh(Genode::Signal_context_capability cap)
|
||||
void Irq_session_component::sigh(Signal_context_capability cap)
|
||||
{
|
||||
_irq_object.sigh(cap);
|
||||
}
|
||||
|
||||
|
||||
Genode::Irq_session::Info Irq_session_component::info()
|
||||
Irq_session::Info Irq_session_component::info()
|
||||
{
|
||||
/* no MSI support */
|
||||
return { .type = Info::Type::INVALID, .address = 0, .value = 0 };
|
||||
|
@ -22,10 +22,8 @@
|
||||
#include <base/internal/native_thread.h>
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Fiasco;
|
||||
|
@ -17,12 +17,8 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
@ -31,17 +31,11 @@
|
||||
#include <platform_pd.h>
|
||||
#include <util.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/kernel.h>
|
||||
#include <l4/sys/kip.h>
|
||||
#include <l4/sigma0/sigma0.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Fiasco;
|
||||
|
||||
|
||||
/***********************************
|
||||
@ -54,6 +48,7 @@ static Synced_range_allocator<Allocator_avl> &_core_address_ranges()
|
||||
return _core_address_ranges;
|
||||
}
|
||||
|
||||
|
||||
enum { PAGER_STACK_ELEMENTS = 1024 };
|
||||
static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS];
|
||||
static unsigned _core_pager_arg;
|
||||
@ -66,8 +61,6 @@ static void _core_pager_loop()
|
||||
{
|
||||
unsigned pd_id = _core_pager_arg;
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
l4_threadid_t t;
|
||||
l4_umword_t dw0, dw1;
|
||||
l4_msgdope_t r;
|
||||
@ -136,7 +129,7 @@ Platform::Sigma0::Sigma0()
|
||||
0, Affinity::Location(), Session_label(),
|
||||
Cpu_session::Name("sigma0"))
|
||||
{
|
||||
cap(Capability_space::import(Fiasco::sigma0_threadid, Rpc_obj_key()));
|
||||
cap(Capability_space::import(sigma0_threadid, Rpc_obj_key()));
|
||||
}
|
||||
|
||||
|
||||
@ -166,8 +159,6 @@ Platform::Core_pager::Core_pager(Platform_pd &core_pd)
|
||||
void *sp = (void *)&_core_pager_stack[PAGER_STACK_ELEMENTS - 1];
|
||||
start((void *)_core_pager_loop, sp);
|
||||
|
||||
using namespace Fiasco;
|
||||
|
||||
/* pager0 receives pagefaults from me - for NULL pointer detection */
|
||||
l4_umword_t d;
|
||||
l4_threadid_t preempter = L4_INVALID_ID;
|
||||
@ -236,8 +227,6 @@ static inline void remove_region(Region r, Range_allocator &alloc)
|
||||
*/
|
||||
static inline int sigma0_req_region(addr_t *addr, unsigned log2size)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
/* XXX sigma0 always maps pages RW */
|
||||
l4_umword_t req_fpage = l4_fpage(0, log2size, 0, 0).fpage;
|
||||
void* rcv_window = L4_IPC_MAPMSG(0, L4_WHOLE_ADDRESS_SPACE);
|
||||
@ -246,7 +235,7 @@ static inline int sigma0_req_region(addr_t *addr, unsigned log2size)
|
||||
l4_msgdope_t result;
|
||||
l4_msgtag_t tag;
|
||||
|
||||
int err = l4_ipc_call_tag(Fiasco::sigma0_threadid,
|
||||
int err = l4_ipc_call_tag(sigma0_threadid,
|
||||
L4_IPC_SHORT_MSG, SIGMA0_REQ_FPAGE_ANY, req_fpage,
|
||||
l4_msgtag(L4_MSGTAG_SIGMA0, 0, 0, 0),
|
||||
rcv_window, &base, (l4_umword_t *)&rcv_fpage,
|
||||
@ -288,7 +277,7 @@ void Platform::_setup_mem_alloc()
|
||||
if (!err) {
|
||||
/* XXX do not allocate page0 */
|
||||
if (addr == 0) {
|
||||
Fiasco::l4_fpage_unmap(Fiasco::l4_fpage(0, log2_size, 0, 0),
|
||||
l4_fpage_unmap(l4_fpage(0, log2_size, 0, 0),
|
||||
L4_FP_FLUSH_PAGE | L4_FP_ALL_SPACES);
|
||||
continue;
|
||||
}
|
||||
@ -307,14 +296,14 @@ void Platform::_setup_mem_alloc()
|
||||
}
|
||||
|
||||
|
||||
void Platform::_setup_irq_alloc() {
|
||||
_irq_alloc.add_range(0, 0x10); }
|
||||
|
||||
|
||||
static Fiasco::l4_kernel_info_t *get_kip()
|
||||
void Platform::_setup_irq_alloc()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
_irq_alloc.add_range(0, 0x10);
|
||||
}
|
||||
|
||||
|
||||
static l4_kernel_info_t *get_kip()
|
||||
{
|
||||
static l4_kernel_info_t *kip = nullptr;
|
||||
|
||||
if (kip) return kip;
|
||||
@ -329,7 +318,7 @@ static Fiasco::l4_kernel_info_t *get_kip()
|
||||
l4_msgdope_t r;
|
||||
l4_msgtag_t tag;
|
||||
|
||||
err = l4_ipc_call_tag(Fiasco::sigma0_threadid,
|
||||
err = l4_ipc_call_tag(sigma0_threadid,
|
||||
L4_IPC_SHORT_MSG, SIGMA0_REQ_KIP, 0,
|
||||
l4_msgtag(L4_MSGTAG_SIGMA0, 0, 0, 0),
|
||||
fpage, &dw0, &dw1,
|
||||
@ -357,10 +346,9 @@ static Fiasco::l4_kernel_info_t *get_kip()
|
||||
return kip;
|
||||
}
|
||||
|
||||
|
||||
void Platform::_setup_basics()
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
l4_kernel_info_t * kip = get_kip();
|
||||
|
||||
/* add KIP as ROM module */
|
||||
@ -380,6 +368,7 @@ void Platform::_setup_basics()
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (_vm_size == 0)
|
||||
panic("Virtual memory configuration not found");
|
||||
|
||||
@ -411,7 +400,8 @@ void Platform::_setup_basics()
|
||||
}
|
||||
|
||||
|
||||
Platform::Platform() :
|
||||
Platform::Platform()
|
||||
:
|
||||
_ram_alloc(nullptr), _io_mem_alloc(&core_mem_alloc()),
|
||||
_io_port_alloc(&core_mem_alloc()), _irq_alloc(&core_mem_alloc()),
|
||||
_region_alloc(&core_mem_alloc()),
|
||||
@ -432,7 +422,7 @@ Platform::Platform() :
|
||||
|
||||
log(_rom_fs);
|
||||
|
||||
Fiasco::l4_threadid_t myself = Fiasco::l4_myself();
|
||||
l4_threadid_t myself = l4_myself();
|
||||
|
||||
Platform_pd::init();
|
||||
|
||||
@ -451,7 +441,7 @@ Platform::Platform() :
|
||||
_core_pd->bind_thread(core_thread);
|
||||
|
||||
/* we never call _core_thread.start(), so set name directly */
|
||||
Fiasco::fiasco_register_thread_name(core_thread.native_thread_id(),
|
||||
fiasco_register_thread_name(core_thread.native_thread_id(),
|
||||
core_thread.name().string());
|
||||
|
||||
/* core log as ROM module */
|
||||
|
@ -25,19 +25,13 @@
|
||||
#include <util.h>
|
||||
#include <platform_pd.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/syscalls.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Fiasco;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/**************************
|
||||
** Static class members **
|
||||
**************************/
|
||||
|
||||
static bool _init = false;
|
||||
|
||||
|
||||
|
@ -25,13 +25,8 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sys/utcb.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Fiasco;
|
||||
|
@ -14,13 +14,18 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* core includes */
|
||||
#include <ram_dataspace_factory.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
void Ram_dataspace_factory::_export_ram_ds(Dataspace_component &) { }
|
||||
|
||||
|
||||
void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component &) { }
|
||||
|
||||
|
||||
void Ram_dataspace_factory::_clear_ds(Dataspace_component &ds)
|
||||
{
|
||||
memset((void *)ds.phys_addr(), 0, ds.size());
|
||||
|
@ -11,18 +11,20 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/fiasco_thread_helper.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "util.h"
|
||||
/* core includes */
|
||||
#include <platform.h>
|
||||
#include <util.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Fiasco;
|
||||
|
||||
|
||||
void Platform::_setup_io_port_alloc()
|
||||
{
|
||||
l4_fpage_t fp;
|
||||
|
@ -14,8 +14,10 @@
|
||||
#ifndef _INCLUDE__FIASCO__THREAD_HELPER_H_
|
||||
#define _INCLUDE__FIASCO__THREAD_HELPER_H_
|
||||
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
|
||||
/**
|
||||
* Sigma0 thread ID
|
||||
|
@ -22,9 +22,7 @@
|
||||
#define _INCLUDE__BASE__INTERNAL__LOCK_HELPER_H_
|
||||
|
||||
/* L4/Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
}
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -17,10 +17,8 @@
|
||||
/* Genode includes */
|
||||
#include <base/stdint.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
@ -28,6 +26,7 @@ namespace Genode {
|
||||
struct Native_thread;
|
||||
}
|
||||
|
||||
|
||||
struct Genode::Native_thread
|
||||
{
|
||||
Fiasco::l4_threadid_t l4id;
|
||||
|
@ -14,10 +14,8 @@
|
||||
#ifndef _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_
|
||||
#define _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/kdebug.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
|
@ -14,10 +14,8 @@
|
||||
#ifndef _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_
|
||||
#define _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
|
29
repos/base-fiasco/src/include/fiasco/syscall.h
Normal file
29
repos/base-fiasco/src/include/fiasco/syscall.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* \brief Collection of L4/Fiasco kernel bindings
|
||||
* \author Norman Feske
|
||||
* \date 2020-12-06
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE__FIASCO__SYSCALL_H_
|
||||
#define _INCLUDE__FIASCO__SYSCALL_H_
|
||||
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
#include <l4/sys/kdebug.h>
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/kernel.h>
|
||||
#include <l4/sys/kip.h>
|
||||
#include <l4/sys/utcb.h>
|
||||
#include <l4/sys/ktrace.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
#include <l4/sigma0/sigma0.h>
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__FIASCO__SYSCALL_H_ */
|
@ -11,6 +11,7 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
|
||||
/* base-internal includes */
|
||||
|
@ -20,13 +20,11 @@
|
||||
#include <base/internal/ipc_server.h>
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
#include <l4/sys/syscalls.h>
|
||||
}
|
||||
/* L4/Fiasco includes */
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Fiasco;
|
||||
|
||||
|
||||
class Msg_header
|
||||
@ -34,9 +32,9 @@ class Msg_header
|
||||
private:
|
||||
|
||||
/* kernel-defined message header */
|
||||
Fiasco::l4_fpage_t rcv_fpage; /* unused */
|
||||
Fiasco::l4_msgdope_t size_dope;
|
||||
Fiasco::l4_msgdope_t send_dope;
|
||||
l4_fpage_t rcv_fpage; /* unused */
|
||||
l4_msgdope_t size_dope;
|
||||
l4_msgdope_t send_dope;
|
||||
|
||||
public:
|
||||
|
||||
@ -47,14 +45,14 @@ class Msg_header
|
||||
* arguments. The kernel does not fetch these data words from memory
|
||||
* but transfers them via the short-IPC registers.
|
||||
*/
|
||||
Fiasco::l4_umword_t protocol_word;
|
||||
Fiasco::l4_umword_t num_caps;
|
||||
l4_umword_t protocol_word;
|
||||
l4_umword_t num_caps;
|
||||
|
||||
private:
|
||||
|
||||
enum { MAX_CAPS_PER_MSG = Msgbuf_base::MAX_CAPS_PER_MSG };
|
||||
|
||||
Fiasco::l4_threadid_t _cap_tid [MAX_CAPS_PER_MSG];
|
||||
l4_threadid_t _cap_tid [MAX_CAPS_PER_MSG];
|
||||
unsigned long _cap_local_name [MAX_CAPS_PER_MSG];
|
||||
|
||||
size_t _num_msg_words(size_t num_data_words) const
|
||||
@ -65,7 +63,7 @@ class Msg_header
|
||||
* Account for the transfer of the protocol word, capability count,
|
||||
* and capability arguments in front of the payload.
|
||||
*/
|
||||
return 2 + caps_size/sizeof(Fiasco::l4_umword_t) + num_data_words;
|
||||
return 2 + caps_size/sizeof(l4_umword_t) + num_data_words;
|
||||
}
|
||||
|
||||
public:
|
||||
@ -77,8 +75,6 @@ class Msg_header
|
||||
*/
|
||||
void prepare_snd_msg(unsigned long protocol, Msgbuf_base const &snd_msg)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
protocol_word = protocol;
|
||||
num_caps = min((unsigned)MAX_CAPS_PER_MSG, snd_msg.used_caps());
|
||||
|
||||
@ -109,8 +105,6 @@ class Msg_header
|
||||
*/
|
||||
void prepare_rcv_msg(Msgbuf_base const &rcv_msg)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
size_t const rcv_max_words = rcv_msg.capacity()/sizeof(l4_umword_t);
|
||||
|
||||
size_dope = L4_IPC_DOPE(_num_msg_words(rcv_max_words), 0);
|
||||
@ -124,7 +118,7 @@ class Msg_header
|
||||
for (unsigned i = 0; i < min((unsigned)MAX_CAPS_PER_MSG, num_caps); i++) {
|
||||
|
||||
Rpc_obj_key const rpc_obj_key(_cap_local_name[i]);
|
||||
bool const cap_valid = !Fiasco::l4_is_invalid_id(_cap_tid[i]);
|
||||
bool const cap_valid = !l4_is_invalid_id(_cap_tid[i]);
|
||||
|
||||
Native_capability cap;
|
||||
if (cap_valid) {
|
||||
@ -147,8 +141,6 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
|
||||
Msgbuf_base &snd_msg, Msgbuf_base &rcv_msg,
|
||||
size_t)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
Capability_space::Ipc_cap_data const dst_data =
|
||||
Capability_space::ipc_cap_data(dst);
|
||||
|
||||
@ -190,8 +182,6 @@ Rpc_exception_code Genode::ipc_call(Native_capability dst,
|
||||
void Genode::ipc_reply(Native_capability caller, Rpc_exception_code exc,
|
||||
Msgbuf_base &snd_msg)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
Msg_header &snd_header = snd_msg.header<Msg_header>();
|
||||
snd_header.prepare_snd_msg(exc.value, snd_msg);
|
||||
|
||||
@ -209,8 +199,6 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
Msgbuf_base &reply_msg,
|
||||
Msgbuf_base &request_msg)
|
||||
{
|
||||
using namespace Fiasco;
|
||||
|
||||
l4_msgdope_t ipc_result;
|
||||
|
||||
bool need_to_wait = true;
|
||||
@ -276,7 +264,7 @@ Genode::Rpc_request Genode::ipc_reply_wait(Reply_capability const &last_caller,
|
||||
|
||||
Ipc_server::Ipc_server()
|
||||
:
|
||||
Native_capability(Capability_space::import(Fiasco::l4_myself(), Rpc_obj_key()))
|
||||
Native_capability(Capability_space::import(l4_myself(), Rpc_obj_key()))
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -17,15 +17,14 @@
|
||||
#include <cpu/memory_barrier.h>
|
||||
|
||||
/* L4/Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
}
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Lock::Lock(Lock::State initial)
|
||||
: _state(UNLOCKED), _owner(nullptr)
|
||||
:
|
||||
_state(UNLOCKED), _owner(nullptr)
|
||||
{
|
||||
if (initial == LOCKED)
|
||||
lock();
|
||||
@ -45,7 +44,7 @@ void Lock::lock(Applicant &myself)
|
||||
* XXX: How to notice cancel-blocking signals issued when being outside the
|
||||
* 'l4_ipc_sleep' system call?
|
||||
*/
|
||||
while (!Genode::cmpxchg(&_state, UNLOCKED, LOCKED))
|
||||
while (!cmpxchg(&_state, UNLOCKED, LOCKED))
|
||||
Fiasco::l4_ipc_sleep(Fiasco::l4_ipc_timeout(0, 0, 500, 0));
|
||||
|
||||
_owner = myself;
|
||||
@ -55,6 +54,6 @@ void Lock::lock(Applicant &myself)
|
||||
void Lock::unlock()
|
||||
{
|
||||
_owner = Applicant(nullptr);
|
||||
Genode::memory_barrier();
|
||||
memory_barrier();
|
||||
_state = UNLOCKED;
|
||||
}
|
||||
|
@ -16,9 +16,7 @@
|
||||
#include <base/sleep.h>
|
||||
|
||||
/* L4/Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/ipc.h>
|
||||
}
|
||||
#include <fiasco/syscall.h>
|
||||
|
||||
|
||||
void Genode::sleep_forever()
|
||||
|
Loading…
Reference in New Issue
Block a user