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.
This commit is contained in:
Andrew Turner 2013-05-19 16:25:09 +00:00
parent e3581df21e
commit 0d8d860f6e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250810

View File

@ -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);