Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// Copyright 2019 Google
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
 
15
#pragma once
16
 
17
#include "Crashlytics/Crashlytics/Helpers/FIRCLSFeatures.h"
18
#include "Crashlytics/Crashlytics/Unwind/Compact/FIRCLSCompactUnwind.h"
19
 
20
// Add some abstraction to compact unwinding, because compact
21
// unwinding is nearly identical between 32 and 64 bit
22
#if CLS_CPU_X86_64
23
 
24
#define CLS_X86_MODE_MASK UNWIND_X86_64_MODE_MASK
25
#define CLS_X86_MODE_BP_FRAME UNWIND_X86_64_MODE_RBP_FRAME
26
#define CLS_X86_MODE_STACK_IMMD UNWIND_X86_64_MODE_STACK_IMMD
27
#define CLS_X86_MODE_STACK_IND UNWIND_X86_64_MODE_STACK_IND
28
#define CLS_X86_MODE_DWARF UNWIND_X86_64_MODE_DWARF
29
 
30
#define CLS_X86_BP_FRAME_REGISTERS UNWIND_X86_64_RBP_FRAME_REGISTERS
31
#define CLS_X86_BP_FRAME_OFFSET UNWIND_X86_64_RBP_FRAME_OFFSET
32
 
33
#define CLS_X86_FRAMELESS_STACK_SIZE UNWIND_X86_64_FRAMELESS_STACK_SIZE
34
#define CLS_X86_FRAMELESS_STACK_ADJUST UNWIND_X86_64_FRAMELESS_STACK_ADJUST
35
#define CLS_X86_FRAMELESS_STACK_REG_COUNT UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT
36
#define CLS_X86_FRAMELESS_STACK_REG_PERMUTATION UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION
37
 
38
#define CLS_X86_DWARF_SECTION_OFFSET UNWIND_X86_64_DWARF_SECTION_OFFSET
39
 
40
#define CLS_X86_REG_RBP UNWIND_X86_64_REG_RBP
41
 
42
#else
43
 
44
#define CLS_X86_MODE_MASK UNWIND_X86_MODE_MASK
45
#define CLS_X86_MODE_BP_FRAME UNWIND_X86_MODE_EBP_FRAME
46
#define CLS_X86_MODE_STACK_IMMD UNWIND_X86_MODE_STACK_IMMD
47
#define CLS_X86_MODE_STACK_IND UNWIND_X86_MODE_STACK_IND
48
#define CLS_X86_MODE_DWARF UNWIND_X86_MODE_DWARF
49
 
50
#define CLS_X86_BP_FRAME_REGISTERS UNWIND_X86_RBP_FRAME_REGISTERS
51
#define CLS_X86_BP_FRAME_OFFSET UNWIND_X86_RBP_FRAME_OFFSET
52
 
53
#define CLS_X86_FRAMELESS_STACK_SIZE UNWIND_X86_FRAMELESS_STACK_SIZE
54
#define CLS_X86_FRAMELESS_STACK_ADJUST UNWIND_X86_FRAMELESS_STACK_ADJUST
55
#define CLS_X86_FRAMELESS_STACK_REG_COUNT UNWIND_X86_FRAMELESS_STACK_REG_COUNT
56
#define CLS_X86_FRAMELESS_STACK_REG_PERMUTATION UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION
57
 
58
#define CLS_X86_DWARF_SECTION_OFFSET UNWIND_X86_DWARF_SECTION_OFFSET
59
 
60
#define CLS_X86_REG_RBP UNWIND_X86_REG_EBP
61
 
62
#endif
63
 
64
#if CLS_COMPACT_UNWINDING_SUPPORTED
65
bool FIRCLSCompactUnwindComputeStackSize(const compact_unwind_encoding_t encoding,
66
                                         const uintptr_t functionStart,
67
                                         const bool indirect,
68
                                         uint32_t* const stackSize);
69
bool FIRCLSCompactUnwindDecompressPermutation(const compact_unwind_encoding_t encoding,
70
                                              uintptr_t permutatedRegisters[const static 6]);
71
bool FIRCLSCompactUnwindRestoreRegisters(compact_unwind_encoding_t encoding,
72
                                         FIRCLSThreadContext* registers,
73
                                         uint32_t stackSize,
74
                                         const uintptr_t savedRegisters[const static 6],
75
                                         uintptr_t* address);
76
#endif