2013-03-07 03:56:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* syscall/syscall_stublookup.c
|
|
|
|
*
|
2024-09-11 18:11:27 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2020-05-04 04:16:36 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2013-03-07 03:56:32 +08:00
|
|
|
*
|
2020-05-04 04:16:36 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2013-03-07 03:56:32 +08:00
|
|
|
*
|
2020-05-04 04:16:36 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2013-03-07 03:56:32 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2013-12-12 06:49:48 +08:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
2013-03-07 03:56:32 +08:00
|
|
|
#include <syscall.h>
|
|
|
|
|
|
|
|
/* The content of this file is only meaningful during the kernel phase of
|
|
|
|
* a kernel build.
|
|
|
|
*/
|
|
|
|
|
2014-08-31 04:26:56 +08:00
|
|
|
#if defined(CONFIG_LIB_SYSCALL)
|
2013-03-07 03:56:32 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
2020-05-06 12:20:26 +08:00
|
|
|
* Pre-processor Definitions
|
2013-03-07 03:56:32 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
2020-05-06 12:20:26 +08:00
|
|
|
#define CAT(p,f) CAT_(p, f)
|
|
|
|
#define CAT_(p,f) p##f
|
|
|
|
|
|
|
|
#define STUB_NAME(f) CAT(STUB_, f)
|
|
|
|
|
|
|
|
#define STUB_PROT0(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr)
|
|
|
|
#define STUB_PROT1(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1)
|
|
|
|
#define STUB_PROT2(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1, uintptr_t parm2)
|
|
|
|
#define STUB_PROT3(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1, uintptr_t parm2, \
|
|
|
|
uintptr_t parm3)
|
|
|
|
#define STUB_PROT4(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1, uintptr_t parm2, \
|
|
|
|
uintptr_t parm3, uintptr_t parm4)
|
|
|
|
#define STUB_PROT5(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1, uintptr_t parm2, \
|
|
|
|
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5)
|
|
|
|
#define STUB_PROT6(f) \
|
|
|
|
uintptr_t STUB_NAME(f)(int nbr, uintptr_t parm1, uintptr_t parm2, \
|
|
|
|
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, \
|
|
|
|
uintptr_t parm6)
|
|
|
|
|
|
|
|
#define STUB_PROT(f, n) CAT(STUB_PROT, n)(f)
|
2014-10-06 05:59:02 +08:00
|
|
|
|
2020-05-06 12:20:26 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Stub Function Prototypes
|
|
|
|
****************************************************************************/
|
2017-03-30 21:38:37 +08:00
|
|
|
|
2020-05-06 12:20:26 +08:00
|
|
|
#define SYSCALL_LOOKUP1(f,n) STUB_PROT(f, n);
|
|
|
|
#define SYSCALL_LOOKUP(f,n) STUB_PROT(f, n);
|
|
|
|
#include <sys/syscall_lookup.h>
|
|
|
|
#undef SYSCALL_LOOKUP1
|
|
|
|
#undef SYSCALL_LOOKUP
|
2017-03-30 21:38:37 +08:00
|
|
|
|
2013-03-07 03:56:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Stub lookup tables. This table is indexed by the system call number.
|
|
|
|
* Given the system call number, the corresponding entry in this table
|
|
|
|
* provides the address of the stub function.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const uintptr_t g_stublookup[SYS_nsyscalls] =
|
|
|
|
{
|
2020-05-06 12:20:26 +08:00
|
|
|
# define SYSCALL_LOOKUP1(f,n) (uintptr_t)STUB_NAME(f)
|
|
|
|
# define SYSCALL_LOOKUP(f,n) , (uintptr_t)STUB_NAME(f)
|
2020-05-07 14:42:52 +08:00
|
|
|
# include <sys/syscall_lookup.h>
|
|
|
|
# undef SYSCALL_LOOKUP1
|
|
|
|
# undef SYSCALL_LOOKUP
|
2013-03-07 03:56:32 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-08-31 04:26:56 +08:00
|
|
|
#endif /* CONFIG_LIB_SYSCALL */
|