ARMDefines.h revision 4302f85ab6d8737c6b44541ffb006b52010596f4
18584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen//===-- lldb_ARMDefines.h ---------------------------------------*- C++ -*-===// 28584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// 38584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// The LLVM Compiler Infrastructure 48584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// 58584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// This file is distributed under the University of Illinois Open Source 68584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// License. See LICENSE.TXT for details. 78584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// 88584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen//===----------------------------------------------------------------------===// 98584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 108584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#ifndef lldb_ARMDefines_h_ 118584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define lldb_ARMDefines_h_ 128584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 138584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#include "InstructionUtils.h" 148584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 158584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// Common defintions for the ARM/Thumb Instruction Set Architecture. 168584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 178584c92dc30415ebab70ef19a1b108137fd60944Johnny Chennamespace lldb_private { 188584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 194302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen// ARM conditions // Meaning (integer) Meaning (floating-point) Condition flags 204302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_EQ 0x0 // Equal Equal Z == 1 214302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_NE 0x1 // Not equal Not equal, or unordered Z == 0 224302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_CS 0x2 // Carry set >, ==, or unordered C == 1 238584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define COND_HS 0x2 244302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_CC 0x3 // Carry clear Less than C == 0 258584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define COND_LO 0x3 264302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_MI 0x4 // Minus, negative Less than N == 1 274302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_PL 0x5 // Plus, positive or zero >, ==, or unordered N == 0 284302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_VS 0x6 // Overflow Unordered V == 1 294302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_VC 0x7 // No overflow Not unordered V == 0 304302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_HI 0x8 // Unsigned higher Greater than, or unordered C == 1 and Z == 0 314302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_LS 0x9 // Unsigned lower or same Less than or equal C == 0 or Z == 1 324302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_GE 0xA // Greater than or equal Greater than or equal N == V 334302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_LT 0xB // Less than Less than, or unordered N != V 344302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_GT 0xC // Greater than Greater than Z == 0 and N == V 354302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_LE 0xD // Less than or equal <, ==, or unordered Z == 1 or N != V 364302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen#define COND_AL 0xE // Always (unconditional) Always (unconditional) Any 378584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define COND_UNCOND 0xF 388584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 394302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chenstatic inline const char *ARMCondCodeToString(uint32_t CC) 404302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen{ 414302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen switch (CC) { 424302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen default: assert(0 && "Unknown condition code"); 434302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_EQ: return "eq"; 444302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_NE: return "ne"; 454302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_HS: return "hs"; 464302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_LO: return "lo"; 474302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_MI: return "mi"; 484302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_PL: return "pl"; 494302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_VS: return "vs"; 504302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_VC: return "vc"; 514302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_HI: return "hi"; 524302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_LS: return "ls"; 534302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_GE: return "ge"; 544302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_LT: return "lt"; 554302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_GT: return "gt"; 564302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_LE: return "le"; 574302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen case COND_AL: return "al"; 584302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen } 594302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen} 604302f85ab6d8737c6b44541ffb006b52010596f4Johnny Chen 618584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen// Masks for CPSR 628584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_MODE_MASK (0x0000001fu) 638584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_T (1u << 5) 648584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_F (1u << 6) 658584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_I (1u << 7) 668584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_A (1u << 8) 678584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_E (1u << 9) 688584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_GE_MASK (0x000f0000u) 698584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_J (1u << 24) 708584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_Q (1u << 27) 718584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_V (1u << 28) 728584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_C (1u << 29) 738584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_Z (1u << 30) 748584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#define MASK_CPSR_N (1u << 31) 758584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 768584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen} // namespace lldb_private 778584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen 788584c92dc30415ebab70ef19a1b108137fd60944Johnny Chen#endif // lldb_ARMDefines_h_ 79