The system call library can now be built with CONFIG_NUTTX_KERNEL. New select: CONFIG_LIB_SYSCALL
This commit is contained in:
parent
660e939d0c
commit
7a81bce7b1
3
Kconfig
3
Kconfig
|
@ -186,6 +186,7 @@ config PASS1_OBJECT
|
|||
config NUTTX_KERNEL
|
||||
bool "NuttX kernel build"
|
||||
default n
|
||||
select LIB_SYSCALL
|
||||
---help---
|
||||
Builds NuttX as a separately compiled kernel.
|
||||
|
||||
|
@ -681,9 +682,7 @@ endmenu
|
|||
|
||||
menu "RTOS Features"
|
||||
source sched/Kconfig
|
||||
if NUTTX_KERNEL
|
||||
source syscall/Kconfig
|
||||
endif
|
||||
endmenu
|
||||
|
||||
menu "Device Drivers"
|
||||
|
|
|
@ -119,9 +119,7 @@ OTHERDIRS = lib
|
|||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall libc mm $(USER_ADDONS)
|
||||
USERDIRS += libc mm $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
USERDIRS += libxx
|
||||
endif
|
||||
|
@ -129,7 +127,7 @@ endif
|
|||
else
|
||||
|
||||
NONFSDIRS += libc mm
|
||||
OTHERDIRS += syscall $(USER_ADDONS)
|
||||
OTHERDIRS += $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
NONFSDIRS += libxx
|
||||
else
|
||||
|
@ -138,6 +136,14 @@ endif
|
|||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_SYSCALL),y)
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall
|
||||
else
|
||||
OTHERDIRS += syscall
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NONFSDIRS += graphics libnx
|
||||
CONTEXTDIRS += graphics libnx
|
||||
|
|
14
Makefile.win
14
Makefile.win
|
@ -112,9 +112,7 @@ OTHERDIRS = lib
|
|||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall libc mm $(USER_ADDONS)
|
||||
USERDIRS += libc mm $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
USERDIRS += libxx
|
||||
endif
|
||||
|
@ -122,7 +120,7 @@ endif
|
|||
else
|
||||
|
||||
NONFSDIRS += libc mm
|
||||
OTHERDIRS += syscall $(USER_ADDONS)
|
||||
OTHERDIRS += $(USER_ADDONS)
|
||||
ifeq ($(CONFIG_HAVE_CXX),y)
|
||||
NONFSDIRS += libxx
|
||||
else
|
||||
|
@ -131,6 +129,14 @@ endif
|
|||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_SYSCALL),y)
|
||||
NONFSDIRS += syscall
|
||||
CONTEXTDIRS += syscall
|
||||
USERDIRS += syscall
|
||||
else
|
||||
OTHERDIRS += syscall
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NX),y)
|
||||
NONFSDIRS += graphics libnx
|
||||
CONTEXTDIRS += graphics libnx
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************************************
|
||||
* arch/arm/src/armv6-m/svcall.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
|
@ -55,11 +55,19 @@
|
|||
* syscall return. The first four syscall values must be reserved.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 8"
|
||||
# elif CONFIG_SYS_RESERVED != 8
|
||||
# error "CONFIG_SYS_RESERVED must have the value 8"
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# ifdef CONFIG_NUTTX_KERNEL
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 8"
|
||||
# elif CONFIG_SYS_RESERVED != 8
|
||||
# error "CONFIG_SYS_RESERVED must have the value 8"
|
||||
# endif
|
||||
# else
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 3"
|
||||
# elif CONFIG_SYS_RESERVED != 3
|
||||
# error "CONFIG_SYS_RESERVED must have the value 3"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/armv6-m/up_svcall.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,7 +47,7 @@
|
|||
#include <arch/irq.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
static void dispatch_syscall(void) naked_function;
|
||||
static void dispatch_syscall(void)
|
||||
{
|
||||
|
@ -444,7 +444,7 @@ int up_svcall(int irq, FAR void *context)
|
|||
|
||||
default:
|
||||
{
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
FAR struct tcb_s *rtcb = sched_self();
|
||||
int index = rtcb->xcp.nsyscalls;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************************************
|
||||
* arch/arm/src/armv7-m/svcall.h
|
||||
*
|
||||
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
|
@ -55,11 +55,19 @@
|
|||
* syscall return. The first four syscall values must be reserved.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 8"
|
||||
# elif CONFIG_SYS_RESERVED != 8
|
||||
# error "CONFIG_SYS_RESERVED must have the value 8"
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# ifdef CONFIG_NUTTX_KERNEL
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 8"
|
||||
# elif CONFIG_SYS_RESERVED != 8
|
||||
# error "CONFIG_SYS_RESERVED must have the value 8"
|
||||
# endif
|
||||
# else
|
||||
# ifndef CONFIG_SYS_RESERVED
|
||||
# error "CONFIG_SYS_RESERVED must be defined to have the value 3"
|
||||
# elif CONFIG_SYS_RESERVED != 3
|
||||
# error "CONFIG_SYS_RESERVED must have the value 3"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/armv7-m/up_svcall.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 2011-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,7 +47,7 @@
|
|||
#include <arch/irq.h>
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
# include <syscall.h>
|
||||
#endif
|
||||
|
||||
|
@ -116,7 +116,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
static void dispatch_syscall(void) naked_function;
|
||||
static void dispatch_syscall(void)
|
||||
{
|
||||
|
@ -443,7 +443,7 @@ int up_svcall(int irq, FAR void *context)
|
|||
|
||||
default:
|
||||
{
|
||||
#ifdef CONFIG_NUTTX_KERNEL
|
||||
#ifdef CONFIG_LIB_SYSCALL
|
||||
FAR struct tcb_s *rtcb = sched_self();
|
||||
int index = rtcb->xcp.nsyscalls;
|
||||
|
||||
|
|
|
@ -3,9 +3,31 @@
|
|||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
if NUTTX_KERNEL
|
||||
menuconfig LIB_SYSCALL
|
||||
bool "System call support"
|
||||
default n
|
||||
---help---
|
||||
Build in support for "system calls". System calls are used to
|
||||
implement a call gate mechanism that can be be used to call from
|
||||
user code into the kernel. This is only useful for user code that
|
||||
likes outside of the kernel such as when the NUTTX_KERNEL build is
|
||||
selected.
|
||||
|
||||
comment "System call configuration"
|
||||
This permits calls from user-mode code into kernel mode; the call
|
||||
gate will change the mode of operation from user to supervisor mode,
|
||||
then call into the OS code on behalf of the user-mode application.
|
||||
|
||||
If if there are no privilege issues preventing the call, system
|
||||
calls may also be of value because it can eliminate the need for
|
||||
symbol tables when linking external modules to the NuttX base code.
|
||||
The selection will build libsyscall. External modules can then link
|
||||
with libsyscall when they are built and they can call into the OS
|
||||
with no knowledge of the actual address in the OS. In this case,
|
||||
they call into a proxy that is link with the external code; that
|
||||
proxy then marshals the call parameter and invokes the system call
|
||||
to accomplish the interface.
|
||||
|
||||
if LIB_SYSCALL
|
||||
|
||||
config SYS_RESERVED
|
||||
int "Number of reserved system calls"
|
||||
|
@ -34,4 +56,4 @@ config SYS_NNEST
|
|||
space memory. So it is expected that the maximum nesting level will
|
||||
be only 2.
|
||||
|
||||
endif
|
||||
endif # LIB_SYSCALL
|
||||
|
|
Loading…
Reference in New Issue