OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/eh-frame.h" |
| 6 |
| 7 namespace v8 { |
| 8 namespace internal { |
| 9 |
| 10 static const int kRaxDwarfCode = 0; |
| 11 static const int kRbpDwarfCode = 6; |
| 12 static const int kRspDwarfCode = 7; |
| 13 static const int kRipDwarfCode = 16; |
| 14 |
| 15 STATIC_CONST_MEMBER_DEFINITION const int EhFrameWriter::kDataAlignmentFactor = |
| 16 -8; |
| 17 |
| 18 void EhFrameWriter::WriteReturnAddressRegisterCode() { |
| 19 WriteULEB128(16); // x64 rip (r16) has no Register instance associated. |
| 20 } |
| 21 |
| 22 void EhFrameWriter::WriteInitialState() { |
| 23 SetBaseAddressRegisterAndOffset(rsp, 8); |
| 24 RegisterSavedToStack(16, kInt64Size); // r16 is rip |
| 25 } |
| 26 |
| 27 // static |
| 28 const char* EhFrameWriter::DwarfRegisterCodeToString(int code) { |
| 29 switch (code) { |
| 30 case kRbpDwarfCode: |
| 31 return "rbp"; |
| 32 case kRspDwarfCode: |
| 33 return "rsp"; |
| 34 case kRipDwarfCode: |
| 35 return "rip"; |
| 36 default: |
| 37 UNIMPLEMENTED(); |
| 38 return nullptr; |
| 39 } |
| 40 } |
| 41 |
| 42 // static |
| 43 int EhFrameWriter::RegisterToDwarfCode(Register name) { |
| 44 switch (name.code()) { |
| 45 case Register::kCode_rbp: |
| 46 return kRbpDwarfCode; |
| 47 case Register::kCode_rsp: |
| 48 return kRspDwarfCode; |
| 49 case Register::kCode_rax: |
| 50 return kRaxDwarfCode; |
| 51 default: |
| 52 UNIMPLEMENTED(); |
| 53 return -1; |
| 54 } |
| 55 } |
| 56 |
| 57 } // namespace internal |
| 58 } // namespace v8 |
OLD | NEW |