summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2013-05-19 16:25:09 +0000
committerandrew <andrew@FreeBSD.org>2013-05-19 16:25:09 +0000
commit0e0a417d2bcaf3630559ef3ff0ba356da3a6f4b4 (patch)
tree458457d6b04eba723811d3b685e04907205b541e /sys/arm
parentcd30dfafe0c269299f5800713f71069edf694b0d (diff)
downloadFreeBSD-src-0e0a417d2bcaf3630559ef3ff0ba356da3a6f4b4.zip
FreeBSD-src-0e0a417d2bcaf3630559ef3ff0ba356da3a6f4b4.tar.gz
Add a comment explaining why stack_capture is empty for EABI and clang.
While here add a comment pointing out that, while r11 is not the frame pointer on EABI as there is no frame pointer, it's value is unused so is safe.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/stack_machdep.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/arm/arm/stack_machdep.c b/sys/arm/arm/stack_machdep.c
index d335934..36a776a 100644
--- a/sys/arm/arm/stack_machdep.c
+++ b/sys/arm/arm/stack_machdep.c
@@ -36,6 +36,13 @@ __FBSDID("$FreeBSD$");
#include <machine/pcb.h>
#include <machine/stack.h>
+/*
+ * This code makes assumptions about the stack layout. These are correct
+ * when using APCS (the old ABI), but are no longer true with AAPCS and the
+ * ARM EABI. There is also an issue with clang and llvm when building for
+ * APCS where it lays out the stack incorrectly. Because of this we disable
+ * this when building for ARM EABI or when building with clang.
+ */
static void
stack_capture(struct stack *st, u_int32_t *frame)
{
@@ -61,6 +68,11 @@ stack_save_td(struct stack *st, struct thread *td)
if (TD_IS_RUNNING(td))
panic("stack_save_td: running");
+ /*
+ * This register, the frame pointer, is incorrect for the ARM EABI
+ * as it doesn't have a frame pointer, however it's value is not used
+ * when building for EABI.
+ */
frame = (u_int32_t *)td->td_pcb->un_32.pcb32_r11;
stack_zero(st);
stack_capture(st, frame);
OpenPOWER on IntegriCloud