Files
opencoreC/servers/init/main.cpp
T

33 lines
957 B
C++

#include "ipc.hpp"
#include "stdio.h"
#include "string.h"
extern "C" void _start() {
puts("[INIT-SERVER] Userspace Root Init Server Started (Ring 3)!");
// 1. Instantiate RAII IPC Endpoint for Kernel Control
ipc::Endpoint kernel_ctrl(CAP_SELF_TASK);
puts("[INIT-SERVER] Sending Fast-Path IPC Ping to Microkernel...");
auto ping_res = kernel_ctrl.call(IPC_OP_PING, 100);
if (ping_res.is_ok()) {
puts("[INIT-SERVER] Received IPC Ping Response from Microkernel!");
} else {
puts("[INIT-SERVER] IPC Call Failed!");
}
// 2. Register Server Endpoint
puts("[INIT-SERVER] Registering Root Server Capability...");
auto reg_res = kernel_ctrl.call(IPC_OP_REGISTER_SERVER, 0x1337BEEF);
if (reg_res.is_ok()) {
puts("[INIT-SERVER] Server Registered Successfully!");
}
puts("[INIT-SERVER] Root Init Server ready. Entering event loop.");
while (true) {
sys_yield();
}
}