Mercurial > lcfOS
view kernel/syscall.c3 @ 296:9417caea2eb3
Directorized some backend files
author | Windel Bouwman |
---|---|
date | Sun, 01 Dec 2013 13:36:58 +0100 |
parents | 534b94b40aa8 |
children | 158068af716c |
line wrap: on
line source
module syscall; /* This module handles all the system calls from user space. */ enum { SendMsg = 1, ReceiveMsg = 2, } syscall_t; // System call handlers. System calls are made from user space. func void handle_system_call(int callId, int a, int b, int c, int d) { // Main entry, check what to do here switch(callId) { case SendMsg: handle_send_msg(); proc = process.byId(a); if (not proc) { panic(); } proc.setMessage(); scheduler.current.setState(Sleep); break; case ReceiveMsg: break; case Reboot: arch.reboot(); break; default: return NO_SUCH_CALL; } return OK; } // Handle send message syscall func void handle_send_msg() { p = process.byId(msg.to_id); scheduler.attempt(p); } func handle_recv_msg() { // Block until we have a message currentProc->setState(Sleep); scheduler.executeNext(); } func handle_reboot() { reboot(); }