[Barrelfish-users] [ARM] exception stacks should be 8 bytes aligned

Wang Nan wangnan0 at huawei.com
Thu May 30 12:25:19 CEST 2013


Hi,

Here I propose a small patch which adjust arm exception stacks.

You can try 'printf("0x%016llx", 0x12345678ULL)' in undef handler. ARM abi require stack be 8 bytes aligned, but original code setups 4 bytes gaps between 2 stacks, makes irq_stack and undef_stack
misaligned.

reference: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka4127.html


>From 9bc121e69f6846f9eb9db1d03f361d23577213af Mon Sep 17 00:00:00 2001
From: Wang Nan <wangnan0 at huawei.com>
Date: Wed, 29 May 2013 20:01:07 +0800
Subject: [PATCH 1/2] align exception stack with 8 bytes

---
 kernel/arch/armv7/exceptions.S    |   10 +++++-----
 kernel/arch/hi1380/startup_arch.c |    4 +---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/arch/armv7/exceptions.S b/kernel/arch/armv7/exceptions.S
index 427b8b1..fa75dad 100644
--- a/kernel/arch/armv7/exceptions.S
+++ b/kernel/arch/armv7/exceptions.S
@@ -40,27 +40,27 @@
 abt_stack:
         .space EXCEPTION_MODE_STACK_BYTES, 0
 abt_stack_top:
-        .space 4, 0
+        .space 8, 0

 irq_stack:
         .space EXCEPTION_MODE_STACK_BYTES, 0
 irq_stack_top:
-         .space 4, 0
+         .space 8, 0

 fiq_stack:
         .space EXCEPTION_MODE_STACK_BYTES, 0
 fiq_stack_top:
-         .space 4, 0
+         .space 8, 0

 undef_stack:
         .space EXCEPTION_MODE_STACK_BYTES, 0
 undef_stack_top:
-        .space 4, 0
+        .space 8, 0

 svc_stack:
         .space EXCEPTION_MODE_STACK_BYTES, 0
 svc_stack_top:
-        .space 4, 0
+        .space 8, 0

         //
         // System mode stack




More information about the Barrelfish-users mailing list