diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-18 15:28:23 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-18 15:28:23 +0000 |
commit | f43b9a694d227c9a261ed599190d5341c8e8b30c (patch) | |
tree | 42ad5748fc6801e7828c63a4fd803c4ad8473131 /nuttx/arch/c5471/src/up_saveusercontext.S | |
parent | e3940eb2080711edac189cca3f642ee89dc215f2 (diff) | |
download | px4-nuttx-f43b9a694d227c9a261ed599190d5341c8e8b30c.tar.gz px4-nuttx-f43b9a694d227c9a261ed599190d5341c8e8b30c.tar.bz2 px4-nuttx-f43b9a694d227c9a261ed599190d5341c8e8b30c.zip |
Fix problems in state restore logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/c5471/src/up_saveusercontext.S')
-rw-r--r-- | nuttx/arch/c5471/src/up_saveusercontext.S | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/nuttx/arch/c5471/src/up_saveusercontext.S b/nuttx/arch/c5471/src/up_saveusercontext.S index b9a9c2501..142f3660f 100644 --- a/nuttx/arch/c5471/src/up_saveusercontext.S +++ b/nuttx/arch/c5471/src/up_saveusercontext.S @@ -89,29 +89,27 @@ up_saveusercontext: */ mov ip, #1 - str ip, [r0, #JB_R0] + str ip, [r0, #(4*REG_R0)] - /* Get the offset to the user save area */ + /* Save the volatile registers (plus r12 which really + * doesn't need to be saved) + */ - add r0, r0, #XCPTCONTEXT_UOFFSET + add r1, r0, #(4*REG_R4) + stmia r1, {r4-r14} - /* Get the current cpsr as well */ + /* Save the current cpsr */ - mrs r3, cpsr /* R3 = CPSR value */ + mrs r2, cpsr /* R3 = CPSR value */ + add r1, r0, #(4*REG_CPSR) + str r2, [r1] - /* We need to save: - * - * Volatile register: r3 (holds the cpsr value) - * Static registers: v1-v7 (aka r4-r10) - * Frame pointer: fp (aka r11) - * Stack pointer: sp (aka r13) - * Return address: lr (aka r14) - * - * These have to be save in the same order as is done - * by the interrupt handling logic. + /* Finally save the return address as the PC so that we + * return to the exit from this function. */ - stmia r0, {r3-r11, r13-r14} + add r1, r0, #(4*REG_PC) + str lr, [r1] /* Return 0 */ |