mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 00:44:31 -08:00
[util] Replace kutil with util
Now that kutil has no kernel-specific code in it anymore, it can actually be linked to by anything, so I'm renaming it 'util'. Also, I've tried to unify the way that the system libraries from src/libraries are #included using <> instead of "". Other small change: util::bip_buffer got a spinlock to guard against state corruption.
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
/// \file channel.h
|
||||
/// Definition of channel objects and related functions
|
||||
|
||||
#include "j6/signals.h"
|
||||
#include "kutil/bip_buffer.h"
|
||||
#include <j6/signals.h>
|
||||
#include <util/bip_buffer.h>
|
||||
|
||||
#include "objects/kobject.h"
|
||||
|
||||
/// Channels are bi-directional means of sending messages
|
||||
@@ -45,5 +46,5 @@ protected:
|
||||
private:
|
||||
size_t m_len;
|
||||
uintptr_t m_data;
|
||||
kutil::bip_buffer m_buffer;
|
||||
util::bip_buffer m_buffer;
|
||||
};
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
/// \file endpoint.h
|
||||
/// Definition of endpoint kobject types
|
||||
|
||||
#include "j6/signals.h"
|
||||
#include <j6/signals.h>
|
||||
#include <util/vector.h>
|
||||
|
||||
#include "objects/kobject.h"
|
||||
|
||||
/// Endpoints are objects that enable synchronous message-passing IPC
|
||||
@@ -64,5 +66,5 @@ private:
|
||||
|
||||
j6_status_t do_message_copy(const thread_data &sender, thread_data &receiver);
|
||||
|
||||
kutil::vector<thread_data> m_blocked;
|
||||
util::vector<thread_data> m_blocked;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "j6/errors.h"
|
||||
#include "j6/signals.h"
|
||||
#include "j6/types.h"
|
||||
#include <j6/errors.h>
|
||||
#include <j6/signals.h>
|
||||
#include <j6/types.h>
|
||||
|
||||
#include "assert.h"
|
||||
#include "objects/kobject.h"
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
/// \file kobject.h
|
||||
/// Definition of base type for user-interactable kernel objects
|
||||
|
||||
#include "j6/errors.h"
|
||||
#include "j6/signals.h"
|
||||
#include "j6/types.h"
|
||||
#include "kutil/vector.h"
|
||||
#include <j6/errors.h>
|
||||
#include <j6/signals.h>
|
||||
#include <j6/types.h>
|
||||
#include <util/vector.h>
|
||||
|
||||
class thread;
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
enum class type : uint16_t
|
||||
{
|
||||
#define OBJECT_TYPE( name, val ) name = val,
|
||||
#include "j6/tables/object_types.inc"
|
||||
#include <j6/tables/object_types.inc>
|
||||
#undef OBJECT_TYPE
|
||||
|
||||
max
|
||||
@@ -96,5 +96,5 @@ private:
|
||||
uint16_t m_handle_count;
|
||||
|
||||
protected:
|
||||
kutil::vector<thread*> m_blocked_threads;
|
||||
util::vector<thread*> m_blocked_threads;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "kutil/no_construct.h"
|
||||
#include <util/no_construct.h>
|
||||
|
||||
#include "assert.h"
|
||||
#include "cpu.h"
|
||||
@@ -10,7 +10,7 @@
|
||||
// This object is initialized _before_ global constructors are called,
|
||||
// so we don't want it to have a global constructor at all, lest it
|
||||
// overwrite the previous initialization.
|
||||
static kutil::no_construct<process> __g_kernel_process_storage;
|
||||
static util::no_construct<process> __g_kernel_process_storage;
|
||||
process &g_kernel_process = __g_kernel_process_storage.value;
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
/// \file process.h
|
||||
/// Definition of process kobject types
|
||||
|
||||
#include "kutil/map.h"
|
||||
#include "kutil/vector.h"
|
||||
#include <util/map.h>
|
||||
#include <util/vector.h>
|
||||
|
||||
#include "objects/kobject.h"
|
||||
#include "page_table.h"
|
||||
#include "vm_space.h"
|
||||
@@ -88,8 +89,8 @@ private:
|
||||
|
||||
vm_space m_space;
|
||||
|
||||
kutil::vector<thread*> m_threads;
|
||||
kutil::map<j6_handle_t, kobject*> m_handles;
|
||||
util::vector<thread*> m_threads;
|
||||
util::map<j6_handle_t, kobject*> m_handles;
|
||||
j6_handle_t m_next_handle;
|
||||
|
||||
enum class state : uint8_t { running, exited };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "j6/signals.h"
|
||||
#include <j6/signals.h>
|
||||
|
||||
#include "cpu.h"
|
||||
#include "log.h"
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/// \file thread.h
|
||||
/// Definition of thread kobject types
|
||||
|
||||
#include "kutil/linked_list.h"
|
||||
#include <util/linked_list.h>
|
||||
|
||||
#include "objects/kobject.h"
|
||||
|
||||
struct page_table;
|
||||
@@ -29,7 +30,7 @@ struct TCB
|
||||
uint64_t last_ran;
|
||||
};
|
||||
|
||||
using tcb_list = kutil::linked_list<TCB>;
|
||||
using tcb_list = util::linked_list<TCB>;
|
||||
using tcb_node = tcb_list::item_type;
|
||||
|
||||
class thread :
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "enum_bitfields.h"
|
||||
#include "j6/signals.h"
|
||||
#include "kutil/vector.h"
|
||||
#include <j6/signals.h>
|
||||
#include <util/vector.h>
|
||||
#include <enum_bitfields.h>
|
||||
|
||||
#include "kernel_memory.h"
|
||||
#include "objects/kobject.h"
|
||||
@@ -18,7 +18,7 @@ class vm_space;
|
||||
enum class vm_flags : uint32_t
|
||||
{
|
||||
#define VM_FLAG(name, v) name = v,
|
||||
#include "j6/tables/vm_flags.inc"
|
||||
#include <j6/tables/vm_flags.inc>
|
||||
#undef VM_FLAG
|
||||
driver_mask = 0x000fffff, ///< flags allowed via syscall for drivers
|
||||
user_mask = 0x0000ffff, ///< flags allowed via syscall for non-drivers
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
|
||||
size_t m_size;
|
||||
vm_flags m_flags;
|
||||
kutil::vector<vm_space*> m_spaces;
|
||||
util::vector<vm_space*> m_spaces;
|
||||
|
||||
// Initial static space for m_spaces - most areas will never grow
|
||||
// beyond this size, so avoid allocations
|
||||
@@ -165,7 +165,7 @@ public:
|
||||
virtual bool get_page(uintptr_t offset, uintptr_t &phys) override;
|
||||
|
||||
private:
|
||||
kutil::vector<uintptr_t> m_cache;
|
||||
util::vector<uintptr_t> m_cache;
|
||||
uintptr_t m_start;
|
||||
size_t m_pages;
|
||||
uintptr_t m_next;
|
||||
|
||||
Reference in New Issue
Block a user