view kernel/syscall.c3 @ 402:0fb6633c42f6

Moved several files to logical locations
author Windel Bouwman
date Thu, 19 Feb 2015 00:13:07 +0100
parents kernel/src/syscall.c3@6ae782a085e0
children ad6be5454067
line wrap: on
line source

module syscall;

/*
    This module handles all the system calls from user space.
*/

import arch;
import scheduler;
import process;


/* System call numbers:
*/
const int SendMsg = 1;
const int ReceiveMsg = 2;
const int Reboot = 3;


// System call handlers. System calls are made from user space.
function void handle_system_call(int callId, int a, int b)
{
    // Main entry, check what to do here
    if (callId == SendMsg)
    {
        handle_send_msg();
        var process.process_t* proc;
        proc = process.byId(a);
        // proc.setMessage();
        // scheduler.current.setState(Sleep);
    }
    else 
    {
        if (callId == 2)
        {
            handle_recv_msg();
        }
        else 
        {
            if (callId == 3)
            {
                //arch.reboot();
            }
            else
            {
                return 2;
            }
        }
    }

    return 0;
}

// Handle send message syscall
function void handle_send_msg()
{
}

function void handle_recv_msg()
{
    // Block until we have a message
    //currentProc->setState(Sleep);
    //scheduler.executeNext();
}