Mercurial > lcfOS
comparison kernel/src/syscall.c3 @ 359:b4ac28efcdf4
Reorganize files
author | Windel Bouwman |
---|---|
date | Fri, 14 Mar 2014 15:41:55 +0100 |
parents | kernel/syscall.c3@2e7f55319858 |
children | 6ae782a085e0 |
comparison
equal
deleted
inserted
replaced
358:5ef1cb1bb54f | 359:b4ac28efcdf4 |
---|---|
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 const int SendMsg = 1; | |
13 const int ReceiveMsg = 2; | |
14 const int Reboot = 3; | |
15 | |
16 | |
17 // System call handlers. System calls are made from user space. | |
18 function void handle_system_call(int callId, int a, int b) | |
19 { | |
20 // Main entry, check what to do here | |
21 if (callId == 1) | |
22 { | |
23 handle_send_msg(); | |
24 var process.process_t* proc; | |
25 proc = process.byId(a); | |
26 // proc.setMessage(); | |
27 // scheduler.current.setState(Sleep); | |
28 } | |
29 else | |
30 { | |
31 if (callId == 2) | |
32 { | |
33 handle_recv_msg(); | |
34 } | |
35 else | |
36 { | |
37 if (callId == 3) | |
38 { | |
39 //arch.reboot(); | |
40 } | |
41 else | |
42 { | |
43 return 2; | |
44 } | |
45 } | |
46 } | |
47 | |
48 return 0; | |
49 } | |
50 | |
51 // Handle send message syscall | |
52 function void handle_send_msg() | |
53 { | |
54 } | |
55 | |
56 function void handle_recv_msg() | |
57 { | |
58 // Block until we have a message | |
59 //currentProc->setState(Sleep); | |
60 //scheduler.executeNext(); | |
61 } | |
62 |