13#include "DebugServer2/Base.h"
14#include "DebugServer2/Utils/CompilerSupport.h"
16#include <asm/unistd.h>
19#if defined(HAVE_SYS_PERSONALITY_H)
20#include <sys/personality.h>
22#include <sys/ptrace.h>
23#include <sys/syscall.h>
29#if defined(ARCH_ARM) && !defined(ARM_VFPREGS_SIZE)
30#define ARM_VFPREGS_SIZE (32 * 8 + 4)
33#if defined(ARCH_X86) || defined(ARCH_X86_64)
34static constexpr size_t x87Padding = 6;
43 uint64_t xfeatures_mask;
46} DS2_ATTRIBUTE_PACKED;
48#if !defined(NT_X86_XSTATE)
49#define NT_X86_XSTATE 0x202
63 uint8_t st_space[128];
66 uint8_t xmm_space[256];
78 YMMHighVector ymmh[16];
80} DS2_ATTRIBUTE_PACKED DS2_ATTRIBUTE_ALIGNED(64);
84#if !defined(HAVE_POSIX_OPENPT)
87static inline int posix_openpt(
int flags) { return ::open(
"/dev/ptmx", flags); }
93#if !defined(HAVE_GETTID)
95static inline pid_t gettid() { return ::syscall(SYS_gettid); }
98#if !defined(SYS_tkill)
99#define SYS_tkill __NR_tkill
102#if !defined(HAVE_TGKILL)
103#if !defined(SYS_tgkill)
104#define SYS_tgkill __NR_tgkill
107static inline int tgkill(pid_t pid, pid_t tid,
int signo) {
108 return ::syscall(SYS_tgkill, pid, tid, signo);
112static inline int tkill(pid_t tid,
int signo) {
113 return ::syscall(SYS_tkill, tid, signo);
116#if !defined(HAVE_SYS_PERSONALITY_H)
117#if !defined(SYS_personality)
118#define SYS_personality __NR_personality
121#if !defined(ADDR_NO_RANDOMIZE)
122#define ADDR_NO_RANDOMIZE 0x0040000
125static inline int personality(
unsigned long persona) {
126 return ::syscall(SYS_personality, persona);
131#if !defined(PTRACE_GETHBPREGS)
132#define PTRACE_GETHBPREGS 29
135#if !defined(PTRACE_SETHBPREGS)
136#define PTRACE_SETHBPREGS 30
140#if !defined(PTRACE_GETREGSET)
141#define PTRACE_GETREGSET 0x4204
144#if !defined(PTRACE_SETREGSET)
145#define PTRACE_SETREGSET 0x4205
149#if !defined(TRAP_BRKPT)
152#if !defined(TRAP_TRACE)
155#if !defined(TRAP_BRANCH)
158#if !defined(TRAP_HWBKPT)