Commit efc8533f authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>

	* src/vm/mmu.hh: Hide instructions' access behind MMU.
	* src/vm/cpu.hh, src/vm/cpu.cc, src/vm/virtual_machine.hh:
	Use the MMU to access instructions.
parent 4e5012c9
2004-07-14 Benot Perrot <benoit@lrde.epita.fr>
* src/vm/mmu.hh: Hide instructions' access behind MMU.
* src/vm/cpu.hh, src/vm/cpu.cc, src/vm/virtual_machine.hh:
Use the MMU to access instructions.
2004-07-14 Benot Perrot <benoit@lrde.epita.fr>
* src/vm/memory.hh, src/vm/mmu.hh, src/vm/cpu.cc,
......
......@@ -463,7 +463,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
Cpu::visit(const inst::Jr& jr)
......@@ -477,7 +477,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
......@@ -491,7 +491,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
......@@ -507,7 +507,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
......@@ -526,7 +526,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
......@@ -540,7 +540,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
......@@ -556,7 +556,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
......@@ -575,7 +575,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
......@@ -589,7 +589,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
......@@ -605,7 +605,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
......@@ -619,7 +619,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
......@@ -638,7 +638,7 @@ namespace vm
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
......
......@@ -318,7 +318,7 @@ namespace vm
pipeline_[e_stage] = pipeline_[r_stage];
pipeline_[r_stage] = pipeline_[d_stage];
pipeline_[d_stage] = pipeline_[i_stage];
pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
pipeline_[e_stage]->accept(*this);
pc_ = pc_ + 4;
......
......@@ -85,14 +85,24 @@ namespace vm
/** \name Proxy for memory instruction access.
\{ */
public:
const inst::TextSection& inst() const
{
return *text_section_;
}
void inst_store(const inst::TextSection& text_section)
{
text_section_ = &text_section;
}
const inst::Inst & inst_load(int offset) const
{
return (*text_section_)[offset];
}
int inst_has_label(const std::string &label) const
{
return text_section_->has_label(inst::Label(label));
}
int inst_get_offset(const std::string &label) const
{
return text_section_->get_offset(inst::Label(label));
}
/** \} */
protected:
......
......@@ -99,13 +99,13 @@ namespace vm
/// Check if a label exists
bool has_label(const std::string& label) const
{
return mmu_.inst().has_label(inst::Label(label));
return mmu_.inst_has_label(label);
}
/// Return the offset of a label
int get_offset(const std::string& label) const
{
return mmu_.inst().get_offset(inst::Label(label));
return mmu_.inst_get_offset(label);
}
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment