Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm Change to use symbolic constants from assym.h a...



details:   https://anonhg.NetBSD.org/src/rev/127e78cd804a
branches:  trunk
changeset: 782218:127e78cd804a
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Oct 21 15:46:00 2012 +0000

description:
Change to use symbolic constants from assym.h and fix a typo in a comment.

diffstat:

 sys/arch/arm/arm32/genassym.cf     |   4 +++-
 sys/arch/arm/include/arm32/frame.h |  20 ++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diffs (96 lines):

diff -r 506283800756 -r 127e78cd804a sys/arch/arm/arm32/genassym.cf
--- a/sys/arch/arm/arm32/genassym.cf    Sun Oct 21 10:29:53 2012 +0000
+++ b/sys/arch/arm/arm32/genassym.cf    Sun Oct 21 15:46:00 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.55 2012/10/21 09:25:16 matt Exp $
+#      $NetBSD: genassym.cf,v 1.56 2012/10/21 15:46:00 matt Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -154,6 +154,8 @@
 define TF_R4                   offsetof(struct trapframe, tf_r4)
 define TF_R6                   offsetof(struct trapframe, tf_r6)
 define TF_R10                  offsetof(struct trapframe, tf_r10)
+define TF_USR_SP               offsetof(struct trapframe, tf_usr_sp)
+define TF_SVC_SP               offsetof(struct trapframe, tf_svc_sp)
 define TF_PC                   offsetof(struct trapframe, tf_pc)
 
 define PROCSIZE                sizeof(struct proc)
diff -r 506283800756 -r 127e78cd804a sys/arch/arm/include/arm32/frame.h
--- a/sys/arch/arm/include/arm32/frame.h        Sun Oct 21 10:29:53 2012 +0000
+++ b/sys/arch/arm/include/arm32/frame.h        Sun Oct 21 15:46:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frame.h,v 1.34 2012/10/21 09:25:16 matt Exp $  */
+/*     $NetBSD: frame.h,v 1.35 2012/10/21 15:46:00 matt Exp $  */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -323,7 +323,7 @@
  */
 #define        PUSHUSERREGS                                                       \
        stmia   sp, {r0-r12};           /* Push the user mode registers */ \
-       add     r0, sp, #(4*13);        /* Adjust the stack pointer */     \
+       add     r0, sp, #(TF_USR_SP-TF_R0); /* Adjust the stack pointer */ \
        stmia   r0, {r13-r14}^          /* Push the user mode registers */
 #else
 #define        PUSHUSERREGS                                                       \
@@ -332,11 +332,11 @@
 
 #define PUSHFRAME                                                         \
        str     lr, [sp, #-4]!;         /* Push the return address */      \
-       sub     sp, sp, #(4*17);        /* Adjust the stack pointer */     \
+       sub     sp, sp, #(TF_PC-TF_R0); /* Adjust the stack pointer */     \
        PUSHUSERREGS;                   /* Push the user mode registers */ \
        mov     r0, r0;                 /* NOP for previous instruction */ \
        mrs     r0, spsr_all;           /* Get the SPSR */                 \
-       str     r0, [sp, #-8]!          /* Push the SPSR on the stack */
+       str     r0, [sp, #-TF_R0]!      /* Push the SPSR on the stack */
 
 /*
  * Push a minimal trapframe so we can dispatch an interrupt from the
@@ -347,7 +347,7 @@
 #define PUSHIDLEFRAME                                                     \
        str     lr, [sp, #-4]!;         /* save SVC32 lr */                \
        str     r6, [sp, #(TF_R6-TF_PC)]!; /* save callee-saved r6 */      \
-       str     r4, [sp, #(TF_R4-TF_R6)]!; /* save callee-saved r6 */      \
+       str     r4, [sp, #(TF_R4-TF_R6)]!; /* save callee-saved r4 */      \
        mrs     r0, cpsr_all;           /* Get the CPSR */                 \
        str     r0, [sp, #(-TF_R4)]!    /* Push the CPSR on the stack */
 
@@ -357,11 +357,11 @@
  */
 
 #define PULLFRAME                                                         \
-       ldr     r0, [sp], #0x0008;      /* Pop the SPSR from stack */      \
+       ldr     r0, [sp], #TF_R0;       /* Pop the SPSR from stack */      \
        msr     spsr_all, r0;                                              \
        ldmia   sp, {r0-r14}^;          /* Restore registers (usr mode) */ \
        mov     r0, r0;                 /* NOP for previous instruction */ \
-       add     sp, sp, #(4*17);        /* Adjust the stack pointer */     \
+       add     sp, sp, #(TF_PC-TF_R0); /* Adjust the stack pointer */     \
        ldr     lr, [sp], #0x0004       /* Pop the return address */
 
 #define PULLIDLEFRAME                                                     \
@@ -404,11 +404,11 @@
        mov     sp, r2;                 /* Keep stack aligned */           \
        msr     spsr_all, r3;           /* Restore correct spsr */         \
        ldmdb   r1, {r0-r3};            /* Restore 4 regs from xxx mode */ \
-       sub     sp, sp, #(4*15);        /* Adjust the stack pointer */     \
+       sub     sp, sp, #(TF_SVC_SP-TF_R0); /* Adjust the stack pointer */ \
        PUSHUSERREGS;                   /* Push the user mode registers */ \
        mov     r0, r0;                 /* NOP for previous instruction */ \
        mrs     r0, spsr_all;           /* Get the SPSR */                 \
-       str     r0, [sp, #-8]!          /* Push the SPSR onto the stack */
+       str     r0, [sp, #-TF_R0]!      /* Push the SPSR onto the stack */
 
 /*
  * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack
@@ -422,7 +422,7 @@
        msr     spsr_all, r0;           /* restore SPSR */                 \
        ldmia   sp, {r0-r14}^;          /* Restore registers (usr mode) */ \
        mov     r0, r0;                 /* NOP for previous instruction */ \
-       add     sp, sp, #(4*15);        /* Adjust the stack pointer */     \
+       add     sp, sp, #(TF_SVC_SP-TF_R0); /* Adjust the stack pointer */ \
        ldmia   sp, {sp, lr, pc}^       /* Restore lr and exit */
 
 #endif /* _LOCORE */



Home | Main Index | Thread Index | Old Index