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

Unified Diff: src/arm/simulator-arm.h

Issue 1523030: Add checks to the ARM simulator to ensure that we flush the icache all... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/cpu-arm.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/simulator-arm.h
===================================================================
--- src/arm/simulator-arm.h (revision 4442)
+++ src/arm/simulator-arm.h (working copy)
@@ -89,11 +89,43 @@
#include "constants-arm.h"
+#include "hashmap.h"
namespace assembler {
namespace arm {
+class CachePage {
+ public:
+ static const int LINE_VALID = 0;
+ static const int LINE_INVALID = 1;
+
+ static const int kPageShift = 12;
+ static const int kPageSize = 1 << kPageShift;
+ static const int kPageMask = kPageSize - 1;
+ static const int kLineShift = 2; // The cache line is only 4 bytes right now.
+ static const int kLineLength = 1 << kLineShift;
+ static const int kLineMask = kLineLength - 1;
+
+ CachePage() {
+ memset(&validity_map_, LINE_INVALID, sizeof(validity_map_));
+ }
+
+ char* ValidityByte(int offset) {
+ return &validity_map_[offset >> kLineShift];
+ }
+
+ char* CachedData(int offset) {
+ return &data_[offset];
+ }
+
+ private:
+ char data_[kPageSize]; // The cached data.
+ static const int kValidityMapSize = kPageSize >> kLineShift;
+ char validity_map_[kValidityMapSize]; // One byte per line.
+};
+
+
class Simulator {
public:
friend class Debugger;
@@ -162,6 +194,9 @@
// Pop an address from the JS stack.
uintptr_t PopAddress();
+ // ICache checking.
+ static void FlushICache(void* start, size_t size);
+
private:
enum special_values {
// Known bad pc value to ensure that the simulator does not execute
@@ -239,6 +274,11 @@
// Executes one instruction.
void InstructionDecode(Instr* instr);
+ // ICache.
+ static void CheckICache(Instr* instr);
+ static void FlushOnePage(intptr_t start, int size);
+ static CachePage* GetCachePage(void* page);
+
// Runtime call support.
static void* RedirectExternalReference(void* external_function,
bool fp_return);
@@ -276,6 +316,9 @@
int icount_;
static bool initialized_;
+ // Icache simulation
+ static v8::internal::HashMap* i_cache_;
+
// Registered breakpoints.
Instr* break_pc_;
instr_t break_instr_;
« no previous file with comments | « src/arm/cpu-arm.cc ('k') | src/arm/simulator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698