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:
+18
-14
@@ -339,10 +339,17 @@ static void cmd_run_module(const char *mod_name) {
|
||||
while (*mod_name == '.' || *mod_name == '/') {
|
||||
mod_name++;
|
||||
}
|
||||
printf("[osh] Launching native program '%s' via kernel loader...\n", mod_name);
|
||||
int64_t tid = sys_module_exec(mod_name);
|
||||
printf("[osh] Requesting Process Manager (procmgr) to spawn '%s'...\n", mod_name);
|
||||
uint64_t p0 = 0, p1 = 0;
|
||||
memcpy(&p0, mod_name, strlen(mod_name) < 8 ? strlen(mod_name) : 8);
|
||||
if (strlen(mod_name) > 8) {
|
||||
memcpy(&p1, mod_name + 8, strlen(mod_name) - 8 < 8 ? strlen(mod_name) - 8 : 8);
|
||||
}
|
||||
uint64_t out0 = 0, out1 = 0;
|
||||
sysret_t ret = sys_ipc_call_raw(PROCMGR_ENDPOINT, PROC_OP_SPAWN, p0, p1, 0, 0, &out0, &out1);
|
||||
int64_t tid = (ret == 0) ? (int64_t)out0 : -1;
|
||||
if (tid >= 0) {
|
||||
printf("[osh] Process successfully spawned with TID %ld on Ring 3!\n", (long)tid);
|
||||
printf("[procmgr] Process successfully spawned with TID %ld on Ring 3!\n", (long)tid);
|
||||
for (int i = 0; i < 6; i++) sys_yield();
|
||||
} else {
|
||||
printf("osh: failed to execute '%s' (module not found or invalid format)\n", mod_name);
|
||||
@@ -965,20 +972,17 @@ static void handle_command(char *cmd) {
|
||||
exec_target++;
|
||||
}
|
||||
|
||||
int64_t tid = sys_module_exec(exec_target);
|
||||
if (tid < 0 && !strstr(exec_target, ".")) {
|
||||
char opc_name[70];
|
||||
snprintf(opc_name, sizeof(opc_name), "%s.opc", exec_target);
|
||||
tid = sys_module_exec(opc_name);
|
||||
if (tid < 0) {
|
||||
char elf_name[70];
|
||||
snprintf(elf_name, sizeof(elf_name), "%s.elf", exec_target);
|
||||
tid = sys_module_exec(elf_name);
|
||||
}
|
||||
uint64_t p0 = 0, p1 = 0;
|
||||
memcpy(&p0, exec_target, strlen(exec_target) < 8 ? strlen(exec_target) : 8);
|
||||
if (strlen(exec_target) > 8) {
|
||||
memcpy(&p1, exec_target + 8, strlen(exec_target) - 8 < 8 ? strlen(exec_target) - 8 : 8);
|
||||
}
|
||||
uint64_t out0 = 0, out1 = 0;
|
||||
sysret_t ret = sys_ipc_call_raw(PROCMGR_ENDPOINT, PROC_OP_SPAWN, p0, p1, 0, 0, &out0, &out1);
|
||||
int64_t tid = (ret == 0) ? (int64_t)out0 : -1;
|
||||
|
||||
if (tid >= 0) {
|
||||
printf("[osh] Process spawned with TID %ld on Ring 3\n", (long)tid);
|
||||
printf("[procmgr] Process spawned with TID %ld on Ring 3\n", (long)tid);
|
||||
for (int i = 0; i < 6; i++) sys_yield();
|
||||
} else {
|
||||
printf("osh: command not found: %s\n", cmd);
|
||||
|
||||
Reference in New Issue
Block a user