Moving toward system call infrastructure

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3435 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-03-29 00:07:02 +00:00
parent 45f3419063
commit 4d215e34ca
9 changed files with 207 additions and 89 deletions
+43 -4
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/include/arm/irq.h
*
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -204,8 +204,46 @@ static inline void irqrestore(irqstate_t flags)
: "memory");
}
static inline void system_call(swint_t func, int parm1,
int parm2, int parm3)
static inline void system_call0(unsigned int nbr)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"swi\t0x900001\n\t"
:
: "r" ((long)(nbr))
: "r0", "lr");
}
static inline void system_call1(unsigned int nbr, uintptr_t parm1)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"swi\t0x900001\n\t"
:
: "r" ((long)(nbr)), "r" ((long)(parm1))
: "r0", "r1", "lr");
}
static inline void system_call2(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"mov\tr2,%2\n\t"
"swi\t0x900001\n\t"
:
: "r" ((long)(nbr)), "r" ((long)(parm1)),
"r" ((long)(parm2))
: "r0", "r1", "r2", "lr");
}
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
__asm__ __volatile__
(
@@ -215,10 +253,11 @@ static inline void system_call(swint_t func, int parm1,
"mov\tr3,%3\n\t"
"swi\t0x900001\n\t"
:
: "r" ((long)(func)), "r" ((long)(parm1)),
: "r" ((long)(nbr)), "r" ((long)(parm1)),
"r" ((long)(parm2)), "r" ((long)(parm3))
: "r0", "r1", "r2", "r3", "lr");
}
#endif /* __ASSEMBLY__ */
/****************************************************************************
+56 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/include/cortexm3/irq.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,7 +49,6 @@
# include <stdint.h>
#endif
/****************************************************************************
* Definitions
****************************************************************************/
@@ -281,6 +280,61 @@ static inline void svcall(uint32_t cmd, uint32_t arg)
: "r" (cmd), "r" (arg)
: "memory");
}
static inline void system_call0(unsigned int nbr)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"\tsvc 0\n"
:
: "r" ((long)(nbr))
: "r0", "lr");
}
static inline void system_call1(unsigned int nbr, uintptr_t parm1)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"\tsvc 0\n"
:
: "r" ((long)(nbr)), "r" ((long)(parm1))
: "r0", "r1", "lr");
}
static inline void system_call2(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"mov\tr2,%2\n\t"
"\tsvc 0\n"
:
: "r" ((long)(nbr)), "r" ((long)(parm1)),
"r" ((long)(parm2))
: "r0", "r1", "r2", "lr");
}
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
__asm__ __volatile__
(
"mov\tr0,%0\n\t"
"mov\tr1,%1\n\t"
"mov\tr2,%2\n\t"
"mov\tr3,%3\n\t"
"\tsvc 0\n"
:
: "r" ((long)(nbr)), "r" ((long)(parm1)),
"r" ((long)(parm2)), "r" ((long)(parm3))
: "r0", "r1", "r2", "r3", "lr");
}
#endif /* __ASSEMBLY__ */
/****************************************************************************
+6
View File
@@ -188,6 +188,12 @@ static inline void irqrestore(irqstate_t flags)
);
}
}
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
/* To be provided */
}
#endif /* __ASSEMBLY__ */
/****************************************************************************
+3 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/hc/include/hc12/irq.h
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -81,8 +81,8 @@ static inline void irqrestore(irqstate_t flags)
/* To be provided */
}
static inline void system_call(swint_t func, int parm1,
int parm2, int parm3)
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
/* To be provided */
}
+6 -1
View File
@@ -243,7 +243,12 @@ static inline void irqrestore(irqstate_t flags)
/* System call */
#define system_call(f,p1,p2,p3) __asm("swi")
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
/* To be provided */
/* __asm("swi") */
}
/************************************************************************************
* Public Data
+6
View File
@@ -256,6 +256,12 @@ static inline void irqrestore(irqstate_t flags)
}
}
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3)
{
/* To be provided */
}
/****************************************************************************
* Public Variables
****************************************************************************/
+1 -2
View File
@@ -40,8 +40,7 @@ fi
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
WD=`pwd`
export RIDE_BIN="/cygdrive/c/Program Files/Raisonance/Ride/arm-gcc/bin"
export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
export PATH="${BUILDROOT_BIN}:${RIDE_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+1 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/irq.h
*
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,6 @@
#ifndef __ASSEMBLY__
typedef int (*xcpt_t)(int irq, FAR void *context);
typedef int (*swint_t)(int code, int parm2, int parm3, FAR void *context);
#endif
/* Now include architecture-specific types */
+85 -75
View File
@@ -41,85 +41,95 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define SYS_accept (0)
#define SYS_bind (1)
#define SYS_chdir (2)
#define SYS_clock_getres (3)
#define SYS_clock_gettime (4)
#define SYS_clock_settime (5)
#define SYS_close (6)
#define SYS_connect (7)
#define SYS_creat (8)
#define SYS_dup (9)
#define SYS_dup2 (10)
#define SYS_exit (11)
#define SYS_fcntl (12)
#define SYS_fstat (13)
#define SYS_fstatfs (14)
#define SYS_fsync (15)
#define SYS_getcwd (16)
#define SYS_getpid (17)
#define SYS_getsockopt (18)
#define SYS_gettimeofday (19)
#define SYS_ioctl (20)
#define SYS_kill (21)
#define SYS_listen (22)
#define SYS_lseek (23)
#define SYS_mkdir (24)
#define SYS_mmap (25)
#define SYS_mount (26)
#define SYS_mq_notify (27)
#define SYS_mq_open (28)
#define SYS_mq_timedreceive (29)
#define SYS_mq_timedsend (30)
#define SYS_mq_unlink (31)
#define SYS_munmap (32)
#define SYS_open (33)
#define SYS_pipe (34)
#define SYS_poll (35)
#define SYS_read (36)
#define SYS_readdir (37)
#define SYS_reboot (38)
#define SYS_recvfrom (39)
#define SYS_rename (40)
#define SYS_rmdir (41)
#define SYS_sched_getparam (42)
#define SYS_sched_get_priority_max (43)
#define SYS_sched_get_priority_min (44)
#define SYS_sched_getscheduler (45)
#define SYS_sched_rr_get_interval (46)
#define SYS_sched_setparam (47)
#define SYS_sched_setscheduler (48)
#define SYS_sched_yield (49)
#define SYS_select (50)
#define SYS_sendto (51)
#define SYS_setsockopt (52)
#define SYS_sigaction (53)
#define SYS_signal (54)
#define SYS_sigpending (55)
#define SYS_sigprocmask (56)
#define SYS_sigsuspend (57)
#define SYS_socket (58)
#define SYS_stat (59)
#define SYS_statfs (60)
#define SYS_task_create (61)
#define SYS_task_delete (62)
#define SYS_task_init (63)
#define SYS_task_restart (64)
#define SYS_timer_create (65)
#define SYS_timer_delete (66)
#define SYS_timer_getoverrun (67)
#define SYS_timer_gettime (68)
#define SYS_timer_settime (69)
#define SYS_umount (70)
#define SYS_unlink (71)
#define SYS_waitid (72)
#define SYS_waitpid (73)
#define SYS_write (74)
/* Reserve the first system calls for platform-specific usage */
#ifndef CONFIG_CONFIG_SYS_RESERVED
# define CONFIG_SYS_RESERVED (32)
#endif
/* System call numbers */
#define SYS_accept (CONFIG_SYS_RESERVED+0)
#define SYS_bind (CONFIG_SYS_RESERVED+1)
#define SYS_chdir (CONFIG_SYS_RESERVED+2)
#define SYS_clock_getres (CONFIG_SYS_RESERVED+3)
#define SYS_clock_gettime (CONFIG_SYS_RESERVED+4)
#define SYS_clock_settime (CONFIG_SYS_RESERVED+5)
#define SYS_close (CONFIG_SYS_RESERVED+6)
#define SYS_connect (CONFIG_SYS_RESERVED+7)
#define SYS_creat (CONFIG_SYS_RESERVED+8)
#define SYS_dup (CONFIG_SYS_RESERVED+9)
#define SYS_dup2 (CONFIG_SYS_RESERVED+10)
#define SYS_exit (CONFIG_SYS_RESERVED+11)
#define SYS_fcntl (CONFIG_SYS_RESERVED+12)
#define SYS_fstat (CONFIG_SYS_RESERVED+13)
#define SYS_fstatfs (CONFIG_SYS_RESERVED+14)
#define SYS_fsync (CONFIG_SYS_RESERVED+15)
#define SYS_getcwd (CONFIG_SYS_RESERVED+16)
#define SYS_getpid (CONFIG_SYS_RESERVED+17)
#define SYS_getsockopt (CONFIG_SYS_RESERVED+18)
#define SYS_gettimeofday (CONFIG_SYS_RESERVED+19)
#define SYS_ioctl (CONFIG_SYS_RESERVED+20)
#define SYS_kill (CONFIG_SYS_RESERVED+21)
#define SYS_listen (CONFIG_SYS_RESERVED+22)
#define SYS_lseek (CONFIG_SYS_RESERVED+23)
#define SYS_mkdir (CONFIG_SYS_RESERVED+24)
#define SYS_mmap (CONFIG_SYS_RESERVED+25)
#define SYS_mount (CONFIG_SYS_RESERVED+26)
#define SYS_mq_notify (CONFIG_SYS_RESERVED+27)
#define SYS_mq_open (CONFIG_SYS_RESERVED+28)
#define SYS_mq_timedreceive (CONFIG_SYS_RESERVED+29)
#define SYS_mq_timedsend (CONFIG_SYS_RESERVED+30)
#define SYS_mq_unlink (CONFIG_SYS_RESERVED+31)
#define SYS_munmap (CONFIG_SYS_RESERVED+32)
#define SYS_open (CONFIG_SYS_RESERVED+33)
#define SYS_pipe (CONFIG_SYS_RESERVED+34)
#define SYS_poll (CONFIG_SYS_RESERVED+35)
#define SYS_read (CONFIG_SYS_RESERVED+36)
#define SYS_readdir (CONFIG_SYS_RESERVED+37)
#define SYS_reboot (CONFIG_SYS_RESERVED+38)
#define SYS_recvfrom (CONFIG_SYS_RESERVED+39)
#define SYS_rename (CONFIG_SYS_RESERVED+40)
#define SYS_rmdir (CONFIG_SYS_RESERVED+41)
#define SYS_sched_getparam (CONFIG_SYS_RESERVED+42)
#define SYS_sched_get_priority_max (CONFIG_SYS_RESERVED+43)
#define SYS_sched_get_priority_min (CONFIG_SYS_RESERVED+44)
#define SYS_sched_getscheduler (CONFIG_SYS_RESERVED+45)
#define SYS_sched_rr_get_interval (CONFIG_SYS_RESERVED+46)
#define SYS_sched_setparam (CONFIG_SYS_RESERVED+47)
#define SYS_sched_setscheduler (CONFIG_SYS_RESERVED+48)
#define SYS_sched_yield (CONFIG_SYS_RESERVED+49)
#define SYS_select (CONFIG_SYS_RESERVED+50)
#define SYS_sendto (CONFIG_SYS_RESERVED+51)
#define SYS_setsockopt (CONFIG_SYS_RESERVED+52)
#define SYS_sigaction (CONFIG_SYS_RESERVED+53)
#define SYS_signal (CONFIG_SYS_RESERVED+54)
#define SYS_sigpending (CONFIG_SYS_RESERVED+55)
#define SYS_sigprocmask (CONFIG_SYS_RESERVED+56)
#define SYS_sigsuspend (CONFIG_SYS_RESERVED+57)
#define SYS_socket (CONFIG_SYS_RESERVED+58)
#define SYS_stat (CONFIG_SYS_RESERVED+59)
#define SYS_statfs (CONFIG_SYS_RESERVED+60)
#define SYS_task_create (CONFIG_SYS_RESERVED+61)
#define SYS_task_delete (CONFIG_SYS_RESERVED+62)
#define SYS_task_init (CONFIG_SYS_RESERVED+63)
#define SYS_task_restart (CONFIG_SYS_RESERVED+64)
#define SYS_timer_create (CONFIG_SYS_RESERVED+65)
#define SYS_timer_delete (CONFIG_SYS_RESERVED+66)
#define SYS_timer_getoverrun (CONFIG_SYS_RESERVED+67)
#define SYS_timer_gettime (CONFIG_SYS_RESERVED+68)
#define SYS_timer_settime (CONFIG_SYS_RESERVED+69)
#define SYS_umount (CONFIG_SYS_RESERVED+70)
#define SYS_unlink (CONFIG_SYS_RESERVED+71)
#define SYS_waitid (CONFIG_SYS_RESERVED+72)
#define SYS_waitpid (CONFIG_SYS_RESERVED+73)
#define SYS_write (CONFIG_SYS_RESERVED+74)
/****************************************************************************
* Public Type Definitions