summaryrefslogtreecommitdiff
path: root/nuttx/arch/mips/src/mips32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-18 22:34:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-05-18 22:34:11 +0000
commit3a6e6d40569f3b267f88417d3f5c7816f5bde1d5 (patch)
tree5fbf7e69fc279d8a741a7048afc5cbdd2d95b8b3 /nuttx/arch/mips/src/mips32
parent39ec51e53213f317a6f2efbaf9b7495a8eef2c37 (diff)
downloadpx4-nuttx-3a6e6d40569f3b267f88417d3f5c7816f5bde1d5.tar.gz
px4-nuttx-3a6e6d40569f3b267f88417d3f5c7816f5bde1d5.tar.bz2
px4-nuttx-3a6e6d40569f3b267f88417d3f5c7816f5bde1d5.zip
Add MIPS system call infrastructure
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3626 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/mips/src/mips32')
-rwxr-xr-xnuttx/arch/mips/src/mips32/up_blocktask.c3
-rwxr-xr-xnuttx/arch/mips/src/mips32/up_releasepending.c2
-rwxr-xr-xnuttx/arch/mips/src/mips32/up_reprioritizertr.c3
-rw-r--r--nuttx/arch/mips/src/mips32/up_sigdeliver.c1
-rw-r--r--nuttx/arch/mips/src/mips32/up_syscall0.S94
-rwxr-xr-xnuttx/arch/mips/src/mips32/up_unblocktask.c4
6 files changed, 104 insertions, 3 deletions
diff --git a/nuttx/arch/mips/src/mips32/up_blocktask.c b/nuttx/arch/mips/src/mips32/up_blocktask.c
index ce92452b9..eb570b7a1 100755
--- a/nuttx/arch/mips/src/mips32/up_blocktask.c
+++ b/nuttx/arch/mips/src/mips32/up_blocktask.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/mips/src/mips32/up_blocktask.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <stdbool.h>
#include <sched.h>
+#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
diff --git a/nuttx/arch/mips/src/mips32/up_releasepending.c b/nuttx/arch/mips/src/mips32/up_releasepending.c
index ea36d152a..978df0c7d 100755
--- a/nuttx/arch/mips/src/mips32/up_releasepending.c
+++ b/nuttx/arch/mips/src/mips32/up_releasepending.c
@@ -40,7 +40,9 @@
#include <nuttx/config.h>
#include <sched.h>
+#include <syscall.h>
#include <debug.h>
+
#include <nuttx/arch.h>
#include "os_internal.h"
diff --git a/nuttx/arch/mips/src/mips32/up_reprioritizertr.c b/nuttx/arch/mips/src/mips32/up_reprioritizertr.c
index 19a4f05c6..24e33693c 100755
--- a/nuttx/arch/mips/src/mips32/up_reprioritizertr.c
+++ b/nuttx/arch/mips/src/mips32/up_reprioritizertr.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/mips/src/mips32/up_reprioritizertr.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <sched.h>
+#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
diff --git a/nuttx/arch/mips/src/mips32/up_sigdeliver.c b/nuttx/arch/mips/src/mips32/up_sigdeliver.c
index 05a956070..7a291b58b 100644
--- a/nuttx/arch/mips/src/mips32/up_sigdeliver.c
+++ b/nuttx/arch/mips/src/mips32/up_sigdeliver.c
@@ -41,6 +41,7 @@
#include <stdint.h>
#include <sched.h>
+#include <syscall.h>
#include <debug.h>
#include <nuttx/irq.h>
diff --git a/nuttx/arch/mips/src/mips32/up_syscall0.S b/nuttx/arch/mips/src/mips32/up_syscall0.S
new file mode 100644
index 000000000..241fd7aa7
--- /dev/null
+++ b/nuttx/arch/mips/src/mips32/up_syscall0.S
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * arch/mips/src/mips32/up_syscall0.S
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/mips32/registers.h>
+#include <arch/mips32/cp0.h>
+
+/****************************************************************************
+ * Global Symbols
+ ****************************************************************************/
+
+ .file "up_syscall0.S"
+ .global sys_call0
+ .global sys_call1
+ .global sys_call2
+ .global sys_call3
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_syscall0, up_syscall1, up_syscall2, up_syscall3
+ *
+ * Description:
+ * up_syscall0 - System call SYS_ argument and no additional parameters.
+ * up_syscall1 - System call SYS_ argument and one additional parameter.
+ * up_syscall2 - System call SYS_ argument and two additional parameters.
+ * up_syscall3 - System call SYS_ argument and three additional parameters.
+ *
+ ****************************************************************************/
+
+ .text
+ .set noreorder
+ .ent sys_call0
+sys_call0: /* r4 holds the syscall number */
+sys_call1: /* r4 holds the syscall number, argument in r5 */
+sys_call2: /* r4 holds the syscall number, arguments in r5 and r6 */
+sys_call3: /* r4 holds the syscall number, arguments in r5, r6, and r7 */
+
+ .set push
+ .set noat
+ mfc0 t3, MIPS32_CP0_CAUSE /* t3 = CP0 cause register */
+ ori t3, (1 << 8) /* Bit 8: Request software interrupt 0 */
+ .set noreorder
+ mtc0 t3, MIPS32_CP0_CAUSE /* Trigger the software interrupt */
+ nop /* Delay slot */
+ j ra /* Return with result in v0 */
+ .end sys_call0
diff --git a/nuttx/arch/mips/src/mips32/up_unblocktask.c b/nuttx/arch/mips/src/mips32/up_unblocktask.c
index c32bc573e..c0106e94c 100755
--- a/nuttx/arch/mips/src/mips32/up_unblocktask.c
+++ b/nuttx/arch/mips/src/mips32/up_unblocktask.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/mips/src/mips32/up_unblocktask.c
*
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,9 @@
#include <nuttx/config.h>
#include <sched.h>
+#include <syscall.h>
#include <debug.h>
+
#include <nuttx/arch.h>
#include "os_internal.h"