mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
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:
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/include/arm/irq.h
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -204,8 +204,46 @@ static inline void irqrestore(irqstate_t flags)
|
|||||||
: "memory");
|
: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void system_call(swint_t func, int parm1,
|
static inline void system_call0(unsigned int nbr)
|
||||||
int parm2, int parm3)
|
{
|
||||||
|
__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__
|
__asm__ __volatile__
|
||||||
(
|
(
|
||||||
@@ -215,10 +253,11 @@ static inline void system_call(swint_t func, int parm1,
|
|||||||
"mov\tr3,%3\n\t"
|
"mov\tr3,%3\n\t"
|
||||||
"swi\t0x900001\n\t"
|
"swi\t0x900001\n\t"
|
||||||
:
|
:
|
||||||
: "r" ((long)(func)), "r" ((long)(parm1)),
|
: "r" ((long)(nbr)), "r" ((long)(parm1)),
|
||||||
"r" ((long)(parm2)), "r" ((long)(parm3))
|
"r" ((long)(parm2)), "r" ((long)(parm3))
|
||||||
: "r0", "r1", "r2", "r3", "lr");
|
: "r0", "r1", "r2", "r3", "lr");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/include/cortexm3/irq.h
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -49,7 +49,6 @@
|
|||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Definitions
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -281,6 +280,61 @@ static inline void svcall(uint32_t cmd, uint32_t arg)
|
|||||||
: "r" (cmd), "r" (arg)
|
: "r" (cmd), "r" (arg)
|
||||||
: "memory");
|
: "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__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -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__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* arch/hc/include/hc12/irq.h
|
* 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>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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 */
|
/* To be provided */
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void system_call(swint_t func, int parm1,
|
static inline void system_call3(unsigned int nbr, uintptr_t parm1,
|
||||||
int parm2, int parm3)
|
uintptr_t parm2, uintptr_t parm3)
|
||||||
{
|
{
|
||||||
/* To be provided */
|
/* To be provided */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,7 +243,12 @@ static inline void irqrestore(irqstate_t flags)
|
|||||||
|
|
||||||
/* System call */
|
/* 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
|
* Public Data
|
||||||
|
|||||||
@@ -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
|
* Public Variables
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user