summaryrefslogtreecommitdiffstats
path: root/tools/memory_watcher/mini_disassembler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/memory_watcher/mini_disassembler.cc')
-rw-r--r--tools/memory_watcher/mini_disassembler.cc50
1 files changed, 25 insertions, 25 deletions
diff --git a/tools/memory_watcher/mini_disassembler.cc b/tools/memory_watcher/mini_disassembler.cc
index 6b1dec8..a5fcf54 100644
--- a/tools/memory_watcher/mini_disassembler.cc
+++ b/tools/memory_watcher/mini_disassembler.cc
@@ -1,10 +1,10 @@
/* Copyright (c) 2007, Google Inc.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
@@ -14,7 +14,7 @@
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -110,7 +110,7 @@ void MiniDisassembler::Initialize() {
InstructionType MiniDisassembler::ProcessPrefixes(unsigned char* start_byte,
unsigned int& size) {
- InstructionType instruction_type = IT_GENERIC;
+ InstructionType instruction_type = IT_GENERIC;
const Opcode& opcode = s_ia32_opcode_map_[0].table_[*start_byte];
switch (opcode.type_) {
@@ -121,14 +121,14 @@ InstructionType MiniDisassembler::ProcessPrefixes(unsigned char* start_byte,
operand_is_32_bits_ = !operand_default_is_32_bits_;
nochangeoperand:
case IT_PREFIX:
-
+
if (0xF2 == (*start_byte))
got_f2_prefix_ = true;
else if (0xF3 == (*start_byte))
got_f3_prefix_ = true;
else if (0x66 == (*start_byte))
got_66_prefix_ = true;
-
+
instruction_type = opcode.type_;
size ++;
// we got a prefix, so add one and check next byte
@@ -146,7 +146,7 @@ InstructionType MiniDisassembler::ProcessOpcode(unsigned char* start_byte,
const OpcodeTable& table = s_ia32_opcode_map_[table_index]; // Get our table
unsigned char current_byte = (*start_byte) >> table.shift_;
current_byte = current_byte & table.mask_; // Mask out the bits we will use
-
+
// Check whether the byte we have is inside the table we have.
if (current_byte < table.min_lim_ || current_byte > table.max_lim_) {
instruction_type_ = IT_UNKNOWN;
@@ -234,10 +234,10 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case AM_F: // EFLAGS register
case AM_X: // Memory addressed by the DS:SI register pair
case AM_Y: // Memory addressed by the ES:DI register pair
- case AM_IMPLICIT: // Parameter is implicit, occupies no space in
+ case AM_IMPLICIT: // Parameter is implicit, occupies no space in
// instruction
break;
-
+
// There is a ModR/M byte but it does not necessarily need
// to be decoded.
case AM_C: // reg field of ModR/M selects a control register
@@ -250,20 +250,20 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case AM_V: // reg field of ModR/M selects a 128-bit XMM register
have_modrm_ = true;
break;
-
+
// In these addressing modes, there is a ModR/M byte and it needs to be
// decoded. No other (e.g. immediate) params than indicated in ModR/M.
- case AM_E: // Operand is either a general-purpose register or memory,
+ case AM_E: // Operand is either a general-purpose register or memory,
// specified by ModR/M byte
case AM_M: // ModR/M byte will refer only to memory
- case AM_Q: // Operand is either an MMX register or memory (complex
+ case AM_Q: // Operand is either an MMX register or memory (complex
// evaluation), specified by ModR/M byte
- case AM_W: // Operand is either a 128-bit XMM register or memory (complex
+ case AM_W: // Operand is either a 128-bit XMM register or memory (complex
// eval), specified by ModR/M byte
have_modrm_ = true;
should_decode_modrm_ = true;
break;
-
+
// These addressing modes specify an immediate or an offset value
// directly, so we need to look at the operand type to see how many
// bytes.
@@ -286,7 +286,7 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case OT_DQ: // Double-quadword, regardless of operand-size attribute.
operand_bytes_ += OS_DOUBLE_QUAD_WORD;
break;
- case OT_P: // 32-bit or 48-bit pointer, depending on operand-size
+ case OT_P: // 32-bit or 48-bit pointer, depending on operand-size
// attribute.
if (operand_is_32_bits_)
operand_bytes_ += OS_48_BIT_POINTER;
@@ -307,9 +307,9 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
operand_bytes_ += OS_DOUBLE_PRECISION_FLOATING;
break;
case OT_SS:
- // Scalar element of a 128-bit packed single-precision
+ // Scalar element of a 128-bit packed single-precision
// floating data.
- // We simply return enItUnknown since we don't have to support
+ // We simply return enItUnknown since we don't have to support
// floating point
succeeded = false;
break;
@@ -322,19 +322,19 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
case OT_W: // Word, regardless of operand-size attribute.
operand_bytes_ += OS_WORD;
break;
-
+
// Can safely ignore these.
- case OT_A: // Two one-word operands in memory or two double-word
+ case OT_A: // Two one-word operands in memory or two double-word
// operands in memory
case OT_PI: // Quadword MMX technology register (e.g. mm0)
case OT_SI: // Doubleword integer register (e.g., eax)
break;
-
+
default:
break;
}
break;
-
+
default:
break;
}
@@ -342,7 +342,7 @@ bool MiniDisassembler::ProcessOperand(int flag_operand) {
return succeeded;
}
-bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
+bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
unsigned int& size) {
// If we don't need to decode, we just return the size of the ModR/M
// byte (there is never a SIB byte in this case).
@@ -372,7 +372,7 @@ bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
// Invariant: modrm_entry points to information that we need to decode
// the ModR/M byte.
-
+
// Add to the count of operand bytes, if the ModR/M byte indicates
// that some operands are encoded in the instruction.
if (modrm_entry->is_encoded_in_instruction_)
@@ -389,8 +389,8 @@ bool MiniDisassembler::ProcessModrm(unsigned char* start_byte,
}
}
-bool MiniDisassembler::ProcessSib(unsigned char* start_byte,
- unsigned char mod,
+bool MiniDisassembler::ProcessSib(unsigned char* start_byte,
+ unsigned char mod,
unsigned int& size) {
// get the mod field from the 2..0 bits of the SIB byte
unsigned char sib_base = (*start_byte) & 0x07;