summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/cortexm3/up_saveusercontext.S
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/arm/src/cortexm3/up_saveusercontext.S')
-rwxr-xr-xnuttx/arch/arm/src/cortexm3/up_saveusercontext.S30
1 files changed, 16 insertions, 14 deletions
diff --git a/nuttx/arch/arm/src/cortexm3/up_saveusercontext.S b/nuttx/arch/arm/src/cortexm3/up_saveusercontext.S
index dee841959..2ca11aa28 100755
--- a/nuttx/arch/arm/src/cortexm3/up_saveusercontext.S
+++ b/nuttx/arch/arm/src/cortexm3/up_saveusercontext.S
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/cortexm3/up_saveusercontext.S
*
- * 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
@@ -39,7 +39,9 @@
#include <nuttx/config.h>
#include <arch/irq.h>
+
#include "nvic.h"
+#include "svcall.h"
/************************************************************************************
* Pre-processor Definitions
@@ -49,9 +51,9 @@
* Global Symbols
************************************************************************************/
- .syntax unified
+ .syntax unified
.thumb
- .file "up_saveusercontext.S"
+ .file "up_saveusercontext.S"
/************************************************************************************
* Macros
@@ -77,26 +79,26 @@
.text
.thumb_func
- .globl up_saveusercontext
- .type up_saveusercontext, function
+ .globl up_saveusercontext
+ .type up_saveusercontext, function
up_saveusercontext:
/* Perform the System call with R0=0 and R1=regs */
- mov r1, r0 /* R1: regs */
- mov r0, #0 /* R0: 0 means save context (also return value) */
- svc 0 /* Force synchronous SVCall (or Hard Fault) */
+ mov r1, r0 /* R1: regs */
+ mov r0, #SYS_save_context /* R0: save context (also return value) */
+ svc 0 /* Force synchronous SVCall (or Hard Fault) */
/* There are two return conditions. On the first return, R0 (the
* return value will be zero. On the second return we need to
* force R0 to be 1.
*/
- add r2, r1, #(4*REG_R0)
- mov r3, #1
- str r3, [r2, #0]
- bx lr /* "normal" return with r0=0 or
- * context switch with r0=1 */
- .size up_saveusercontext, .-up_saveusercontext
+ add r2, r1, #(4*REG_R0)
+ mov r3, #1
+ str r3, [r2, #0]
+ bx lr /* "normal" return with r0=0 or
+ * context switch with r0=1 */
+ .size up_saveusercontext, .-up_saveusercontext
.end