diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-29 00:07:02 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-29 00:07:02 +0000 |
commit | 9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74 (patch) | |
tree | 82bf5b0e6e26f447eedb4044500a97a0108f4572 /nuttx/arch/arm | |
parent | 3b136a8a2bba17e4f5ab0a18118a9f69e5f5eab1 (diff) | |
download | px4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.tar.gz px4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.tar.bz2 px4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.zip |
Moving toward system call infrastructure
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3435 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r-- | nuttx/arch/arm/include/arm/irq.h | 47 | ||||
-rw-r--r-- | nuttx/arch/arm/include/cortexm3/irq.h | 58 |
2 files changed, 99 insertions, 6 deletions
diff --git a/nuttx/arch/arm/include/arm/irq.h b/nuttx/arch/arm/include/arm/irq.h index 65ccd1356..befc1218b 100644 --- a/nuttx/arch/arm/include/arm/irq.h +++ b/nuttx/arch/arm/include/arm/irq.h @@ -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__ */ /**************************************************************************** diff --git a/nuttx/arch/arm/include/cortexm3/irq.h b/nuttx/arch/arm/include/cortexm3/irq.h index 3f731385b..f57c1dc33 100644 --- a/nuttx/arch/arm/include/cortexm3/irq.h +++ b/nuttx/arch/arm/include/cortexm3/irq.h @@ -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__ */ /**************************************************************************** |