Mercurial > lcfOS
comparison 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 |
comparison
equal
deleted
inserted
replaced
401:994c00d55fd5 | 402:0fb6633c42f6 |
---|---|
1 module syscall; | |
2 | |
3 /* | |
4 This module handles all the system calls from user space. | |
5 */ | |
6 | |
7 import arch; | |
8 import scheduler; | |
9 import process; | |
10 | |
11 | |
12 /* System call numbers: | |
13 */ | |
14 const int SendMsg = 1; | |
15 const int ReceiveMsg = 2; | |
16 const int Reboot = 3; | |
17 | |
18 | |
19 // System call handlers. System calls are made from user space. | |
20 function void handle_system_call(int callId, int a, int b) | |
21 { | |
22 // Main entry, check what to do here | |
23 if (callId == SendMsg) | |
24 { | |
25 handle_send_msg(); | |
26 var process.process_t* proc; | |
27 proc = process.byId(a); | |
28 // proc.setMessage(); | |
29 // scheduler.current.setState(Sleep); | |
30 } | |
31 else | |
32 { | |
33 if (callId == 2) | |
34 { | |
35 handle_recv_msg(); | |
36 } | |
37 else | |
38 { | |
39 if (callId == 3) | |
40 { | |
41 //arch.reboot(); | |
42 } | |
43 else | |
44 { | |
45 return 2; | |
46 } | |
47 } | |
48 } | |
49 | |
50 return 0; | |
51 } | |
52 | |
53 // Handle send message syscall | |
54 function void handle_send_msg() | |
55 { | |
56 } | |
57 | |
58 function void handle_recv_msg() | |
59 { | |
60 // Block until we have a message | |
61 //currentProc->setState(Sleep); | |
62 //scheduler.executeNext(); | |
63 } | |
64 |