feat(microkernel): implement pure microkernel architecture with vfs_server, net_server, and procmgr

- Added vfs_server in Ring 3 (Endpoint 5) managing unified VFS tree (/, /bin, /etc, /proc, /dev, /tmp)
- Added net_server in Ring 3 (Endpoint 6) owning RTL8139 hardware NIC, DHCP, DNS, and TCP/IPv4 stack
- Refactored procmgr in Ring 3 (Endpoint 4) to handle userspace process spawning via PROC_OP_SPAWN
- Added primitive microkernel syscalls in Ring 0: SYS_TASK_CREATE (29), SYS_TASK_MAP_PAGE (30), SYS_TASK_START (31)
- Updated shell (sh) and desktop GUI (gui_server) to delegate process management and I/O to Ring 3 daemons
- Expanded boot pipeline to orchestrate 7 concurrent Ring 3 servers across dedicated SMP CPU cores
This commit is contained in:
RarDog
2026-09-03 11:03:35 +03:00
parent c18717539c
commit 5a4206acb6
15 changed files with 604 additions and 34 deletions
+6
View File
@@ -16,6 +16,12 @@ extern "C" {
#define ICMP_ECHO_REPLY 0
#define ICMP_ECHO_REQUEST 8
/* NET_ENDPOINT (6) IPC Opcodes */
#define NET_OP_GET_CONFIG 1
#define NET_OP_PING 2
#define NET_OP_DNS 3
#define NET_OP_DHCP 4
#pragma pack(push, 1)
typedef struct {
+42
View File
@@ -31,6 +31,21 @@
#define SYS_NOTIFY_RECV 26 /* Poll pending desktop notifications non-blockingly */
#define SYS_MODULE_EXEC 27 /* Find and execute boot module by name (.opc or .elf) */
#define SYS_MODULE_LIST 28 /* List available boot modules in memory */
#define SYS_TASK_CREATE 29 /* Allocate new user PML4 & thread structure: (name, name_len) -> tid */
#define SYS_TASK_MAP_PAGE 30 /* Map page into target task: (target_tid, vaddr, src_buf, flags) -> status */
#define SYS_TASK_START 31 /* Activate thread: (target_tid, entry_rip, user_rsp) -> status */
/* Standard Ring 3 Service Endpoints */
#define UART_SERVICE_ENDPOINT 2
#define PROCMGR_ENDPOINT 4
#define VFS_ENDPOINT 5
#define NET_ENDPOINT 6
/* PROCMGR_ENDPOINT (4) IPC Opcodes */
#define PROC_OP_LIST 1
#define PROC_OP_KILL 2
#define PROC_OP_SPAWN 3
#define PROC_OP_STAT 4
/* POSIX Process Signals */
#define SIGHUP 1
@@ -249,6 +264,33 @@ static inline int sys_module_list(char *out_buf, size_t max_len) {
return (int)rax;
}
static inline int64_t sys_task_create(const char *name, size_t name_len) {
register uint64_t rax __asm__("rax") = SYS_TASK_CREATE;
register uint64_t rdi __asm__("rdi") = (uint64_t)name;
register uint64_t rsi __asm__("rsi") = (uint64_t)name_len;
__asm__ volatile("syscall" : "+r"(rax) : "r"(rdi), "r"(rsi) : "rcx", "r11", "memory");
return (int64_t)rax;
}
static inline int64_t sys_task_map_page(uint64_t target_tid, uint64_t vaddr, const void *src_buf, uint64_t flags) {
register uint64_t rax __asm__("rax") = SYS_TASK_MAP_PAGE;
register uint64_t rdi __asm__("rdi") = target_tid;
register uint64_t rsi __asm__("rsi") = vaddr;
register uint64_t rdx __asm__("rdx") = (uint64_t)src_buf;
register uint64_t r8 __asm__("r8") = flags;
__asm__ volatile("syscall" : "+r"(rax) : "r"(rdi), "r"(rsi), "r"(rdx), "r"(r8) : "rcx", "r11", "memory");
return (int64_t)rax;
}
static inline int64_t sys_task_start(uint64_t target_tid, uint64_t entry_rip, uint64_t user_rsp) {
register uint64_t rax __asm__("rax") = SYS_TASK_START;
register uint64_t rdi __asm__("rdi") = target_tid;
register uint64_t rsi __asm__("rsi") = entry_rip;
register uint64_t rdx __asm__("rdx") = user_rsp;
__asm__ volatile("syscall" : "+r"(rax) : "r"(rdi), "r"(rsi), "r"(rdx) : "rcx", "r11", "memory");
return (int64_t)rax;
}
#ifdef __cplusplus
}
#endif
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include "types.h"
#include "syscalls.h"
#ifdef __cplusplus
extern "C" {
#endif
#define VFS_OP_STAT 1
#define VFS_OP_READ_FILE 2
#define VFS_OP_WRITE_FILE 3
#define VFS_OP_LIST 4
typedef struct vfs_file_stat {
uint32_t size;
uint32_t is_dir;
} vfs_file_stat_t;
#ifdef __cplusplus
}
#endif