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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,18 +22,12 @@
/* base-internal includes */
#include <base/internal/page_size.h>
#include <base/internal/pistachio.h>
/* core-local includes */
#include <kip.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 {
inline void log_event(const char *) { }

View File

@ -18,12 +18,8 @@
#include <io_mem_session_component.h>
#include <kip.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/ipc.h>
#include <l4/sigma0.h>
#include <l4/misc.h>
}
/* base-internal includes */
#include <base/internal/pistachio.h>
using namespace Genode;
@ -32,7 +28,7 @@ using namespace Genode;
* TODO This should take a size parameter and check if the whole
* region is "normal" memory.
*/
bool is_conventional_memory(addr_t base)
static bool is_conventional_memory(addr_t base)
{
using namespace Pistachio;
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) { }
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
&& (size >= get_super_page_size()); }
&& (size >= get_super_page_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 <util.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/ipc.h>
}
/* base-internal includes */
using namespace Genode;
using namespace Pistachio;

View File

@ -18,19 +18,12 @@
/* base-internal includes */
#include <base/internal/native_thread.h>
#include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* core includes */
#include <ipc_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 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 */
#include <base/internal/capability_space_tpl.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/types.h>
#include <l4/ipc.h>
}
#include <base/internal/pistachio.h>
using namespace Genode;

View File

@ -23,6 +23,7 @@
#include <base/internal/stack_area.h>
#include <base/internal/capability_space_tpl.h>
#include <base/internal/globals.h>
#include <base/internal/pistachio.h>
/* core includes */
#include <boot_modules.h>
@ -35,15 +36,6 @@
#include <kip.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;
@ -61,6 +53,7 @@ static Synced_range_allocator<Allocator_avl> &_core_address_ranges()
return _core_address_ranges;
}
enum { PAGER_STACK_ELEMENTS = 512 };
static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS];

View File

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

View File

@ -17,6 +17,7 @@
/* base-internal includes */
#include <base/internal/capability_space_tpl.h>
#include <base/internal/pistachio.h>
/* core includes */
#include <platform_pd.h>
@ -24,21 +25,9 @@
#include <kip.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 Pistachio;
static const bool verbose = false;
static const bool verbose2 = true;
void Platform_thread::affinity(Affinity::Location location)
{

View File

@ -18,9 +18,13 @@
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());

View File

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

View File

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

View File

@ -17,10 +17,8 @@
/* Genode includes */
#include <base/stdint.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/types.h>
}
/* base-internal includes */
#include <base/internal/pistachio.h>
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_
#define _INCLUDE__BASE__INTERNAL__RAW_WRITE_STRING_H_
namespace Pistachio {
#include <l4/kdebug.h>
}
#include <base/internal/pistachio.h>
namespace Genode {

View File

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

View File

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

View File

@ -18,11 +18,7 @@
/* base-internal includes */
#include <base/internal/native_thread.h>
#include <base/internal/globals.h>
/* Pistachio includes */
namespace Pistachio {
#include <l4/thread.h>
}
#include <base/internal/pistachio.h>
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)
{
if (type == NORMAL) { return; }
if (type == NORMAL)
return;
native_thread().l4id = main_thread_tid;
_thread_cap = main_thread_cap();
}