17aa51b79SEd Maste //===-- RegisterContextFreeBSD_powerpc.cpp ----------------------*- C++ -*-===// 27aa51b79SEd Maste // 37aa51b79SEd Maste // The LLVM Compiler Infrastructure 47aa51b79SEd Maste // 57aa51b79SEd Maste // This file is distributed under the University of Illinois Open Source 67aa51b79SEd Maste // License. See LICENSE.TXT for details. 77aa51b79SEd Maste // 87aa51b79SEd Maste //===---------------------------------------------------------------------===// 97aa51b79SEd Maste 107aa51b79SEd Maste #include "RegisterContextFreeBSD_powerpc.h" 11*435933ddSDimitry Andric #include "RegisterContextPOSIX_powerpc.h" 12*435933ddSDimitry Andric #include <vector> 137aa51b79SEd Maste 147aa51b79SEd Maste using namespace lldb_private; 157aa51b79SEd Maste using namespace lldb; 167aa51b79SEd Maste 177aa51b79SEd Maste // http://svnweb.freebsd.org/base/head/sys/powerpc/include/reg.h 18*435933ddSDimitry Andric typedef struct _GPR64 { 197aa51b79SEd Maste uint64_t r0; 207aa51b79SEd Maste uint64_t r1; 217aa51b79SEd Maste uint64_t r2; 227aa51b79SEd Maste uint64_t r3; 237aa51b79SEd Maste uint64_t r4; 247aa51b79SEd Maste uint64_t r5; 257aa51b79SEd Maste uint64_t r6; 267aa51b79SEd Maste uint64_t r7; 277aa51b79SEd Maste uint64_t r8; 287aa51b79SEd Maste uint64_t r9; 297aa51b79SEd Maste uint64_t r10; 307aa51b79SEd Maste uint64_t r11; 317aa51b79SEd Maste uint64_t r12; 327aa51b79SEd Maste uint64_t r13; 337aa51b79SEd Maste uint64_t r14; 347aa51b79SEd Maste uint64_t r15; 357aa51b79SEd Maste uint64_t r16; 367aa51b79SEd Maste uint64_t r17; 377aa51b79SEd Maste uint64_t r18; 387aa51b79SEd Maste uint64_t r19; 397aa51b79SEd Maste uint64_t r20; 407aa51b79SEd Maste uint64_t r21; 417aa51b79SEd Maste uint64_t r22; 427aa51b79SEd Maste uint64_t r23; 437aa51b79SEd Maste uint64_t r24; 447aa51b79SEd Maste uint64_t r25; 457aa51b79SEd Maste uint64_t r26; 467aa51b79SEd Maste uint64_t r27; 477aa51b79SEd Maste uint64_t r28; 487aa51b79SEd Maste uint64_t r29; 497aa51b79SEd Maste uint64_t r30; 507aa51b79SEd Maste uint64_t r31; 517aa51b79SEd Maste uint64_t lr; 527aa51b79SEd Maste uint64_t cr; 537aa51b79SEd Maste uint64_t xer; 547aa51b79SEd Maste uint64_t ctr; 557aa51b79SEd Maste uint64_t pc; 567aa51b79SEd Maste } GPR64; 577aa51b79SEd Maste 58*435933ddSDimitry Andric typedef struct _GPR32 { 597aa51b79SEd Maste uint32_t r0; 607aa51b79SEd Maste uint32_t r1; 617aa51b79SEd Maste uint32_t r2; 627aa51b79SEd Maste uint32_t r3; 637aa51b79SEd Maste uint32_t r4; 647aa51b79SEd Maste uint32_t r5; 657aa51b79SEd Maste uint32_t r6; 667aa51b79SEd Maste uint32_t r7; 677aa51b79SEd Maste uint32_t r8; 687aa51b79SEd Maste uint32_t r9; 697aa51b79SEd Maste uint32_t r10; 707aa51b79SEd Maste uint32_t r11; 717aa51b79SEd Maste uint32_t r12; 727aa51b79SEd Maste uint32_t r13; 737aa51b79SEd Maste uint32_t r14; 747aa51b79SEd Maste uint32_t r15; 757aa51b79SEd Maste uint32_t r16; 767aa51b79SEd Maste uint32_t r17; 777aa51b79SEd Maste uint32_t r18; 787aa51b79SEd Maste uint32_t r19; 797aa51b79SEd Maste uint32_t r20; 807aa51b79SEd Maste uint32_t r21; 817aa51b79SEd Maste uint32_t r22; 827aa51b79SEd Maste uint32_t r23; 837aa51b79SEd Maste uint32_t r24; 847aa51b79SEd Maste uint32_t r25; 857aa51b79SEd Maste uint32_t r26; 867aa51b79SEd Maste uint32_t r27; 877aa51b79SEd Maste uint32_t r28; 887aa51b79SEd Maste uint32_t r29; 897aa51b79SEd Maste uint32_t r30; 907aa51b79SEd Maste uint32_t r31; 917aa51b79SEd Maste uint32_t lr; 927aa51b79SEd Maste uint32_t cr; 937aa51b79SEd Maste uint32_t xer; 947aa51b79SEd Maste uint32_t ctr; 957aa51b79SEd Maste uint32_t pc; 967aa51b79SEd Maste } GPR32; 977aa51b79SEd Maste 98*435933ddSDimitry Andric typedef struct _FPR { 997aa51b79SEd Maste uint64_t f0; 1007aa51b79SEd Maste uint64_t f1; 1017aa51b79SEd Maste uint64_t f2; 1027aa51b79SEd Maste uint64_t f3; 1037aa51b79SEd Maste uint64_t f4; 1047aa51b79SEd Maste uint64_t f5; 1057aa51b79SEd Maste uint64_t f6; 1067aa51b79SEd Maste uint64_t f7; 1077aa51b79SEd Maste uint64_t f8; 1087aa51b79SEd Maste uint64_t f9; 1097aa51b79SEd Maste uint64_t f10; 1107aa51b79SEd Maste uint64_t f11; 1117aa51b79SEd Maste uint64_t f12; 1127aa51b79SEd Maste uint64_t f13; 1137aa51b79SEd Maste uint64_t f14; 1147aa51b79SEd Maste uint64_t f15; 1157aa51b79SEd Maste uint64_t f16; 1167aa51b79SEd Maste uint64_t f17; 1177aa51b79SEd Maste uint64_t f18; 1187aa51b79SEd Maste uint64_t f19; 1197aa51b79SEd Maste uint64_t f20; 1207aa51b79SEd Maste uint64_t f21; 1217aa51b79SEd Maste uint64_t f22; 1227aa51b79SEd Maste uint64_t f23; 1237aa51b79SEd Maste uint64_t f24; 1247aa51b79SEd Maste uint64_t f25; 1257aa51b79SEd Maste uint64_t f26; 1267aa51b79SEd Maste uint64_t f27; 1277aa51b79SEd Maste uint64_t f28; 1287aa51b79SEd Maste uint64_t f29; 1297aa51b79SEd Maste uint64_t f30; 1307aa51b79SEd Maste uint64_t f31; 1317aa51b79SEd Maste uint64_t fpscr; 1327aa51b79SEd Maste } FPR; 1337aa51b79SEd Maste 134*435933ddSDimitry Andric typedef struct _VMX { 1351c3bbb01SEd Maste uint32_t v0[4]; 1361c3bbb01SEd Maste uint32_t v1[4]; 1371c3bbb01SEd Maste uint32_t v2[4]; 1381c3bbb01SEd Maste uint32_t v3[4]; 1391c3bbb01SEd Maste uint32_t v4[4]; 1401c3bbb01SEd Maste uint32_t v5[4]; 1411c3bbb01SEd Maste uint32_t v6[4]; 1421c3bbb01SEd Maste uint32_t v7[4]; 1431c3bbb01SEd Maste uint32_t v8[4]; 1441c3bbb01SEd Maste uint32_t v9[4]; 1451c3bbb01SEd Maste uint32_t v10[4]; 1461c3bbb01SEd Maste uint32_t v11[4]; 1471c3bbb01SEd Maste uint32_t v12[4]; 1481c3bbb01SEd Maste uint32_t v13[4]; 1491c3bbb01SEd Maste uint32_t v14[4]; 1501c3bbb01SEd Maste uint32_t v15[4]; 1511c3bbb01SEd Maste uint32_t v16[4]; 1521c3bbb01SEd Maste uint32_t v17[4]; 1531c3bbb01SEd Maste uint32_t v18[4]; 1541c3bbb01SEd Maste uint32_t v19[4]; 1551c3bbb01SEd Maste uint32_t v20[4]; 1561c3bbb01SEd Maste uint32_t v21[4]; 1571c3bbb01SEd Maste uint32_t v22[4]; 1581c3bbb01SEd Maste uint32_t v23[4]; 1591c3bbb01SEd Maste uint32_t v24[4]; 1601c3bbb01SEd Maste uint32_t v25[4]; 1611c3bbb01SEd Maste uint32_t v26[4]; 1621c3bbb01SEd Maste uint32_t v27[4]; 1631c3bbb01SEd Maste uint32_t v28[4]; 1641c3bbb01SEd Maste uint32_t v29[4]; 1651c3bbb01SEd Maste uint32_t v30[4]; 1661c3bbb01SEd Maste uint32_t v31[4]; 1671c3bbb01SEd Maste uint32_t pad[2]; 1681c3bbb01SEd Maste uint32_t vrsave; 1691c3bbb01SEd Maste uint32_t vscr; 1701c3bbb01SEd Maste } VMX; 1711c3bbb01SEd Maste 1727aa51b79SEd Maste //--------------------------------------------------------------------------- 173*435933ddSDimitry Andric // Include RegisterInfos_powerpc to declare our g_register_infos_powerpc 174*435933ddSDimitry Andric // structure. 1757aa51b79SEd Maste //--------------------------------------------------------------------------- 1767aa51b79SEd Maste #define DECLARE_REGISTER_INFOS_POWERPC_STRUCT 1777aa51b79SEd Maste #include "RegisterInfos_powerpc.h" 1787aa51b79SEd Maste #undef DECLARE_REGISTER_INFOS_POWERPC_STRUCT 1797aa51b79SEd Maste RegisterContextFreeBSD_powerpc(const ArchSpec & target_arch)180*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc::RegisterContextFreeBSD_powerpc( 181*435933ddSDimitry Andric const ArchSpec &target_arch) 182*435933ddSDimitry Andric : RegisterInfoInterface(target_arch) {} 1837aa51b79SEd Maste ~RegisterContextFreeBSD_powerpc()184*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc::~RegisterContextFreeBSD_powerpc() {} 1857aa51b79SEd Maste GetGPRSize() const186*435933ddSDimitry Andricsize_t RegisterContextFreeBSD_powerpc::GetGPRSize() const { 1877aa51b79SEd Maste // This is an 'abstract' base, so no GPR struct. 1887aa51b79SEd Maste return 0; 1897aa51b79SEd Maste } 1907aa51b79SEd Maste GetRegisterInfo() const191*435933ddSDimitry Andricconst RegisterInfo *RegisterContextFreeBSD_powerpc::GetRegisterInfo() const { 1927aa51b79SEd Maste // assert (m_target_arch.GetCore() == ArchSpec::eCore_powerpc); 1937aa51b79SEd Maste llvm_unreachable("Abstract class!"); 1947aa51b79SEd Maste return NULL; 1957aa51b79SEd Maste } 1967aa51b79SEd Maste GetRegisterCount() const197*435933ddSDimitry Andricuint32_t RegisterContextFreeBSD_powerpc::GetRegisterCount() const { return 0; } 1987aa51b79SEd Maste RegisterContextFreeBSD_powerpc32(const ArchSpec & target_arch)199*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc32::RegisterContextFreeBSD_powerpc32( 200*435933ddSDimitry Andric const ArchSpec &target_arch) 201*435933ddSDimitry Andric : RegisterContextFreeBSD_powerpc(target_arch) {} 2027aa51b79SEd Maste ~RegisterContextFreeBSD_powerpc32()203*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc32::~RegisterContextFreeBSD_powerpc32() {} 2047aa51b79SEd Maste GetGPRSize() const205*435933ddSDimitry Andricsize_t RegisterContextFreeBSD_powerpc32::GetGPRSize() const { 2067aa51b79SEd Maste return sizeof(GPR32); 2077aa51b79SEd Maste } 2087aa51b79SEd Maste GetRegisterInfo() const209*435933ddSDimitry Andricconst RegisterInfo *RegisterContextFreeBSD_powerpc32::GetRegisterInfo() const { 2107aa51b79SEd Maste // assert (m_target_arch.GetCore() == ArchSpec::eCore_powerpc); 2117aa51b79SEd Maste return g_register_infos_powerpc32; 2127aa51b79SEd Maste } 2137aa51b79SEd Maste GetRegisterCount() const214*435933ddSDimitry Andricuint32_t RegisterContextFreeBSD_powerpc32::GetRegisterCount() const { 215*435933ddSDimitry Andric return static_cast<uint32_t>(sizeof(g_register_infos_powerpc32) / 216*435933ddSDimitry Andric sizeof(g_register_infos_powerpc32[0])); 2177aa51b79SEd Maste } 2187aa51b79SEd Maste RegisterContextFreeBSD_powerpc64(const ArchSpec & target_arch)219*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc64::RegisterContextFreeBSD_powerpc64( 220*435933ddSDimitry Andric const ArchSpec &target_arch) 221*435933ddSDimitry Andric : RegisterContextFreeBSD_powerpc(target_arch) {} 2227aa51b79SEd Maste ~RegisterContextFreeBSD_powerpc64()223*435933ddSDimitry AndricRegisterContextFreeBSD_powerpc64::~RegisterContextFreeBSD_powerpc64() {} 2247aa51b79SEd Maste GetGPRSize() const225*435933ddSDimitry Andricsize_t RegisterContextFreeBSD_powerpc64::GetGPRSize() const { 2267aa51b79SEd Maste return sizeof(GPR64); 2277aa51b79SEd Maste } 2287aa51b79SEd Maste GetRegisterInfo() const229*435933ddSDimitry Andricconst RegisterInfo *RegisterContextFreeBSD_powerpc64::GetRegisterInfo() const { 2307aa51b79SEd Maste // assert (m_target_arch.GetCore() == ArchSpec::eCore_powerpc); 2317aa51b79SEd Maste if (m_target_arch.GetMachine() == llvm::Triple::ppc) 2327aa51b79SEd Maste return g_register_infos_powerpc64_32; 2337aa51b79SEd Maste return g_register_infos_powerpc64; 2347aa51b79SEd Maste } 2357aa51b79SEd Maste GetRegisterCount() const236*435933ddSDimitry Andricuint32_t RegisterContextFreeBSD_powerpc64::GetRegisterCount() const { 237*435933ddSDimitry Andric return static_cast<uint32_t>(sizeof(g_register_infos_powerpc64) / 238*435933ddSDimitry Andric sizeof(g_register_infos_powerpc64[0])); 2397aa51b79SEd Maste } 240