FreeNOS
kernel
API.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015 Niek Linnenbank
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __KERNEL_API_H
19
#define __KERNEL_API_H
20
21
#include <
Log.h
>
22
#include <
Types.h
>
23
#include <
Vector.h
>
24
39
class
API
40
{
41
public
:
42
49
typedef
enum
Number
50
{
51
PrivExecNumber
= 1,
52
ProcessCtlNumber
,
53
SystemInfoNumber
,
54
VMCopyNumber
,
55
VMCtlNumber
,
56
VMShareNumber
57
}
58
Number
;
59
68
enum
Result
69
{
70
Success
= 0,
71
AccessViolation
,
72
RangeError
,
73
NotFound
,
74
InvalidArgument
,
75
OutOfMemory
,
76
IOError
,
77
AlreadyExists
,
78
TemporaryUnavailable
,
79
MaxValue
=
UINT_MAX
80
};
81
86
typedef
Result
Handler
(
ulong
,
ulong
,
ulong
,
ulong
,
ulong
);
87
91
typedef
enum
Operation
92
{
93
Create
= 0,
94
Delete
= 1,
95
Send
= 2,
96
Receive
= 3,
97
SendReceive
= 4,
98
Read
= 5,
99
Write
= 6,
100
ReadPhys
= 7
101
}
102
Operation
;
103
104
public
:
105
109
API
();
110
114
Result
invoke
(
Number
number,
115
ulong
arg1,
116
ulong
arg2,
117
ulong
arg3,
118
ulong
arg4,
119
ulong
arg5);
120
121
private
:
122
124
Vector<Handler *>
m_apis
;
125
};
126
132
Log
&
operator <<
(
Log
&log,
API::Operation
op);
133
134
/*
135
* Include generic kernel API functions.
136
*/
137
138
#include "
API/PrivExec.h
"
139
#include "
API/ProcessCtl.h
"
140
#include "
API/SystemInfo.h
"
141
#include "
API/VMCopy.h
"
142
#include "
API/VMCtl.h
"
143
#include "
API/VMShare.h
"
144
#include "
API/ProcessID.h
"
145
146
#endif
/* __KERNEL_API_H */
API::Handler
Result Handler(ulong, ulong, ulong, ulong, ulong)
Function which handles an kernel API (system call) request.
Definition:
API.h:86
PrivExec.h
API::Result
Result
Enumeration of generic kernel API result codes.
Definition:
API.h:68
API::Receive
@ Receive
Definition:
API.h:96
Vector.h
API::invoke
Result invoke(Number number, ulong arg1, ulong arg2, ulong arg3, ulong arg4, ulong arg5)
Execute a generic API function.
Definition:
API.cpp:35
ulong
unsigned long ulong
Unsigned long number.
Definition:
Types.h:47
Types.h
API::Operation
Operation
Various actions which may be performed inside an APIHandler.
Definition:
API.h:91
API::InvalidArgument
@ InvalidArgument
Definition:
API.h:74
API::m_apis
Vector< Handler * > m_apis
API handlers.
Definition:
API.h:124
API::Write
@ Write
Definition:
API.h:99
ProcessID.h
API::AccessViolation
@ AccessViolation
Definition:
API.h:71
API::Number
Number
Enumeration of supported generic kernel API functions.
Definition:
API.h:49
API::VMCtlNumber
@ VMCtlNumber
Definition:
API.h:55
API
Generic Kernel API implementation.
Definition:
API.h:39
API::API
API()
Constructor.
Definition:
API.cpp:21
API::RangeError
@ RangeError
Definition:
API.h:72
Log.h
Log
Logging class.
Definition:
Log.h:96
API::Read
@ Read
Definition:
API.h:98
API::IOError
@ IOError
Definition:
API.h:76
API::PrivExecNumber
@ PrivExecNumber
Definition:
API.h:51
operator<<
Log & operator<<(Log &log, API::Operation op)
Operator to print a Operation to a Log.
Definition:
API.cpp:50
API::Send
@ Send
Definition:
API.h:95
API::OutOfMemory
@ OutOfMemory
Definition:
API.h:75
VMShare.h
API::ProcessCtlNumber
@ ProcessCtlNumber
Definition:
API.h:52
API::VMShareNumber
@ VMShareNumber
Definition:
API.h:56
API::AlreadyExists
@ AlreadyExists
Definition:
API.h:77
API::NotFound
@ NotFound
Definition:
API.h:73
API::Delete
@ Delete
Definition:
API.h:94
API::TemporaryUnavailable
@ TemporaryUnavailable
Definition:
API.h:78
API::Success
@ Success
Definition:
API.h:70
API::MaxValue
@ MaxValue
Definition:
API.h:79
API::SystemInfoNumber
@ SystemInfoNumber
Definition:
API.h:53
ProcessCtl.h
UINT_MAX
#define UINT_MAX
Definition:
Macros.h:78
VMCtl.h
Vector< Handler * >
API::Create
@ Create
Definition:
API.h:93
API::ReadPhys
@ ReadPhys
Definition:
API.h:100
API::SendReceive
@ SendReceive
Definition:
API.h:97
API::VMCopyNumber
@ VMCopyNumber
Definition:
API.h:54
VMCopy.h
Number
Definition:
Types.h:163
SystemInfo.h
Generated by
1.8.17