]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/plr/server/src/fault_handlers/syscalls_handler.h
update
[l4.git] / l4 / pkg / plr / server / src / fault_handlers / syscalls_handler.h
1 #pragma once
2
3 /*
4  * syscalls_handler.h --
5  *
6  *     Interface for system call wrappers
7  *
8  * (c) 2012-2013 Björn Döbel <doebel@os.inf.tu-dresden.de>,
9  *     economic rights: Technische Universität Dresden (Germany)
10  * This file is part of TUD:OS and distributed under the terms of the
11  * GNU General Public License 2.
12  * Please see the COPYING-GPL-2 file for details.
13  */
14
15 namespace Romain
16 {
17
18 extern InstanceManager *_the_instance_manager;
19
20 /*
21  * Generic system call wrapper class
22  */
23 class SyscallHandler
24 {
25
26         /*
27          * Store UTCB from orig to backup.
28          */
29         void store_utcb(char *orig, char *backup) { memcpy(backup, orig, L4_UTCB_OFFSET); }
30
31         public:
32                 SyscallHandler() = default;
33
34                 virtual
35                 Romain::Observer::ObserverReturnVal
36                 handle(Romain::App_instance *i,
37                        Romain::App_thread *t,
38                        Romain::Thread_group *tg,
39                        Romain::App_model *a)
40                 {
41                         enter_kdebug("calling empty syscall handler!?");
42                         return Romain::Observer::Replicatable;
43                 }
44
45                 virtual void
46                 proxy_syscall(Romain::App_instance *i,
47                               Romain::App_thread *t,
48                               Romain::Thread_group *tg,
49                               Romain::App_model *a);
50 };
51
52 #define SpecificSyscallHandler(name) \
53         class name : public SyscallHandler \
54         { \
55                 public: \
56                         name() \
57                                 : SyscallHandler() \
58                         { } \
59                         virtual \
60                         Romain::Observer::ObserverReturnVal \
61                         handle(Romain::App_instance *i, \
62                                Romain::App_thread *t, \
63                                Romain::Thread_group *tg, \
64                                Romain::App_model *a); \
65         };
66
67
68 /*
69  * System call wrapper for L4_PROTO_SCHEDULER
70  */
71 SpecificSyscallHandler(Scheduling);
72 SpecificSyscallHandler(ThreadHandler);
73 SpecificSyscallHandler(RegionManagingHandler);
74 SpecificSyscallHandler(IrqHandler);
75
76 }