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 a55fc5bb81
commit 0ee42c3f9e
6 changed files with 120 additions and 10 deletions

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__ */
/****************************************************************************

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__ */
/****************************************************************************

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__ */
/****************************************************************************

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 */
}

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

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
****************************************************************************/