Kernel: Remove kernel processes
Kernel can just use raw threads, pretty muchs the only thing that process provides is syscalls which kernel threads of course don't need. Also this makes init process have pid 1 :D
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <BAN/HashMap.h>
|
||||
#include <BAN/UniqPtr.h>
|
||||
#include <kernel/Networking/NetworkInterface.h>
|
||||
#include <kernel/Process.h>
|
||||
#include <kernel/Thread.h>
|
||||
#include <kernel/ThreadBlocker.h>
|
||||
|
||||
namespace Kernel
|
||||
@@ -56,9 +56,9 @@ namespace Kernel
|
||||
|
||||
BAN::HashMap<BAN::IPv4Address, BAN::MACAddress> m_arp_table;
|
||||
|
||||
Process* m_process = nullptr;
|
||||
Thread* m_thread { nullptr };
|
||||
BAN::CircularQueue<PendingArpPacket, 128> m_pending_packets;
|
||||
ThreadBlocker m_pending_thread_blocker;
|
||||
ThreadBlocker m_pending_thread_blocker;
|
||||
|
||||
friend class BAN::UniqPtr<ARPTable>;
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <kernel/Networking/NetworkInterface.h>
|
||||
#include <kernel/Networking/NetworkLayer.h>
|
||||
#include <kernel/Networking/NetworkSocket.h>
|
||||
#include <kernel/Process.h>
|
||||
#include <kernel/Thread.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace Kernel
|
||||
RecursiveSpinLock m_bound_socket_lock;
|
||||
|
||||
BAN::UniqPtr<ARPTable> m_arp_table;
|
||||
Process* m_process { nullptr };
|
||||
Thread* m_thread { nullptr };
|
||||
|
||||
static constexpr size_t pending_packet_buffer_size = 128 * PAGE_SIZE;
|
||||
BAN::UniqPtr<VirtualRange> m_pending_packet_buffer;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <kernel/Memory/VirtualRange.h>
|
||||
#include <kernel/Networking/NetworkInterface.h>
|
||||
#include <kernel/Networking/NetworkSocket.h>
|
||||
#include <kernel/Process.h>
|
||||
#include <kernel/Thread.h>
|
||||
#include <kernel/ThreadBlocker.h>
|
||||
|
||||
namespace Kernel
|
||||
@@ -162,7 +162,7 @@ namespace Kernel
|
||||
State m_next_state { State::Closed };
|
||||
uint8_t m_next_flags { 0 };
|
||||
|
||||
Process* m_process { nullptr };
|
||||
Thread* m_thread { nullptr };
|
||||
|
||||
uint64_t m_time_wait_start_ms { 0 };
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@ namespace Kernel
|
||||
using entry_t = Thread::entry_t;
|
||||
|
||||
public:
|
||||
static Process* create_kernel();
|
||||
static Process* create_kernel(entry_t, void*);
|
||||
static BAN::ErrorOr<Process*> create_userspace(const Credentials&, BAN::StringView path, BAN::Span<BAN::StringView> arguments);
|
||||
~Process();
|
||||
void cleanup_function(Thread*);
|
||||
@@ -217,8 +215,6 @@ namespace Kernel
|
||||
size_t proc_cmdline(off_t offset, BAN::ByteSpan) const;
|
||||
size_t proc_environ(off_t offset, BAN::ByteSpan) const;
|
||||
|
||||
bool is_userspace() const { return m_is_userspace; }
|
||||
|
||||
// Returns error if page could not be allocated
|
||||
// Returns true if the page was allocated successfully
|
||||
// Return false if access was page violation (segfault)
|
||||
@@ -331,8 +327,6 @@ namespace Kernel
|
||||
BAN::Vector<BAN::String> m_cmdline;
|
||||
BAN::Vector<BAN::String> m_environ;
|
||||
|
||||
bool m_is_userspace { false };
|
||||
|
||||
BAN::Vector<ChildExitStatus> m_child_exit_statuses;
|
||||
ThreadBlocker m_child_exit_blocker;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Kernel
|
||||
static constexpr size_t userspace_stack_size { PAGE_SIZE * 128 };
|
||||
|
||||
public:
|
||||
static BAN::ErrorOr<Thread*> create_kernel(entry_t, void*, Process*);
|
||||
static BAN::ErrorOr<Thread*> create_kernel(entry_t, void*);
|
||||
static BAN::ErrorOr<Thread*> create_userspace(Process*, PageTable&);
|
||||
~Thread();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Kernel
|
||||
|
||||
BAN::Atomic<uint32_t> m_changed_ports { 0 };
|
||||
ThreadBlocker m_changed_port_blocker;
|
||||
BAN::Atomic<Process*> m_port_updater { nullptr };
|
||||
BAN::Atomic<Thread*> m_port_updater { nullptr };
|
||||
|
||||
struct PortInfo
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Kernel
|
||||
|
||||
Mutex m_mutex;
|
||||
|
||||
BAN::Atomic<Process*> m_port_updater { nullptr };
|
||||
BAN::Atomic<Thread*> m_port_updater { nullptr };
|
||||
ThreadBlocker m_port_thread_blocker;
|
||||
BAN::Atomic<bool> m_port_changed { false };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user