-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-REIDS-APPLE-SILCON-CHIP.patch
82 lines (82 loc) · 3.58 KB
/
03-REIDS-APPLE-SILCON-CHIP.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff --git a/src/debug.c b/src/debug.c
index 1ecb251bd..0226f0770 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -662,8 +662,11 @@ static void *getMcontextEip(ucontext_t *uc) {
/* OSX >= 10.6 */
#if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
return (void*) uc->uc_mcontext->__ss.__rip;
- #else
+ #elif defined(__i386__)
return (void*) uc->uc_mcontext->__ss.__eip;
+ #else
+ /* OSX ARM64 APPLE SILCON CHIP */
+ return (void*) arm_thread_state64_get_pc(uc->uc_mcontext->__ss);
#endif
#elif defined(__linux__)
/* Linux */
@@ -731,7 +734,7 @@ void logRegisters(ucontext_t *uc) {
(unsigned long) uc->uc_mcontext->__ss.__gs
);
logStackContent((void**)uc->uc_mcontext->__ss.__rsp);
- #else
+ #elif defined(__i386__)
/* OSX x86 */
serverLog(LL_WARNING,
"\n"
@@ -757,6 +760,55 @@ void logRegisters(ucontext_t *uc) {
(unsigned long) uc->uc_mcontext->__ss.__gs
);
logStackContent((void**)uc->uc_mcontext->__ss.__esp);
+ #else
+ /* OSX ARM64 APPLE SILCON CHIP */
+ serverLog(LL_WARNING,
+ "\n"
+ "x0:%016lx x1:%016lx x2:%016lx x3:%016lx\n"
+ "x4:%016lx x5:%016lx x6:%016lx x7:%016lx\n"
+ "x8:%016lx x9:%016lx x10:%016lx x11:%016lx\n"
+ "x12:%016lx x13:%016lx x14:%016lx x15:%016lx\n"
+ "x16:%016lx x17:%016lx x18:%016lx x19:%016lx\n"
+ "x20:%016lx x21:%016lx x22:%016lx x23:%016lx\n"
+ "x24:%016lx x25:%016lx x26:%016lx x27:%016lx\n"
+ "x28:%016lx fp:%016lx lr:%016lx\n"
+ "sp:%016lx pc:%016lx cpsr:%08lx\n",
+ (unsigned long) uc->uc_mcontext->__ss.__x[0],
+ (unsigned long) uc->uc_mcontext->__ss.__x[1],
+ (unsigned long) uc->uc_mcontext->__ss.__x[2],
+ (unsigned long) uc->uc_mcontext->__ss.__x[3],
+ (unsigned long) uc->uc_mcontext->__ss.__x[4],
+ (unsigned long) uc->uc_mcontext->__ss.__x[5],
+ (unsigned long) uc->uc_mcontext->__ss.__x[6],
+ (unsigned long) uc->uc_mcontext->__ss.__x[7],
+ (unsigned long) uc->uc_mcontext->__ss.__x[8],
+ (unsigned long) uc->uc_mcontext->__ss.__x[9],
+ (unsigned long) uc->uc_mcontext->__ss.__x[10],
+ (unsigned long) uc->uc_mcontext->__ss.__x[11],
+ (unsigned long) uc->uc_mcontext->__ss.__x[12],
+ (unsigned long) uc->uc_mcontext->__ss.__x[13],
+ (unsigned long) uc->uc_mcontext->__ss.__x[14],
+ (unsigned long) uc->uc_mcontext->__ss.__x[15],
+ (unsigned long) uc->uc_mcontext->__ss.__x[16],
+ (unsigned long) uc->uc_mcontext->__ss.__x[17],
+ (unsigned long) uc->uc_mcontext->__ss.__x[18],
+ (unsigned long) uc->uc_mcontext->__ss.__x[19],
+ (unsigned long) uc->uc_mcontext->__ss.__x[20],
+ (unsigned long) uc->uc_mcontext->__ss.__x[21],
+ (unsigned long) uc->uc_mcontext->__ss.__x[22],
+ (unsigned long) uc->uc_mcontext->__ss.__x[23],
+ (unsigned long) uc->uc_mcontext->__ss.__x[24],
+ (unsigned long) uc->uc_mcontext->__ss.__x[25],
+ (unsigned long) uc->uc_mcontext->__ss.__x[26],
+ (unsigned long) uc->uc_mcontext->__ss.__x[27],
+ (unsigned long) uc->uc_mcontext->__ss.__x[28],
+ (unsigned long) arm_thread_state64_get_fp(uc->uc_mcontext->__ss),
+ (unsigned long) arm_thread_state64_get_lr(uc->uc_mcontext->__ss),
+ (unsigned long) arm_thread_state64_get_sp(uc->uc_mcontext->__ss),
+ (unsigned long) arm_thread_state64_get_pc(uc->uc_mcontext->__ss),
+ (unsigned long) uc->uc_mcontext->__ss.__cpsr
+ );
+ logStackContent((void**) arm_thread_state64_get_sp(uc->uc_mcontext->__ss));
#endif
/* Linux */
#elif defined(__linux__)