Mercurial > lcfOS
view kernel/syscall.c3 @ 295:917eab04b8b7
Added disasm
author | Windel Bouwman |
---|---|
date | Thu, 28 Nov 2013 21:10:32 +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(); }