107 panic(
"Unrecognized segment %d\n", segment);
113 uint64_t "ient, uint64_t &remainder)
116 assert(divisor != 0);
118 if (divisor <= dividend) {
122 int shift = dividendMsb - divisorMsb;
126 uint64_t quotientBit = 1;
127 quotientBit <<=
shift;
131 if (divisor > dividend) {
136 quotient += quotientBit;
137 remainder -= divisor;
145 static const char * abcdFormats[9] =
146 {
"",
"%s",
"%sx",
"",
"e%sx",
"",
"",
"",
"r%sx"};
147 static const char * piFormats[9] =
148 {
"",
"%s",
"%s",
"",
"e%s",
"",
"",
"",
"r%s"};
149 static const char * longFormats[9] =
150 {
"",
"r%sb",
"r%sw",
"",
"r%sd",
"",
"",
"",
"r%s"};
151 static const char * microFormats[9] =
152 {
"",
"t%db",
"t%dw",
"",
"t%dd",
"",
"",
"",
"t%d"};
156 switch (
reg.classValue()) {
159 const char * suffix =
"";
161 reg_idx &= ~IntFoldBit;
165 else if (reg_idx < 8 &&
size == 1)
219 reg_idx - int_reg::MicroBegin);
232 (reg_idx % 2) ?
"high":
"low");
253 panic(
"Unrecognized register class.");
260 uint64_t disp, uint8_t addressSize,
bool rip)
262 bool someAddr =
false;
297 std::stringstream
ss;
Register ID: describe an architectural register with its class and index.
const char * mnemonic
Base mnemonic (e.g., "add").
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
static void printMem(std::ostream &os, uint8_t segment, uint8_t scale, RegIndex index, RegIndex base, uint64_t disp, uint8_t addressSize, bool rip)
static void printSegment(std::ostream &os, int segment)
static void printMnemonic(std::ostream &os, const char *mnemonic)
static void divideStep(uint64_t divident, uint64_t divisor, uint64_t "ient, uint64_t &remainder)
static void printReg(std::ostream &os, RegId reg, int size)
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
#define panic(...)
This implements a cprintf based panic() function.
constexpr RegClass intRegClass
constexpr RegIndex IntFoldBit
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
@ FloatRegClass
Floating-point register.
@ CCRegClass
Condition-code register.
@ IntRegClass
Integer register.
@ MiscRegClass
Control (misc) register.
void ccprintf(cp::Print &print)