aboutsummaryrefslogtreecommitdiff
path: root/src/common/android/include/sys/ucontext.h
diff options
context:
space:
mode:
authorrmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-04-11 16:09:12 +0000
committerrmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2014-04-11 16:09:12 +0000
commit6594ac922cc1937a237b6ed9ef05b7b952bcd82e (patch)
treeafcbd76daacc02dbbb4ed782a935309b6ce23c3a /src/common/android/include/sys/ucontext.h
parentFill in CPU info in mini-dump for Arm64. (diff)
downloadbreakpad-6594ac922cc1937a237b6ed9ef05b7b952bcd82e.tar.xz
Add x64 version of getcontext.
Assembly code is derived in part from code in libunwind. Code tested on desktop linux (Android testing pending emulation support). BUG=346626 R=dannyb@google.com, thestig@chromium.org Review URL: https://breakpad.appspot.com/1454002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1311 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/android/include/sys/ucontext.h')
-rw-r--r--src/common/android/include/sys/ucontext.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/common/android/include/sys/ucontext.h b/src/common/android/include/sys/ucontext.h
index bfc22c44..df7019c4 100644
--- a/src/common/android/include/sys/ucontext.h
+++ b/src/common/android/include/sys/ucontext.h
@@ -175,6 +175,73 @@ typedef struct ucontext {
// Other fields are not used by Google Breakpad. Don't define them.
} ucontext_t;
+#elif defined(__x86_64__)
+enum {
+ REG_R8 = 0,
+ REG_R9,
+ REG_R10,
+ REG_R11,
+ REG_R12,
+ REG_R13,
+ REG_R14,
+ REG_R15,
+ REG_RDI,
+ REG_RSI,
+ REG_RBP,
+ REG_RBX,
+ REG_RDX,
+ REG_RAX,
+ REG_RCX,
+ REG_RSP,
+ REG_RIP,
+ REG_EFL,
+ REG_CSGSFS,
+ REG_ERR,
+ REG_TRAPNO,
+ REG_OLDMASK,
+ REG_CR2,
+ NGREG
+};
+
+// This struct is essentially the same as _fpstate in asm/sigcontext.h
+// except that the individual field names are chosen here to match the
+// ones used in breakpad for other x86_64 platforms.
+struct _libc_fpstate {
+ /* 64-bit FXSAVE format. */
+ uint16_t cwd;
+ uint16_t swd;
+ uint16_t ftw;
+ uint16_t fop;
+ uint64_t rip;
+ uint64_t rdp;
+ uint32_t mxcsr;
+ uint32_t mxcr_mask;
+ uint32_t _st[32]; // 128 bytes for the ST/MM registers 0-7
+ uint32_t _xmm[64]; // 256 bytes for the XMM registers 0-7
+ uint32_t padding[24]; // 96 bytes
+};
+
+typedef long greg_t;
+typedef greg_t gregset_t[NGREG];
+
+typedef struct _libc_fpstate* fpregset_t;
+
+typedef struct {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ uint64_t __reserved1[8];
+} mcontext_t;
+
+typedef struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext* uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ sigset_t uc_sigmask;
+ uint64_t __padding[15];
+ _libc_fpstate __fpregs_mem;
+} ucontext_t;
+
#else
# error "Unsupported Android CPU ABI!"
#endif