diff --git a/sys/arch/arm/arm32/genassym.cf b/sys/arch/arm/arm32/genassym.cf index ac1a5e3ed979..ed3f3ca06ce0 100644 --- a/sys/arch/arm/arm32/genassym.cf +++ b/sys/arch/arm/arm32/genassym.cf @@ -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_R0 offsetof(struct trapframe, tf_r0) 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 --git a/sys/arch/arm/include/arm32/frame.h b/sys/arch/arm/include/arm32/frame.h index 37c34dfa1d40..48a0a9ff7e98 100644 --- a/sys/arch/arm/include/arm32/frame.h +++ b/sys/arch/arm/include/arm32/frame.h @@ -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 @@ LOCK_CAS_DEBUG_LOCALS */ #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 @@ LOCK_CAS_DEBUG_LOCALS #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 @@ LOCK_CAS_DEBUG_LOCALS #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 @@ LOCK_CAS_DEBUG_LOCALS */ #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 @@ LOCK_CAS_DEBUG_LOCALS 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 @@ LOCK_CAS_DEBUG_LOCALS 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 */