OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LIBRARY_H__ | 5 #ifndef LIBRARY_H__ |
6 #define LIBRARY_H__ | 6 #define LIBRARY_H__ |
7 | 7 |
8 #include <elf.h> | 8 #include <elf.h> |
9 #include <functional> | 9 #include <functional> |
10 #include <map> | 10 #include <map> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 *reinterpret_cast<T *>( | 112 *reinterpret_cast<T *>( |
113 reinterpret_cast<char *>(iter->second.start) + offset) = *value; | 113 reinterpret_cast<char *>(iter->second.start) + offset) = *value; |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 bool parseElf(); | 117 bool parseElf(); |
118 const Elf_Ehdr* getEhdr(); | 118 const Elf_Ehdr* getEhdr(); |
119 const Elf_Shdr* getSection(const string& section); | 119 const Elf_Shdr* getSection(const string& section); |
120 void makeWritable(bool state) const; | 120 void makeWritable(bool state) const; |
121 void patchSystemCalls(); | 121 void patchSystemCalls(); |
| 122 void patchSystemCallsInRange(char* start, char* stop, |
| 123 char** extraSpace, int* extraLength); |
122 bool isVDSO() const { return isVDSO_; } | 124 bool isVDSO() const { return isVDSO_; } |
123 | 125 |
124 protected: | 126 protected: |
125 bool parseSymbols(); | 127 bool parseSymbols(); |
126 | 128 |
127 private: | 129 private: |
128 class GreaterThan : public std::binary_function<Elf_Addr, Elf_Addr, bool> { | 130 class GreaterThan : public std::binary_function<Elf_Addr, Elf_Addr, bool> { |
129 // We create the RangeMap with a GreaterThan rather than the default | 131 // We create the RangeMap with a GreaterThan rather than the default |
130 // comparator, as that allows us to use lower_bound() to find memory | 132 // comparator, as that allows us to use lower_bound() to find memory |
131 // mappings. | 133 // mappings. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 RangeMap memory_ranges_; | 169 RangeMap memory_ranges_; |
168 bool valid_; | 170 bool valid_; |
169 bool isVDSO_; | 171 bool isVDSO_; |
170 char* asr_offset_; | 172 char* asr_offset_; |
171 int vsys_offset_; | 173 int vsys_offset_; |
172 Elf_Ehdr ehdr_; | 174 Elf_Ehdr ehdr_; |
173 SectionTable section_table_; | 175 SectionTable section_table_; |
174 SymbolTable symbols_; | 176 SymbolTable symbols_; |
175 char* image_; | 177 char* image_; |
176 size_t image_size_; | 178 size_t image_size_; |
177 static Maps* maps_; | 179 Maps* maps_; |
178 static char* __kernel_vsyscall; | 180 static char* __kernel_vsyscall; |
179 static char* __kernel_sigreturn; | 181 static char* __kernel_sigreturn; |
180 static char* __kernel_rt_sigreturn; | 182 static char* __kernel_rt_sigreturn; |
181 }; | 183 }; |
182 | 184 |
183 } // namespace | 185 } // namespace |
184 | 186 |
185 #endif // LIBRARY_H__ | 187 #endif // LIBRARY_H__ |
OLD | NEW |