diff --git a/base/include/arm/cpu/consts.h b/base/include/arm/cpu/consts.h
new file mode 100644
index 0000000000..39758f6ba5
--- /dev/null
+++ b/base/include/arm/cpu/consts.h
@@ -0,0 +1,27 @@
+/*
+ * \brief Constants definitions for the ARM architecture.
+ * \author Sebastian Sumpf
+ * \date 2014-02-20
+ */
+
+/*
+ * Copyright (C) 2011-2013 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _INCLUDE__ARM__CPU__CONSTS_H_
+#define _INCLUDE__ARM__CPU__CONSTS_H_
+
+#include
+
+namespace Abi {
+ /**
+ * On ARM a call (or branch) will not change the stack pointer, so we do not
+ * need stack adjustment
+ */
+ static constexpr Genode::size_t stack_adjustment() { return 0; }
+}
+
+#endif /* _INCLUDE__ARM__CPU__CONSTS_H_ */
diff --git a/base/include/base/thread.h b/base/include/base/thread.h
index 4f1799a7b4..7fbb96845a 100644
--- a/base/include/base/thread.h
+++ b/base/include/base/thread.h
@@ -59,6 +59,7 @@
#include
#include
#include
+#include
#include
#include
#include /* for 'Ram_dataspace_capability' type */
@@ -103,12 +104,12 @@ namespace Genode {
* Top of stack
*
* The alignment matches an initial stack frame, which is
- * sufficient for the AMD64 ABI (stack top + 8 is 16-byte
+ * sufficient for the AMD64 ABI (stack top + adjustment is 16-byte
* aligned).
*/
addr_t stack_top() const
{
- return ((addr_t)_stack & ~0xf) - sizeof(addr_t);
+ return ((addr_t)_stack & ~0xf) - Abi::stack_adjustment();
}
/**
diff --git a/base/include/x86/cpu/consts.h b/base/include/x86/cpu/consts.h
index 1b3d89b772..d8c6edef2a 100644
--- a/base/include/x86/cpu/consts.h
+++ b/base/include/x86/cpu/consts.h
@@ -14,6 +14,8 @@
#ifndef _INCLUDE__X86__CPU__CONSTS_H_
#define _INCLUDE__X86__CPU__CONSTS_H_
+#include
+
namespace X86 {
enum Eflags_masks {
@@ -32,4 +34,11 @@ namespace X86 {
}
+namespace Abi {
+ /**
+ * On x86 a call will result in a growth of the stack by machine word size
+ */
+ static constexpr Genode::size_t stack_adjustment() { return sizeof(Genode::addr_t); }
+}
+
#endif /* _INCLUDE__X86__CPU__CONSTS_H_ */