Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: courgette/disassembler_elf_32_arm.cc

Issue 222293002: Port to x64 Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/disassembler_elf_32_arm.h" 5 #include "courgette/disassembler_elf_32_arm.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 // Find the rel32 relocations. 379 // Find the rel32 relocations.
380 const uint8* p = start_pointer; 380 const uint8* p = start_pointer;
381 bool on_32bit = 1; // 32-bit ARM ops appear on 32-bit boundaries, so track it 381 bool on_32bit = 1; // 32-bit ARM ops appear on 32-bit boundaries, so track it
382 while (p < end_pointer) { 382 while (p < end_pointer) {
383 // Heuristic discovery of rel32 locations in instruction stream: are the 383 // Heuristic discovery of rel32 locations in instruction stream: are the
384 // next few bytes the start of an instruction containing a rel32 384 // next few bytes the start of an instruction containing a rel32
385 // addressing mode? 385 // addressing mode?
386 386
387 TypedRVAARM* rel32_rva = NULL; 387 TypedRVAARM* rel32_rva = NULL;
388 RVA target_rva; 388 RVA target_rva = 0;
389 bool found = false; 389 bool found = false;
390 390
391 // 16-bit thumb ops 391 // 16-bit thumb ops
392 if (!found && (p + 3) <= end_pointer) { 392 if (!found && (p + 3) <= end_pointer) {
393 uint16 pval = Read16LittleEndian(p); 393 uint16 pval = Read16LittleEndian(p);
394 if ((pval & 0xF000) == 0xD000) { 394 if ((pval & 0xF000) == 0xD000) {
395 RVA rva = static_cast<RVA>(p - adjust_pointer_to_rva); 395 RVA rva = static_cast<RVA>(p - adjust_pointer_to_rva);
396 396
397 rel32_rva = new TypedRVAARM(ARM_OFF8, rva); 397 rel32_rva = new TypedRVAARM(ARM_OFF8, rva);
398 if (!rel32_rva->ComputeRelativeTarget((uint8*) p)) { 398 if (!rel32_rva->ComputeRelativeTarget((uint8*) p)) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 // Move 2 bytes at a time, but track 32-bit boundaries 479 // Move 2 bytes at a time, but track 32-bit boundaries
480 p += 2; 480 p += 2;
481 on_32bit = ((on_32bit + 1) % 2) != 0; 481 on_32bit = ((on_32bit + 1) % 2) != 0;
482 } 482 }
483 } 483 }
484 484
485 return true; 485 return true;
486 } 486 }
487 487
488 } // namespace courgette 488 } // namespace courgette
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698