UbixOS  2.0
syscalls.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2018 The UbixOS Project.
3  * All rights reserved.
4  *
5  * This was developed by Christopher W. Olsen for the UbixOS Project.
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted
8  * provided that the following conditions are met:
9  *
10  * 1) Redistributions of source code must retain the above copyright notice, this list of
11  * conditions, the following disclaimer and the list of authors.
12  * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13  * conditions, the following disclaimer and the list of authors in the documentation and/or
14  * other materials provided with the distribution.
15  * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16  * endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef _SYSCALLS_H
30 #define _SYSCALLS_H
31 
32 #include <ubixos/sched.h>
33 #include <vfs/file.h>
34 #include <ubixos/syscall.h>
35 
36 #define SYSCALLS_MAX 1024
37 
38 #define PSL_C 0x00000001 /* carry bit */
39 #define EJUSTRETURN (-2) /* don't modify regs, just return */
40 #define ERESTART (-1) /* restart syscall */
41 
42 #define ARG_COUNT(name) (sizeof(struct name) / sizeof(register_t))
43 
44 /*
45  #define SYSCALL_INVALID 0
46  #define SYSCALL_VALID 1
47  #define SYSCALL_DUMMY 2
48  #define SYSCALL_NOTIMP 3
49  #define SYSCALL_DEBUG 4
50  */
51 
53 typedef enum {
60 
61 typedef int sys_call_t(struct thread*, void*);
62 
63 struct syscall_entry {
64  int sc_args;
65  char *sc_name;
68 };
69 
70 /*
71  *
72  * Old Style Calls Need Updates
73  *
74  */
75 int sysAuth();
76 int sysPasswd();
77 int sysAddModule();
78 int sysRmModule();
79 int sysGetpid();
80 int sysExit();
81 int sysExec();
82 
83 int sysCheckPid();
84 int sysGetFreePage();
85 
86 int sysFgetc();
87 int sysFopen();
88 int sysFclose();
89 int sysFseek();
90 int sysMkDir();
91 int sysRmDir();
92 
93 //int sysSDE();
94 int sysGetDrives();
95 int sysGetCwd();
96 int sysChDir();
97 int sysGetUptime();
98 int sysGetTime();
99 int sysStartSDE();
100 int sysUnlink();
101 int sysMpiCreateMbox();
102 int sysMpiDestroyMbox();
103 int sysMpiPostMessage();
104 int sysMpiFetchMessage();
105 int sysMpiSpam();
106 
107 typedef int (*functionPTR)();
108 
109 extern int totalCalls;
110 extern struct syscall_entry systemCalls[];
111 
112 extern int totalCalls_posix;
113 extern struct syscall_entry systemCalls_posix[];
114 
115 #endif
sysUnlink
int sysUnlink()
syscall_entry::sc_entry
sys_call_t * sc_entry
Definition: syscalls.h:66
sysMpiFetchMessage
int sysMpiFetchMessage()
sysAuth
int sysAuth()
file.h
SYSCALL_VALID
Valid call.
Definition: syscalls.h:55
sysAddModule
int sysAddModule()
Definition: syscall.c:117
thread
Definition: thread.h:40
syscall_entry::sc_args
int sc_args
Definition: syscalls.h:64
sysExit
int sysExit()
sysChDir
int sysChDir()
sysGetDrives
int sysGetDrives()
sysGetpid
int sysGetpid()
SYSCALL_DUMMY
Dummy call.
Definition: syscalls.h:56
syscall.h
sched.h
sysRmModule
int sysRmModule()
Definition: syscall.c:121
SYSCALL_NOTIMP
Call not implemented.
Definition: syscalls.h:57
systemCalls
struct syscall_entry systemCalls[]
Definition: syscalls.c:34
sysMpiDestroyMbox
int sysMpiDestroyMbox()
sysMpiSpam
int sysMpiSpam()
functionPTR
int(* functionPTR)()
Definition: syscalls.h:107
syscallType_t
syscallType_t
This is all the types of systems calls.
Definition: syscalls.h:53
syscall_entry::sc_name
char * sc_name
Definition: syscalls.h:65
syscall_entry::sc_status
syscallType_t sc_status
Definition: syscalls.h:67
sysExec
int sysExec()
sysMpiPostMessage
int sysMpiPostMessage()
sysGetUptime
int sysGetUptime()
sysGetFreePage
int sysGetFreePage()
SYSCALL_DEBUG
Turn on debugging for the call.
Definition: syscalls.h:58
sysGetTime
int sysGetTime()
sysGetCwd
int sysGetCwd()
SYSCALL_INVALID
Invalid call.
Definition: syscalls.h:54
sysCheckPid
int sysCheckPid()
sysPasswd
int sysPasswd()
sysFseek
int sysFseek()
sysMpiCreateMbox
int sysMpiCreateMbox()
sysFclose
int sysFclose()
totalCalls
int totalCalls
Definition: syscalls.c:92
sysStartSDE
int sysStartSDE()
Definition: syscall.c:226
sysMkDir
int sysMkDir()
totalCalls_posix
int totalCalls_posix
Definition: syscalls_posix.c:2791
sysFopen
int sysFopen()
sysFgetc
int sysFgetc()
sysRmDir
int sysRmDir()
Definition: file.c:120
syscall_entry
Definition: syscalls.h:63
sys_call_t
int sys_call_t(struct thread *, void *)
Definition: syscalls.h:61
systemCalls_posix
struct syscall_entry systemCalls_posix[]
Definition: syscalls_posix.c:33