11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#include "src/codegen/s390/assembler-s390-inl.h" 61cb0ef41Sopenharmony_ci#include "src/diagnostics/eh-frame.h" 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cinamespace v8 { 91cb0ef41Sopenharmony_cinamespace internal { 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cistatic const int kR0DwarfCode = 0; 121cb0ef41Sopenharmony_cistatic const int kFpDwarfCode = 11; // frame-pointer 131cb0ef41Sopenharmony_cistatic const int kR14DwarfCode = 14; // return-address(lr) 141cb0ef41Sopenharmony_cistatic const int kSpDwarfCode = 15; // stack-pointer 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciconst int EhFrameConstants::kCodeAlignmentFactor = 2; // 1 or 2 in s390 171cb0ef41Sopenharmony_ciconst int EhFrameConstants::kDataAlignmentFactor = -8; 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_civoid EhFrameWriter::WriteReturnAddressRegisterCode() { 201cb0ef41Sopenharmony_ci WriteULeb128(kR14DwarfCode); 211cb0ef41Sopenharmony_ci} 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_civoid EhFrameWriter::WriteInitialStateInCie() { 241cb0ef41Sopenharmony_ci SetBaseAddressRegisterAndOffset(fp, 0); 251cb0ef41Sopenharmony_ci RecordRegisterNotModified(r14); 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci// static 291cb0ef41Sopenharmony_ciint EhFrameWriter::RegisterToDwarfCode(Register name) { 301cb0ef41Sopenharmony_ci switch (name.code()) { 311cb0ef41Sopenharmony_ci case kRegCode_fp: 321cb0ef41Sopenharmony_ci return kFpDwarfCode; 331cb0ef41Sopenharmony_ci case kRegCode_r14: 341cb0ef41Sopenharmony_ci return kR14DwarfCode; 351cb0ef41Sopenharmony_ci case kRegCode_sp: 361cb0ef41Sopenharmony_ci return kSpDwarfCode; 371cb0ef41Sopenharmony_ci case kRegCode_r0: 381cb0ef41Sopenharmony_ci return kR0DwarfCode; 391cb0ef41Sopenharmony_ci default: 401cb0ef41Sopenharmony_ci UNIMPLEMENTED(); 411cb0ef41Sopenharmony_ci } 421cb0ef41Sopenharmony_ci} 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ci#ifdef ENABLE_DISASSEMBLER 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci// static 471cb0ef41Sopenharmony_ciconst char* EhFrameDisassembler::DwarfRegisterCodeToString(int code) { 481cb0ef41Sopenharmony_ci switch (code) { 491cb0ef41Sopenharmony_ci case kFpDwarfCode: 501cb0ef41Sopenharmony_ci return "fp"; 511cb0ef41Sopenharmony_ci case kR14DwarfCode: 521cb0ef41Sopenharmony_ci return "lr"; 531cb0ef41Sopenharmony_ci case kSpDwarfCode: 541cb0ef41Sopenharmony_ci return "sp"; 551cb0ef41Sopenharmony_ci default: 561cb0ef41Sopenharmony_ci UNIMPLEMENTED(); 571cb0ef41Sopenharmony_ci } 581cb0ef41Sopenharmony_ci} 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ci#endif 611cb0ef41Sopenharmony_ci 621cb0ef41Sopenharmony_ci} // namespace internal 631cb0ef41Sopenharmony_ci} // namespace v8 64