Mercurial > lcfOS
view kernel/syscall.c3 @ 292:534b94b40aa8
Fixup reorganize
author | Windel Bouwman |
---|---|
date | Wed, 27 Nov 2013 08:06:42 +0100 |
parents | c9781c73e7e2 |
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(); }