base-pistachio: coding style

This commit is contained in:
Norman Feske 2021-02-07 18:01:58 +01:00
parent 9633a0a524
commit df38140ed6
26 changed files with 725 additions and 749 deletions

View File

@ -14,9 +14,11 @@
/* core includes */ /* core includes */
#include <core_log.h> #include <core_log.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/kdebug.h>
}
void Genode::Core_log::out(char const c) { Pistachio::L4_KDB_PrintChar(c); }
void Genode::Core_log::out(char const c)
{
Pistachio::L4_KDB_PrintChar(c);
}

View File

@ -23,15 +23,18 @@
/* core-local includes */ /* core-local includes */
#include <kip.h> #include <kip.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/types.h>
}
namespace Genode { namespace Genode {
class Mapping class Mapping;
{ class Ipc_pager;
}
class Genode::Mapping
{
private: private:
union { union {
@ -78,14 +81,11 @@ namespace Genode {
else else
touch_read(core_local_addr); touch_read(core_local_addr);
} }
}; };
/** class Genode::Ipc_pager
* Special paging server class {
*/
class Ipc_pager
{
private: private:
Pistachio::L4_ThreadId_t _last; /* origin of last fault message */ Pistachio::L4_ThreadId_t _last; /* origin of last fault message */
@ -184,7 +184,6 @@ namespace Genode {
*/ */
return false; return false;
} }
}; };
}
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */ #endif /* _CORE__INCLUDE__IPC_PAGER_H_ */

View File

@ -14,9 +14,9 @@
#ifndef _CORE__INCLUDE__KIP_H_ #ifndef _CORE__INCLUDE__KIP_H_
#define _CORE__INCLUDE__KIP_H_ #define _CORE__INCLUDE__KIP_H_
#include <base/internal/pistachio.h>
namespace Pistachio { namespace Pistachio {
#include <l4/types.h>
#include <l4/kip.h>
/** /**
* Return a pointer to the kernel info page * Return a pointer to the kernel info page

View File

@ -18,13 +18,8 @@
#include <platform.h> #include <platform.h>
#include <util.h> #include <util.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/space.h>
#include <l4/types.h>
#include <l4/ipc.h>
#include <l4/kdebug.h>
}
namespace Genode { namespace Genode {

View File

@ -21,17 +21,17 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/capability_space.h> #include <base/internal/capability_space.h>
/* core-local includes */ /* core includes */
#include "synced_range_allocator.h" #include <synced_range_allocator.h>
#include "platform_generic.h" #include <platform_generic.h>
#include "platform_thread.h" #include <platform_thread.h>
#include "platform_pd.h" #include <platform_pd.h>
namespace Genode { class Platform; }
namespace Genode { class Genode::Platform : public Platform_generic
{
class Platform : public Platform_generic
{
private: private:
/* /*
@ -163,7 +163,6 @@ namespace Genode {
*/ */
return Affinity::Space(L4_NumProcessors(Pistachio::get_kip()), 1); return Affinity::Space(L4_NumProcessors(Pistachio::get_kip()), 1);
} }
}; };
}
#endif /* _CORE__INCLUDE__PLATFORM_H_ */ #endif /* _CORE__INCLUDE__PLATFORM_H_ */

View File

@ -14,19 +14,25 @@
#ifndef _CORE__INCLUDE__PLATFORM_PD_H_ #ifndef _CORE__INCLUDE__PLATFORM_PD_H_
#define _CORE__INCLUDE__PLATFORM_PD_H_ #define _CORE__INCLUDE__PLATFORM_PD_H_
/* Genode includes */
#include <base/allocator.h> #include <base/allocator.h>
/* base-internal includes */
#include <base/internal/pistachio.h>
/* core includes */
#include <platform_thread.h> #include <platform_thread.h>
#include <address_space.h> #include <address_space.h>
namespace Pistachio {
#include <l4/types.h>
}
namespace Genode { namespace Genode {
class Platform_thread; class Platform_thread;
class Platform_pd : public Address_space class Platform_pd;
{ }
class Genode::Platform_pd : public Address_space
{
private: private:
/* /*
@ -235,7 +241,6 @@ namespace Genode {
*****************************/ *****************************/
void flush(addr_t, size_t, Core_local_addr) override; void flush(addr_t, size_t, Core_local_addr) override;
}; };
}
#endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */ #endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */

View File

@ -24,9 +24,13 @@
#include <platform_pd.h> #include <platform_pd.h>
#include <assertion.h> #include <assertion.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/types.h>
namespace Genode {
class Platform_pd;
class Platform_thread;
} }
@ -40,11 +44,8 @@ inline unsigned long convert_native_thread_id_to_badge(Pistachio::L4_ThreadId_t
} }
namespace Genode { class Genode::Platform_thread : Interface
{
class Platform_pd;
class Platform_thread : Interface
{
private: private:
typedef Pistachio::L4_ThreadId_t L4_ThreadId_t; typedef Pistachio::L4_ThreadId_t L4_ThreadId_t;
@ -164,8 +165,10 @@ namespace Genode {
/** /**
* Return identification of thread when faulting * Return identification of thread when faulting
*/ */
unsigned long pager_object_badge() const { unsigned long pager_object_badge() const
return convert_native_thread_id_to_badge(_l4_thread_id); } {
return convert_native_thread_id_to_badge(_l4_thread_id);
}
/** /**
* Set the executing CPU for this thread * Set the executing CPU for this thread
@ -198,7 +201,6 @@ namespace Genode {
/* use only for core... */ /* use only for core... */
void set_l4_thread_id(Pistachio::L4_ThreadId_t id) { _l4_thread_id = id; } void set_l4_thread_id(Pistachio::L4_ThreadId_t id) { _l4_thread_id = id; }
}; };
}
#endif /* _CORE__INCLUDE__PLATFORM_THREAD_H_ */ #endif /* _CORE__INCLUDE__PLATFORM_THREAD_H_ */

View File

@ -16,9 +16,8 @@
#include <base/output.h> #include <base/output.h>
namespace Pistachio { /* base-internal includes */
#include <l4/types.h> #include <base/internal/pistachio.h>
}
namespace Genode { struct Formatted_tid; } namespace Genode { struct Formatted_tid; }

View File

@ -19,6 +19,7 @@
namespace Genode { class Rpc_cap_factory; } namespace Genode { class Rpc_cap_factory; }
class Genode::Rpc_cap_factory class Genode::Rpc_cap_factory
{ {
private: private:

View File

@ -22,18 +22,12 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/page_size.h> #include <base/internal/page_size.h>
#include <base/internal/pistachio.h>
/* core-local includes */ /* core-local includes */
#include <kip.h> #include <kip.h>
#include <print_l4_thread_id.h> #include <print_l4_thread_id.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/types.h>
#include <l4/ipc.h>
#include <l4/kdebug.h>
}
namespace Genode { namespace Genode {
inline void log_event(const char *) { } inline void log_event(const char *) { }

View File

@ -18,12 +18,8 @@
#include <io_mem_session_component.h> #include <io_mem_session_component.h>
#include <kip.h> #include <kip.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/ipc.h>
#include <l4/sigma0.h>
#include <l4/misc.h>
}
using namespace Genode; using namespace Genode;
@ -32,7 +28,7 @@ using namespace Genode;
* TODO This should take a size parameter and check if the whole * TODO This should take a size parameter and check if the whole
* region is "normal" memory. * region is "normal" memory.
*/ */
bool is_conventional_memory(addr_t base) static bool is_conventional_memory(addr_t base)
{ {
using namespace Pistachio; using namespace Pistachio;
L4_KernelInterfacePage_t *kip = get_kip(); L4_KernelInterfacePage_t *kip = get_kip();
@ -53,9 +49,11 @@ bool is_conventional_memory(addr_t base)
void Io_mem_session_component::_unmap_local(addr_t, size_t) { } void Io_mem_session_component::_unmap_local(addr_t, size_t) { }
static inline bool can_use_super_page(addr_t base, size_t size) { static inline bool can_use_super_page(addr_t base, size_t size)
{
return (base & (get_super_page_size() - 1)) == 0 return (base & (get_super_page_size() - 1)) == 0
&& (size >= get_super_page_size()); } && (size >= get_super_page_size());
}
addr_t Io_mem_session_component::_map_local(addr_t base, size_t size) addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)

View File

@ -19,10 +19,7 @@
#include <irq_root.h> #include <irq_root.h>
#include <util.h> #include <util.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio {
#include <l4/ipc.h>
}
using namespace Genode; using namespace Genode;
using namespace Pistachio; using namespace Pistachio;

View File

@ -18,19 +18,12 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/native_thread.h> #include <base/internal/native_thread.h>
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* core includes */ /* core includes */
#include <ipc_pager.h> #include <ipc_pager.h>
#include <pager.h> #include <pager.h>
namespace Pistachio
{
#include <l4/message.h>
#include <l4/ipc.h>
#include <l4/schedule.h>
#include <l4/kdebug.h>
}
using namespace Genode; using namespace Genode;
using namespace Pistachio; using namespace Pistachio;
@ -56,7 +49,10 @@ Mapping::Mapping(addr_t dst_addr, addr_t src_addr,
} }
Mapping::Mapping() { _map_item = L4_MapItem(L4_Nilpage, 0); } Mapping::Mapping()
{
_map_item = L4_MapItem(L4_Nilpage, 0);
}
/*************** /***************

View File

@ -16,12 +16,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/types.h>
#include <l4/ipc.h>
}
using namespace Genode; using namespace Genode;

View File

@ -23,6 +23,7 @@
#include <base/internal/stack_area.h> #include <base/internal/stack_area.h>
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/globals.h> #include <base/internal/globals.h>
#include <base/internal/pistachio.h>
/* core includes */ /* core includes */
#include <boot_modules.h> #include <boot_modules.h>
@ -35,15 +36,6 @@
#include <kip.h> #include <kip.h>
#include <print_l4_thread_id.h> #include <print_l4_thread_id.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/kip.h>
#include <l4/sigma0.h>
#include <l4/space.h>
#include <l4/bootinfo.h>
#include <l4/schedule.h>
}
using namespace Genode; using namespace Genode;
@ -61,6 +53,7 @@ static Synced_range_allocator<Allocator_avl> &_core_address_ranges()
return _core_address_ranges; return _core_address_ranges;
} }
enum { PAGER_STACK_ELEMENTS = 512 }; enum { PAGER_STACK_ELEMENTS = 512 };
static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS]; static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS];

View File

@ -17,14 +17,8 @@
#include <util.h> #include <util.h>
#include <platform_pd.h> #include <platform_pd.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/thread.h>
#include <l4/sigma0.h>
#include <l4/schedule.h>
#include <l4/space.h>
#include <l4/types.h>
}
using namespace Pistachio; using namespace Pistachio;
using namespace Genode; using namespace Genode;
@ -214,7 +208,6 @@ void Platform_pd::unbind_thread(Platform_thread &thread)
thread.unbind(); thread.unbind();
_free_thread(thread_id); _free_thread(thread_id);
} }
@ -348,7 +341,8 @@ Platform_pd::Platform_pd(Allocator &, char const *, signed pd_id, bool create)
Platform_pd::~Platform_pd() Platform_pd::~Platform_pd()
{ {
/* unbind all threads */ /* unbind all threads */
while (Platform_thread *t = _next_thread()) unbind_thread(*t); while (Platform_thread *t = _next_thread())
unbind_thread(*t);
_destroy_pd(); _destroy_pd();
_free_pd(); _free_pd();

View File

@ -17,6 +17,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* core includes */ /* core includes */
#include <platform_pd.h> #include <platform_pd.h>
@ -24,21 +25,9 @@
#include <kip.h> #include <kip.h>
#include <print_l4_thread_id.h> #include <print_l4_thread_id.h>
/* Pistachio includes */
namespace Pistachio
{
#include <l4/types.h>
#include <l4/thread.h>
#include <l4/schedule.h>
#include <l4/sigma0.h>
};
using namespace Genode; using namespace Genode;
using namespace Pistachio; using namespace Pistachio;
static const bool verbose = false;
static const bool verbose2 = true;
void Platform_thread::affinity(Affinity::Location location) void Platform_thread::affinity(Affinity::Location location)
{ {

View File

@ -18,9 +18,13 @@
using namespace Genode; using namespace Genode;
void Ram_dataspace_factory::_export_ram_ds(Dataspace_component &) { } void Ram_dataspace_factory::_export_ram_ds(Dataspace_component &) { }
void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component &) { } void Ram_dataspace_factory::_revoke_ram_ds(Dataspace_component &) { }
void Ram_dataspace_factory::_clear_ds(Dataspace_component &ds) void Ram_dataspace_factory::_clear_ds(Dataspace_component &ds)
{ {
memset((void *)ds.phys_addr(), 0, ds.size()); memset((void *)ds.phys_addr(), 0, ds.size());

View File

@ -11,19 +11,17 @@
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
*/ */
/* base-internal includes */
#include <base/internal/pistachio.h>
/* core-local includes */ /* core-local includes */
#include <kip.h> #include <kip.h>
#include <platform.h>
#include "platform.h" #include <util.h>
#include "util.h"
namespace Pistachio {
#include <l4/sigma0.h>
#include <l4/arch.h>
}
using namespace Genode; using namespace Genode;
void Platform::_setup_io_port_alloc() void Platform::_setup_io_port_alloc()
{ {
/* setup allocator */ /* setup allocator */

View File

@ -20,11 +20,8 @@
/* Genode includes */ /* Genode includes */
#include <base/thread.h> #include <base/thread.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/schedule.h>
#include <l4/ipc.h>
}
extern Pistachio::L4_ThreadId_t main_thread_tid; extern Pistachio::L4_ThreadId_t main_thread_tid;

View File

@ -17,10 +17,8 @@
/* Genode includes */ /* Genode includes */
#include <base/stdint.h> #include <base/stdint.h>
/* Pistachio includes */ /* base-internal includes */
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/types.h>
}
namespace Genode { namespace Genode {

View File

@ -0,0 +1,32 @@
/*
* \brief L4ka::Pistachio system-call bindings
* \author Norman Feske
* \date 2021-02-07
*/
/*
* Copyright (C) 2021 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 _BASE__INTERNAL__PISTACHIO_H_
#define _BASE__INTERNAL__PISTACHIO_H_
namespace Pistachio {
#include <l4/types.h>
#include <l4/thread.h>
#include <l4/message.h>
#include <l4/ipc.h>
#include <l4/schedule.h>
#include <l4/kdebug.h>
#include <l4/kip.h>
#include <l4/space.h>
#include <l4/sigma0.h>
#include <l4/arch.h>
#include <l4/bootinfo.h>
#include <l4/misc.h>
}
#endif /* _BASE__INTERNAL__PISTACHIO_H_ */

View File

@ -14,9 +14,7 @@
#ifndef _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_ #ifndef _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_
#define _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_ #define _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_
namespace Pistachio { #include <base/internal/pistachio.h>
#include <l4/kdebug.h>
}
namespace Genode { namespace Genode {

View File

@ -14,10 +14,7 @@
#ifndef _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_ #ifndef _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_
#define _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_ #define _INCLUDE__BASE__INTERNAL__RPC_DESTINATION_H_
/* Pistachio includes */ #include <base/internal/pistachio.h>
namespace Pistachio {
#include <l4/types.h>
}
namespace Genode { namespace Genode {

View File

@ -21,12 +21,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/ipc_server.h> #include <base/internal/ipc_server.h>
#include <base/internal/capability_space_tpl.h> #include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/types.h>
#include <l4/ipc.h>
}
using namespace Genode; using namespace Genode;
using namespace Pistachio; using namespace Pistachio;

View File

@ -18,11 +18,7 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/native_thread.h> #include <base/internal/native_thread.h>
#include <base/internal/globals.h> #include <base/internal/globals.h>
#include <base/internal/pistachio.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/thread.h>
}
Pistachio::L4_ThreadId_t main_thread_tid; Pistachio::L4_ThreadId_t main_thread_tid;
@ -51,7 +47,10 @@ void Genode::Thread::_thread_bootstrap()
void Genode::Thread::_init_platform_thread(size_t, Type type) void Genode::Thread::_init_platform_thread(size_t, Type type)
{ {
if (type == NORMAL) { return; } if (type == NORMAL)
return;
native_thread().l4id = main_thread_tid; native_thread().l4id = main_thread_tid;
_thread_cap = main_thread_cap(); _thread_cap = main_thread_cap();
} }