micro opt
This commit is contained in:
parent
9441309427
commit
a77d037db9
6 changed files with 14 additions and 15 deletions
|
@ -23,7 +23,7 @@ std::optional<std::string> breakpoint_memory::is_triggered() const
|
|||
uint16_t v = 0;
|
||||
|
||||
if (is_virtual)
|
||||
v = b->read(addr, word_mode, rm_cur, true, i_space);
|
||||
v = b->peek_word(addr);
|
||||
else
|
||||
v = b->read_physical(addr);
|
||||
|
||||
|
|
5
bus.cpp
5
bus.cpp
|
@ -242,7 +242,7 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
|
|||
{
|
||||
int run_mode = mode_selection == rm_cur ? c->getPSW_runmode() : c->getPSW_prev_runmode();
|
||||
|
||||
uint32_t m_offset = mmu_->calculate_physical_address(c, run_mode, addr_in, !peek_only, false, space);
|
||||
uint32_t m_offset = mmu_->calculate_physical_address(c, run_mode, addr_in, false, space);
|
||||
|
||||
uint32_t io_base = mmu_->get_io_base();
|
||||
bool is_io = m_offset >= io_base;
|
||||
|
@ -517,6 +517,7 @@ uint16_t bus::read(const uint16_t addr_in, const word_mode_t word_mode, const rm
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: this will fail for peek & odd addressing
|
||||
if (m_offset >= m->get_memory_size()) {
|
||||
if (peek_only) {
|
||||
TRACE("READ from %06o - out of range!", addr_in);
|
||||
|
@ -563,7 +564,7 @@ write_rc_t bus::write(const uint16_t addr_in, const word_mode_t word_mode, uint1
|
|||
if (mmu_->is_enabled() && (addr_in & 1) == 0 /* TODO remove this? */ && addr_in != ADDR_MMR0)
|
||||
mmu_->set_page_written_to(run_mode, d, apf);
|
||||
|
||||
uint32_t m_offset = mmu_->calculate_physical_address(c, run_mode, addr_in, true, true, space);
|
||||
uint32_t m_offset = mmu_->calculate_physical_address(c, run_mode, addr_in, true, space);
|
||||
|
||||
uint32_t io_base = mmu_->get_io_base();
|
||||
bool is_io = m_offset >= io_base;
|
||||
|
|
|
@ -148,7 +148,7 @@ void console_ncurses::panel_update_thread()
|
|||
uint16_t current_PC = c->getPC();
|
||||
memory_addresses_t rc = b->getMMU()->calculate_physical_address(run_mode, current_PC);
|
||||
|
||||
uint16_t current_instr = b->read_word(current_PC);
|
||||
uint16_t current_instr = b->peek_word(current_PC);
|
||||
|
||||
auto data = c->disassemble(current_PC);
|
||||
|
||||
|
|
|
@ -933,7 +933,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
|
|||
|
||||
for(int i=0; i<n; i++) {
|
||||
uint32_t cur_addr = addr + i * 2;
|
||||
int val = parts[2] == "v" ? b->read(cur_addr, wm_word, rm_cur, true) : b->read_physical(cur_addr);
|
||||
int val = parts[2] == "v" ? b->peek_word(cur_addr) : b->read_physical(cur_addr);
|
||||
|
||||
if (val == -1) {
|
||||
cnsl->put_string_lf(format("Can't read from %06o\n", cur_addr));
|
||||
|
|
16
mmu.cpp
16
mmu.cpp
|
@ -473,7 +473,7 @@ void mmu::verify_page_length(cpu *const c, const uint16_t virt_addr, const int r
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t mmu::calculate_physical_address(cpu *const c, const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const d_i_space_t space)
|
||||
uint32_t mmu::calculate_physical_address(cpu *const c, const int run_mode, const uint16_t a, const bool is_write, const d_i_space_t space)
|
||||
{
|
||||
uint32_t m_offset = a;
|
||||
|
||||
|
@ -490,17 +490,15 @@ uint32_t mmu::calculate_physical_address(cpu *const c, const int run_mode, const
|
|||
if ((getMMR3() & 16) == 0) // off is 18bit
|
||||
m_offset &= 0x3ffff;
|
||||
|
||||
if (trap_on_failure) [[likely]] {
|
||||
verify_page_access(c, a, run_mode, d, apf, is_write);
|
||||
verify_page_access(c, a, run_mode, d, apf, is_write);
|
||||
|
||||
// e.g. ram or i/o, not unmapped
|
||||
uint32_t io_base = get_io_base();
|
||||
bool is_io = m_offset >= io_base;
|
||||
// e.g. ram or i/o, not unmapped
|
||||
uint32_t io_base = get_io_base();
|
||||
bool is_io = m_offset >= io_base;
|
||||
|
||||
verify_access_valid(c, m_offset, run_mode, d, apf, is_io, is_write);
|
||||
verify_access_valid(c, m_offset, run_mode, d, apf, is_io, is_write);
|
||||
|
||||
verify_page_length(c, a, run_mode, d, apf, is_write);
|
||||
}
|
||||
verify_page_length(c, a, run_mode, d, apf, is_write);
|
||||
}
|
||||
|
||||
return m_offset;
|
||||
|
|
2
mmu.h
2
mmu.h
|
@ -94,7 +94,7 @@ public:
|
|||
|
||||
memory_addresses_t calculate_physical_address(const int run_mode, const uint16_t a) const;
|
||||
std::pair<trap_action_t, int> get_trap_action(const int run_mode, const bool d, const int apf, const bool is_write);
|
||||
uint32_t calculate_physical_address(cpu *const c, const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const d_i_space_t space);
|
||||
uint32_t calculate_physical_address(cpu *const c, const int run_mode, const uint16_t a, const bool is_write, const d_i_space_t space);
|
||||
|
||||
uint16_t getMMR0() const { return MMR0; }
|
||||
uint16_t getMMR1() const { return MMR1; }
|
||||
|
|
Loading…
Add table
Reference in a new issue