1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
/****************************************************************************
* syscall/syscall_stublookup.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <syscall.h>
/* This will need to be extended if there are reserved syscall numbers */
#if CONFIG_CONFIG_SYS_RESERVED == 0
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
/****************************************************************************
* Stub Function Prototypes
****************************************************************************/
/* These first system calls are supported regardless of the NuttX
* configuration
*/
extern uintptr_t STUB__exit(uintptr_t parm1);
extern uintptr_t STUB_exit(uintptr_t parm1);
extern uintptr_t STUB_get_errno(void);
extern uintptr_t STUB_getpid(void);
extern uintptr_t STUB_sched_getparam(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_sched_getscheduler(uintptr_t parm1);
extern uintptr_t STUB_sched_lock(void);
extern uintptr_t STUB_sched_lockcount(void);
extern uintptr_t STUB_sched_rr_get_interval(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_sched_setparam(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_sched_setscheduler(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sched_unlock(void);
extern uintptr_t STUB_sched_yield(void);
extern uintptr_t STUB_sem_close(uintptr_t parm1);
extern uintptr_t STUB_sem_destroy(uintptr_t parm1);
extern uintptr_t STUB_sem_open(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_sem_post(uintptr_t parm1);
extern uintptr_t STUB_sem_trywait(uintptr_t parm1);
extern uintptr_t STUB_sem_unlink(uintptr_t parm1);
extern uintptr_t STUB_sem_wait(uintptr_t parm1);
extern uintptr_t STUB_set_errno(uintptr_t parm1);
extern uintptr_t STUB_task_create(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_task_delete(uintptr_t parm1);
extern uintptr_t STUB_task_restart(uintptr_t parm1);
extern uintptr_t STUB_up_assert(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_up_assert_code(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
/* The following can be individually enabled */
extern uintptr_t STUB_atexit(uintptr_t parm1);
extern uintptr_t STUB_waitpid(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
/* The following are only defined is signals are supported in the NuttX
* configuration.
*/
extern uintptr_t STUB_kill(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_sigaction(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sigpending(uintptr_t parm1);
extern uintptr_t STUB_sigprocmask(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sigqueue(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sigsuspend(uintptr_t parm1);
extern uintptr_t STUB_sigtimedwait(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sigwaitinfo(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_sleep(uintptr_t parm1);
extern uintptr_t STUB_usleep(uintptr_t parm1);
/* The following are only defined if the system clock is enabled in the
* NuttX configuration.
*/
extern uintptr_t STUB_clock_getres(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_clock_gettime(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_clock_settime(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_gettimeofday(uintptr_t parm1, uintptr_t parm2);
/* The following are defined only if POSIX timers are supported */
extern uintptr_t STUB_timer_create(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_timer_delete(uintptr_t parm1);
extern uintptr_t STUB_timer_getoverrun(uintptr_t parm1);
extern uintptr_t STUB_timer_gettime(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_timer_settime(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
/* The following are defined if either file or socket descriptor are
* enabled.
*/
extern uintptr_t STUB_close(uintptr_t parm1);
extern uintptr_t STUB_ioctl(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_poll(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_read(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_select(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_write(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
/* The following are defined if file descriptors are enabled */
extern uintptr_t STUB_closedir(uintptr_t parm1);
extern uintptr_t STUB_dup(uintptr_t parm1);
extern uintptr_t STUB_dup2(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_fcntl(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_lseek(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_mkfifo(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_mmap(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_open(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_opendir(uintptr_t parm1);
extern uintptr_t STUB_pipe(uintptr_t parm1);
extern uintptr_t STUB_readdir(uintptr_t parm1);
extern uintptr_t STUB_rewinddir(uintptr_t parm1);
extern uintptr_t STUB_seekdir(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_stat(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_statfs(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_telldir(uintptr_t parm1);
extern uintptr_t STUB_fs_fdopen(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_sched_getstreams(void);
extern uintptr_t STUB_fsync(uintptr_t parm1);
extern uintptr_t STUB_mkdir(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_mount(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_rename(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_rmdir(uintptr_t parm1);
extern uintptr_t STUB_umount(uintptr_t parm1);
extern uintptr_t STUB_unlink(uintptr_t parm1);
/* The following are defined if pthreads are enabled */
extern uintptr_t STUB_pthread_barrier_destroy(uintptr_t parm1);
extern uintptr_t STUB_pthread_barrier_init(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_pthread_barrier_wait(uintptr_t parm1);
extern uintptr_t STUB_pthread_cancel(uintptr_t parm1);
extern uintptr_t STUB_pthread_cond_broadcast(uintptr_t parm1);
extern uintptr_t STUB_pthread_cond_destroy(uintptr_t parm1);
extern uintptr_t STUB_pthread_cond_init(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_cond_signal(uintptr_t parm1);
extern uintptr_t STUB_pthread_cond_wait(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_create(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
extern uintptr_t STUB_pthread_detach(uintptr_t parm1);
extern uintptr_t STUB_pthread_exit(uintptr_t parm1);
extern uintptr_t STUB_pthread_getschedparam(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_pthread_getspecific(uintptr_t parm1);
extern uintptr_t STUB_pthread_join(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_key_create(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_key_delete(uintptr_t parm1);
extern uintptr_t STUB_pthread_mutex_destroy(uintptr_t parm1);
extern uintptr_t STUB_pthread_mutex_init(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_mutex_lock(uintptr_t parm1);
extern uintptr_t STUB_pthread_mutex_trylock(uintptr_t parm1);
extern uintptr_t STUB_pthread_mutex_unlock(uintptr_t parm1);
extern uintptr_t STUB_pthread_once(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_setcancelstate(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_setschedparam(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_pthread_setschedprio(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_setspecific(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_testcancel(void);
extern uintptr_t STUB_pthread_yield(void);
extern uintptr_t STUB_pthread_cond_timedwait(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_pthread_kill(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_pthread_sigmask(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
/* The following are defined only if message queues are enabled */
extern uintptr_t STUB_mq_close(uintptr_t parm1);
extern uintptr_t STUB_mq_notify(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_mq_open(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_mq_receive(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
extern uintptr_t STUB_mq_send(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
extern uintptr_t STUB_mq_timedreceive(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_mq_timedsend(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_mq_unlink(uintptr_t parm1);
/* The following are defined only if environment variables are supported */
extern uintptr_t STUB_clearenv(void);
extern uintptr_t STUB_getenv(uintptr_t parm1);
extern uintptr_t STUB_putenv(uintptr_t parm1);
extern uintptr_t STUB_setenv(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_unsetenv(uintptr_t parm1);
/* The following are defined only if networking AND sockets are supported */
extern uintptr_t STUB_accept(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_bind(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_connect(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
extern uintptr_t STUB_getsockopt(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_listen(uintptr_t parm1, uintptr_t parm2);
extern uintptr_t STUB_recv(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
extern uintptr_t STUB_recvfrom(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_send(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4);
extern uintptr_t STUB_sendto(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm6);
extern uintptr_t STUB_setsockopt(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
extern uintptr_t STUB_socket(uintptr_t parm1, uintptr_t parm2, uintptr_t parm3);
/****************************************************************************
* Public Data
****************************************************************************/
/* Stub lookup tables. Each table is indexed by the system call numbers
* defined above. Given the system call number, the corresponding entry in
* these tables describes how to call the stub dispatch function.
*/
const union syscall_stubfunc_u *g_stublookup[SYS_nsyscalls] =
{
# undef STUB_LOOKUP1
# define STUB_LOOKUP1(n,p) (union syscall_stubfunc_u *)p
# undef STUB_LOOKUP
# define STUB_LOOKUP(n,p) , (union syscall_stubfunc_u *)p
# include "stub_lookup.h"
};
const uint8_t g_stubnparms[SYS_nsyscalls] =
{
# undef STUB_LOOKUP1
# define STUB_LOOKUP1(n,p) n
# undef STUB_LOOKUP
# define STUB_LOOKUP(n,p) , n
# include "stub_lookup.h"
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* CONFIG_CONFIG_SYS_RESERVED */
|