forked from nuttx/nuttx-update
Add stub lookup logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3462 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
80a32c2bb1
commit
797df706c1
7 changed files with 559 additions and 8 deletions
|
@ -42,15 +42,18 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Reserve the first system calls for platform-specific usage */
|
||||
/* Reserve the first system calls for platform-specific usage if so
|
||||
* configured.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_CONFIG_SYS_RESERVED
|
||||
# define CONFIG_SYS_RESERVED (32)
|
||||
# define CONFIG_SYS_RESERVED (0)
|
||||
#endif
|
||||
|
||||
/* System call numbers
|
||||
|
@ -89,7 +92,7 @@
|
|||
|
||||
/* The following can be individually enabled */
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXT
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
# define SYS_atexit __SYS_atexit
|
||||
# define __SYS_waitpaid (__SYS_atexit+1)
|
||||
#else
|
||||
|
@ -302,8 +305,27 @@
|
|||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the union of all possible stub function types */
|
||||
|
||||
union syscall_stubfunc_u
|
||||
{
|
||||
uintptr_t (*stub0)(unsigned int nbr);
|
||||
uintptr_t (*stub1)(unsigned int nbr, uintptr_t parm1);
|
||||
uintptr_t (*stub2)(unsigned int nbr, uintptr_t parm1, uintptr_t parm2);
|
||||
uintptr_t (*stub3)(unsigned int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3);
|
||||
uintptr_t (*stub4)(unsigned int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4);
|
||||
uintptr_t (*stub5)(unsigned int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4,
|
||||
uintptr_t parm5);
|
||||
uintptr_t (*stub6)(unsigned int nbr, uintptr_t parm1, uintptr_t parm2,
|
||||
uintptr_t parm3, uintptr_t parm4,
|
||||
uintptr_t parm5, uintptr_t parm6);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -313,6 +335,18 @@ extern "C" {
|
|||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
EXTERN const union syscall_stubfunc_u *g_stublookup[SYS_nsyscalls];
|
||||
EXTERN const uint8_t g_stubnparms[SYS_nsyscalls];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
#include "os_internal.h"
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXT
|
||||
#ifdef CONFIG_SCHED_ATEXiT
|
||||
|
||||
/************************************************************************
|
||||
* Definitions
|
||||
|
@ -111,6 +111,6 @@ int atexit(void (*func)(void))
|
|||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SCHED_ATEXT */
|
||||
#endif /* CONFIG_SCHED_ATEXIT */
|
||||
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void exit(int status)
|
|||
|
||||
/* If an exit function was registered, call it now. */
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXT
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
if (tcb->exitfunc)
|
||||
{
|
||||
(*tcb->exitfunc)();
|
||||
|
|
|
@ -40,6 +40,8 @@ include stubs/Make.defs
|
|||
MKSYSCALL = "$(TOPDIR)/tools/mksyscall$(EXEEXT)"
|
||||
CSVFILE = "$(TOPDIR)/syscall/syscall.csv"
|
||||
|
||||
STUB_SRCS += stub_lookup.c
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
|
|
265
syscall/stub_lookup.c
Normal file
265
syscall/stub_lookup.c
Normal file
|
@ -0,0 +1,265 @@
|
|||
/****************************************************************************
|
||||
* 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 (uintptr_t parm1);
|
||||
extern uintptr_t (uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5);
|
||||
extern uintptr_t (uintptr_t parm1);
|
||||
extern uintptr_t (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_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) p
|
||||
# undef STUB_LOOKUP
|
||||
# define STUB_LOOKUP(n,p) , 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 */
|
250
syscall/stub_lookup.h
Normal file
250
syscall/stub_lookup.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
/****************************************************************************
|
||||
* syscall/stub_lookup.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* STUB_LOOKUP must be defined before including this file.
|
||||
*
|
||||
* These first system calls are supported regardless of the NuttX
|
||||
* configuration
|
||||
*/
|
||||
|
||||
STUB_LOOKUP1(1, STUB__exit) /* SYS__exit */
|
||||
STUB_LOOKUP(1, STUB_exit) /* SYS_exit */
|
||||
STUB_LOOKUP(0, STUB_get_errno) /* SYS_get_errno */
|
||||
STUB_LOOKUP(0, STUB_getpid) /* SYS_getpid */
|
||||
STUB_LOOKUP(2, STUB_sched_getparam) /* SYS_sched_getparam */
|
||||
STUB_LOOKUP(1, STUB_sched_getscheduler) /* SYS_sched_getscheduler */
|
||||
STUB_LOOKUP(0, STUB_sched_lock) /* SYS_sched_lock */
|
||||
STUB_LOOKUP(0, STUB_sched_lockcount) /* SYS_sched_lockcount */
|
||||
STUB_LOOKUP(2, STUB_sched_rr_get_interval) /* SYS_sched_rr_get_interval */
|
||||
STUB_LOOKUP(2, STUB_sched_setparam) /* SYS_sched_setparam */
|
||||
STUB_LOOKUP(3, STUB_sched_setscheduler) /* SYS_sched_setscheduler */
|
||||
STUB_LOOKUP(0, STUB_sched_unlock) /* SYS_sched_unlock */
|
||||
STUB_LOOKUP(0, STUB_sched_yield) /* SYS_sched_yield */
|
||||
STUB_LOOKUP(1, STUB_sem_close) /* SYS_sem_close */
|
||||
STUB_LOOKUP(2, STUB_sem_destroy) /* SYS_sem_destroy */
|
||||
STUB_LOOKUP(6, STUB_sem_open) /* SYS_sem_open */
|
||||
STUB_LOOKUP(1, STUB_sem_post) /* SYS_sem_post */
|
||||
STUB_LOOKUP(1, STUB_sem_trywait) /* SYS_sem_trywait */
|
||||
STUB_LOOKUP(1, STUB_sem_unlink) /* SYS_sem_unlink */
|
||||
STUB_LOOKUP(1, STUB_sem_wait) /* SYS_sem_wait */
|
||||
STUB_LOOKUP(1, STUB_set_errno) /* SYS_set_errno */
|
||||
STUB_LOOKUP(5, STUB_task_create) /* SYS_task_create */
|
||||
STUB_LOOKUP(1, STUB_task_delete) /* SYS_task_delete */
|
||||
STUB_LOOKUP(1, STUB_task_restart) /* SYS_task_restart */
|
||||
STUB_LOOKUP(2, STUB_up_assert) /* SYS_up_assert */
|
||||
STUB_LOOKUP(3, STUB_up_assert_code) /* SYS_up_assert_code */
|
||||
|
||||
/* The following can be individually enabled */
|
||||
|
||||
#ifdef CONFIG_SCHED_ATEXIT
|
||||
STUB_LOOKUP(1, STUB_atexit) /* SYS_atexit */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_WAITPID
|
||||
STUB_LOOKUP(3, STUB_waitpid) /* SYS_waitpid */
|
||||
#endif
|
||||
|
||||
/* The following are only defined is signals are supported in the NuttX
|
||||
* configuration.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
STUB_LOOKUP(2, STUB_kill) /* SYS_kill */
|
||||
STUB_LOOKUP(3, STUB_sigaction) /* SYS_sigaction */
|
||||
STUB_LOOKUP(1, STUB_sigpending) /* SYS_sigpending */
|
||||
STUB_LOOKUP(3, STUB_sigprocmask) /* SYS_sigprocmask */
|
||||
STUB_LOOKUP(3, STUB_sigqueue) /* SYS_sigqueue */
|
||||
STUB_LOOKUP(1, STUB_sigsuspend) /* SYS_sigsuspend */
|
||||
STUB_LOOKUP(3, STUB_sigtimedwait) /* SYS_sigtimedwait */
|
||||
STUB_LOOKUP(2, STUB_sigwaitinfo) /* SYS_sigwaitinfo */
|
||||
STUB_LOOKUP(1, STUB_sleep) /* SYS_sleep */
|
||||
STUB_LOOKUP(1, STUB_usleep) /* SYS_usleep */
|
||||
#endif
|
||||
|
||||
/* The following are only defined if the system clock is enabled in the
|
||||
* NuttX configuration.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_CLOCK
|
||||
STUB_LOOKUP(2, STUB_clock_getres) /* SYS_clock_getres */
|
||||
STUB_LOOKUP(2, STUB_clock_gettime) /* SYS_clock_gettime */
|
||||
STUB_LOOKUP(2, STUB_clock_settime) /* SYS_clock_settime */
|
||||
STUB_LOOKUP(2, STUB_gettimeofday) /* SYS_gettimeofday */
|
||||
#endif
|
||||
|
||||
/* The following are defined only if POSIX timers are supported */
|
||||
|
||||
#ifndef CONFIG_DISABLE_POSIX_TIMERS
|
||||
STUB_LOOKUP(3, STUB_timer_create) /* SYS_timer_create */
|
||||
STUB_LOOKUP(1, STUB_timer_delete) /* SYS_timer_delete */
|
||||
STUB_LOOKUP(1, STUB_timer_getoverrun) /* SYS_timer_getoverrun */
|
||||
STUB_LOOKUP(2, STUB_timer_gettime) /* SYS_timer_gettime */
|
||||
STUB_LOOKUP(4, STUB_timer_settime) /* SYS_timer_settime */
|
||||
#endif
|
||||
|
||||
/* The following are defined if either file or socket descriptor are
|
||||
* enabled.
|
||||
*/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
STUB_LOOKUP(1, STUB_close) /* SYS_close */
|
||||
STUB_LOOKUP(3, STUB_ioctl) /* SYS_ioctl */
|
||||
STUB_LOOKUP(3, STUB_poll) /* SYS_poll */
|
||||
STUB_LOOKUP(3, STUB_read) /* SYS_read */
|
||||
STUB_LOOKUP(5, STUB_select) /* SYS_select */
|
||||
STUB_LOOKUP(3, STUB_write) /* SYS_write */
|
||||
#endif
|
||||
|
||||
/* The following are defined if file descriptors are enabled */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
STUB_LOOKUP(1, STUB_closedir) /* SYS_closedir */
|
||||
STUB_LOOKUP(1, STUB_dup) /* SYS_dup */
|
||||
STUB_LOOKUP(2, STUB_dup2) /* SYS_dup2 */
|
||||
STUB_LOOKUP(6, STUB_fcntl) /* SYS_fcntl */
|
||||
STUB_LOOKUP(3, STUB_lseek) /* SYS_lseek */
|
||||
STUB_LOOKUP(2, STUB_mkfifo) /* SYS_mkfifo */
|
||||
STUB_LOOKUP(6, STUB_mmap) /* SYS_mmap */
|
||||
STUB_LOOKUP(6, STUB_open) /* SYS_open */
|
||||
STUB_LOOKUP(1, STUB_opendir) /* SYS_opendir */
|
||||
STUB_LOOKUP(1, STUB_pipe) /* SYS_pipe */
|
||||
STUB_LOOKUP(1, STUB_readdir) /* SYS_readdir */
|
||||
STUB_LOOKUP(1, STUB_rewinddir) /* SYS_rewinddir */
|
||||
STUB_LOOKUP(2, STUB_seekdir) /* SYS_seekdir */
|
||||
STUB_LOOKUP(2, STUB_stat) /* SYS_stat */
|
||||
STUB_LOOKUP(2, STUB_statfs) /* SYS_statfs */
|
||||
STUB_LOOKUP(1, STUB_telldir) /* SYS_telldir */
|
||||
# if !defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
STUB_LOOKUP(1, STUB_fsync) /* SYS_fsync */
|
||||
STUB_LOOKUP(2, STUB_mkdir) /* SYS_mkdir */
|
||||
STUB_LOOKUP(5, STUB_mount) /* SYS_mount */
|
||||
STUB_LOOKUP(2, STUB_rename) /* SYS_rename */
|
||||
STUB_LOOKUP(1, STUB_rmdir) /* SYS_rmdir */
|
||||
STUB_LOOKUP(1, STUB_umount) /* SYS_umount */
|
||||
STUB_LOOKUP(1, STUB_unlink) /* SYS_unlink */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following are defined if pthreads are enabled */
|
||||
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
STUB_LOOKUP(1, STUB_pthread_barrier_destroy) /* SYS_pthread_barrier_destroy */
|
||||
STUB_LOOKUP(3, STUB_pthread_barrier_init) /* SYS_pthread_barrier_init */
|
||||
STUB_LOOKUP(1, STUB_pthread_barrier_wait) /* SYS_pthread_barrier_wait */
|
||||
STUB_LOOKUP(1, STUB_pthread_cancel) /* SYS_pthread_cancel */
|
||||
STUB_LOOKUP(1, STUB_pthread_cond_broadcast) /* SYS_pthread_cond_broadcast */
|
||||
STUB_LOOKUP(1, STUB_pthread_cond_destroy) /* SYS_pthread_cond_destroy */
|
||||
STUB_LOOKUP(2, STUB_pthread_cond_init) /* SYS_pthread_cond_init */
|
||||
STUB_LOOKUP(1, STUB_pthread_cond_signal) /* SYS_pthread_cond_signal */
|
||||
STUB_LOOKUP(2, STUB_pthread_cond_wait) /* SYS_pthread_cond_wait */
|
||||
STUB_LOOKUP(4, STUB_pthread_create) /* SYS_pthread_create */
|
||||
STUB_LOOKUP(1, STUB_pthread_detach) /* SYS_pthread_detach */
|
||||
STUB_LOOKUP(1, STUB_pthread_exit) /* SYS_pthread_exit */
|
||||
STUB_LOOKUP(3, STUB_pthread_getschedparam) /* SYS_pthread_getschedparam */
|
||||
STUB_LOOKUP(1, STUB_pthread_getspecific) /* SYS_pthread_getspecific */
|
||||
STUB_LOOKUP(2, STUB_pthread_join) /* SYS_pthread_join */
|
||||
STUB_LOOKUP(2, STUB_pthread_key_create) /* SYS_pthread_key_create */
|
||||
STUB_LOOKUP(1, STUB_pthread_key_delete) /* SYS_pthread_key_delete */
|
||||
STUB_LOOKUP(1, STUB_pthread_mutex_destroy) /* SYS_pthread_mutex_destroy */
|
||||
STUB_LOOKUP(2, STUB_pthread_mutex_init) /* SYS_pthread_mutex_init */
|
||||
STUB_LOOKUP(1, STUB_pthread_mutex_lock) /* SYS_pthread_mutex_lock */
|
||||
STUB_LOOKUP(1, STUB_pthread_mutex_trylock) /* SYS_pthread_mutex_trylock */
|
||||
STUB_LOOKUP(1, STUB_pthread_mutex_unlock) /* SYS_pthread_mutex_unlock */
|
||||
STUB_LOOKUP(2, STUB_pthread_once) /* SYS_pthread_once */
|
||||
STUB_LOOKUP(2, STUB_pthread_setcancelstate) /* SYS_pthread_setcancelstate */
|
||||
STUB_LOOKUP(3, STUB_pthread_setschedparam) /* SYS_pthread_setschedparam */
|
||||
STUB_LOOKUP(2, STUB_pthread_setschedprio) /* SYS_pthread_setschedprio */
|
||||
STUB_LOOKUP(2, STUB_pthread_setspecific) /* SYS_pthread_setspecific */
|
||||
STUB_LOOKUP(0, STUB_pthread_testcancel) /* SYS_pthread_testcancel */
|
||||
STUB_LOOKUP(0, STUB_pthread_yield) /* SYS_pthread_yield */
|
||||
# ifndef CONFIG_DISABLE_SIGNAL
|
||||
STUB_LOOKUP(3, STUB_pthread_cond_timedwait) /* SYS_pthread_cond_timedwait */
|
||||
STUB_LOOKUP(2, STUB_pthread_kill) /* SYS_pthread_kill */
|
||||
STUB_LOOKUP(3, STUB_pthread_sigmask) /* SYS_pthread_sigmask */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following are defined only if message queues are enabled */
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
STUB_LOOKUP(1, STUB_mq_close) /* SYS_mq_close */
|
||||
STUB_LOOKUP(2, STUB_mq_notify) /* SYS_mq_notify */
|
||||
STUB_LOOKUP(6, STUB_mq_open) /* SYS_mq_open */
|
||||
STUB_LOOKUP(4, STUB_mq_receive) /* SYS_mq_receive */
|
||||
STUB_LOOKUP(4, STUB_mq_send) /* SYS_mq_send */
|
||||
STUB_LOOKUP(5, STUB_mq_timedreceive) /* SYS_mq_timedreceive */
|
||||
STUB_LOOKUP(5, STUB_mq_timedsend) /* SYS_mq_timedsend */
|
||||
STUB_LOOKUP(1, STUB_mq_unlink) /* SYS_mq_unlink */
|
||||
#endif
|
||||
|
||||
/* The following are defined only if environment variables are supported */
|
||||
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
STUB_LOOKUP(0, STUB_clearenv) /* SYS_clearenv */
|
||||
STUB_LOOKUP(1, STUB_getenv) /* SYS_getenv */
|
||||
STUB_LOOKUP(1, STUB_putenv) /* SYS_putenv */
|
||||
STUB_LOOKUP(3, STUB_setenv) /* SYS_setenv */
|
||||
STUB_LOOKUP(1, STUB_unsetenv) /* SYS_unsetenv */
|
||||
#endif
|
||||
|
||||
/* The following are defined only if networking AND sockets are supported */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)
|
||||
STUB_LOOKUP(3, STUB_accept) /* SYS_accept */
|
||||
STUB_LOOKUP(3, STUB_bind) /* SYS_bind */
|
||||
STUB_LOOKUP(3, STUB_connect) /* SYS_connect */
|
||||
STUB_LOOKUP(5, STUB_getsockopt) /* SYS_getsockopt */
|
||||
STUB_LOOKUP(2, STUB_listen) /* SYS_listen */
|
||||
STUB_LOOKUP(4, STUB_recv) /* SYS_recv */
|
||||
STUB_LOOKUP(6, STUB_recvfrom) /* SYS_recvfrom */
|
||||
STUB_LOOKUP(4, STUB_send) /* SYS_send */
|
||||
STUB_LOOKUP(6, STUB_sendto) /* SYS_sendto */
|
||||
STUB_LOOKUP(5, STUB_setsockopt) /* SYS_setsockopt */
|
||||
STUB_LOOKUP(3, STUB_socket) /* SYS_socket */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
"_exit","unistd.h","","void","int"
|
||||
"accept","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","struct sockaddr*","socklen_t*"
|
||||
"atexit","stdlib.h","defined(CONFIG_SCHED_ATEXT)","int","void (*)(void)"
|
||||
"atexit","stdlib.h","defined(CONFIG_SCHED_ATEXIT)","int","void (*)(void)"
|
||||
"bind","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
|
||||
"clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int"
|
||||
"clock_getres","time.h","!defined(CONFIG_DISABLE_CLOCK)","int","clockid_t","struct timespec*"
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
Loading…
Reference in a new issue