summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Watson <davejwatson@fb.com>2018-04-10 10:55:45 -0700
committerGitHub <noreply@github.com>2018-04-10 10:55:45 -0700
commit729772149fcd72379e8118361c43e4632ffa3f01 (patch)
treed6c3020d8d8253a723965f2da77e3dd4a7b59e32 /include
parentb5cbcaee13233ddbc2e6a3fffe85374031f51000 (diff)
downloadlibunwind-729772149fcd72379e8118361c43e4632ffa3f01.tar.gz
aarch64: tune down size of unw_context_t and unw_cursor_t (#71)
aarch64 defines a huge __reserved field in sigcontext. Cut it down to only the used FP fields. unw_cursor_t can also be cut down a bit, while still maintaining some reserved space.
Diffstat (limited to 'include')
-rw-r--r--include/libunwind-aarch64.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/include/libunwind-aarch64.h b/include/libunwind-aarch64.h
index 85812e15..11e2a9c1 100644
--- a/include/libunwind-aarch64.h
+++ b/include/libunwind-aarch64.h
@@ -44,9 +44,13 @@ extern "C" {
leaving some slack for future expansion. Changing this value will
require recompiling all users of this library. Stack allocation is
relatively cheap and unwind-state copying is relatively rare, so we
- want to err on making it rather too big than too small. */
+ want to err on making it rather too big than too small.
-#define UNW_TDEP_CURSOR_LEN 512
+ Calculation is regs used (64 + 34) * 2 + 40 (bytes of rest of
+ cursor) + padding
+*/
+
+#define UNW_TDEP_CURSOR_LEN 250
typedef uint64_t unw_word_t;
typedef int64_t unw_sword_t;
@@ -169,8 +173,28 @@ typedef struct unw_tdep_save_loc
unw_tdep_save_loc_t;
-/* On AArch64, we can directly use ucontext_t as the unwind context. */
-typedef ucontext_t unw_tdep_context_t;
+/* On AArch64, we can directly use ucontext_t as the unwind context,
+ * however, the __reserved struct is quite large: tune it down to only
+ * the necessary used fields. */
+
+struct unw_sigcontext
+ {
+ uint64_t fault_address;
+ uint64_t regs[31];
+ uint64_t sp;
+ uint64_t pc;
+ uint64_t pstate;
+ uint8_t __reserved[(34 * 8)] __attribute__((__aligned__(16)));
+};
+
+typedef struct
+ {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ __sigset_t uc_sigmask;
+ struct unw_sigcontext uc_mcontext;
+ } unw_tdep_context_t;
#include "libunwind-common.h"
#include "libunwind-dynamic.h"