Index: include/frame.h =================================================================== --- include/frame.h (revision 253916) +++ include/frame.h (working copy) @@ -62,7 +62,7 @@ typedef struct trapframe { register_t tf_spsr; /* Zero on arm26 */ register_t tf_r0; - register_t tf_r1; + register_t tf_r1; register_t tf_r2; register_t tf_r3; register_t tf_r4; @@ -78,7 +78,8 @@ register_t tf_usr_lr; register_t tf_svc_sp; /* Not used on arm26 */ register_t tf_svc_lr; /* Not used on arm26 */ - register_t tf_pc; + register_t tf_pc; + register_t tf_pad; } trapframe_t; /* Register numbers */ Index: include/asmacros.h =================================================================== --- include/asmacros.h (revision 253916) +++ include/asmacros.h (working copy) @@ -63,6 +63,7 @@ */ #ifdef ARM_TP_ADDRESS #define PUSHFRAME \ + sub sp, sp, #4; /* Align the stack */ \ str lr, [sp, #-4]!; /* Push the return address */ \ sub sp, sp, #(4*17); /* Adjust the stack pointer */ \ stmia sp, {r0-r12}; /* Push the user mode registers */ \ @@ -78,6 +79,7 @@ str r1, [r0, #4]; #else #define PUSHFRAME \ + sub sp, sp, #4; /* Align the stack */ \ str lr, [sp, #-4]!; /* Push the return address */ \ sub sp, sp, #(4*17); /* Adjust the stack pointer */ \ stmia sp, {r0-r12}; /* Push the user mode registers */ \ @@ -100,7 +102,8 @@ ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \ mov r0, r0; /* NOP for previous instruction */ \ add sp, sp, #(4*17); /* Adjust the stack pointer */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ + ldr lr, [sp], #0x0004; /* Pull the return address */ \ + add sp, sp, #4 /* Align the stack */ #else #define PULLFRAME \ ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \ @@ -109,7 +112,8 @@ ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \ mov r0, r0; /* NOP for previous instruction */ \ add sp, sp, #(4*17); /* Adjust the stack pointer */ \ - ldr lr, [sp], #0x0004; /* Pull the return address */ + ldr lr, [sp], #0x0004; /* Pull the return address */ \ + add sp, sp, #4 /* Align the stack */ #endif /* @@ -133,6 +137,7 @@ orr r2, r2, #(PSR_SVC32_MODE); \ msr cpsr_c, r2; /* Punch into SVC mode */ \ mov r2, sp; /* Save SVC sp */ \ + sub sp, sp, #4; /* Align the stack */ \ str r0, [sp, #-4]!; /* Push return address */ \ str lr, [sp, #-4]!; /* Push SVC lr */ \ str r2, [sp, #-4]!; /* Push SVC sp */ \ @@ -168,6 +173,7 @@ orr r2, r2, #(PSR_SVC32_MODE); \ msr cpsr_c, r2; /* Punch into SVC mode */ \ mov r2, sp; /* Save SVC sp */ \ + sub sp, sp, #4; /* Align the stack */ \ str r0, [sp, #-4]!; /* Push return address */ \ str lr, [sp, #-4]!; /* Push SVC lr */ \ str r2, [sp, #-4]!; /* Push SVC sp */ \ @@ -209,6 +215,7 @@ #endif #if defined(__ARM_EABI__) #define UNWINDSVCFRAME \ + .pad #(4); /* Skip stack alignment */ \ .save {r13-r15}; /* Restore sp, lr, pc */ \ .pad #(2*4); /* Skip user sp and lr */ \ .save {r0-r12}; /* Restore r0-r12 */ \ Index: arm/vm_machdep.c =================================================================== --- arm/vm_machdep.c (revision 253916) +++ arm/vm_machdep.c (working copy) @@ -77,7 +77,7 @@ * struct switchframe must be a multiple of 8 for correct stack alignment */ CTASSERT(sizeof(struct switchframe) == 24); -CTASSERT(sizeof(struct trapframe) == 76); +CTASSERT(sizeof(struct trapframe) == 80); #ifndef NSFBUFS #define NSFBUFS (512 + maxusers * 16)