diff options
author | 2020-05-17 11:34:06 +0200 | |
---|---|---|
committer | 2020-05-17 11:34:27 +0200 | |
commit | 24edb599d1d342b47c83d9c21ee444ce2df38431 (patch) | |
tree | 05226bd1048f7c61fd05bbfd4759f532a947210e | |
parent | d99e8b17f97700217be27e558715de6e7e451af0 (diff) |
-sun4cmmu: Isolated memory logging behind a #define, nw
-rw-r--r-- | src/devices/machine/sun4c_mmu.cpp | 38 | ||||
-rw-r--r-- | src/devices/machine/sun4c_mmu.h | 4 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/devices/machine/sun4c_mmu.cpp b/src/devices/machine/sun4c_mmu.cpp index e24ab317b22..8e55308adbd 100644 --- a/src/devices/machine/sun4c_mmu.cpp +++ b/src/devices/machine/sun4c_mmu.cpp @@ -43,11 +43,13 @@ DEFINE_DEVICE_TYPE(SUN4C_MMU, sun4c_mmu_device, "sun4c_mmu", "Sun 4c MMU") #define LOG_CACHE_FILLS (1U << 22) #define LOG_PAGE_ENTRIES (1U << 23) +#if SUN4CMMU_LOG_MEM_ACCESSES +static FILE* s_mem_log = nullptr; +#endif + #define VERBOSE (0) #include "logmacro.h" -static FILE* s_mem_log = nullptr; - sun4_mmu_base_device::sun4_mmu_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , m_cpu(*this, finder_base::DUMMY_TAG) @@ -82,13 +84,17 @@ sun4c_mmu_device::sun4c_mmu_device(const machine_config &mconfig, const char *ta void sun4_mmu_base_device::device_stop() { +#if SUN4CMMU_LOG_MEM_ACCESSES fclose(s_mem_log); +#endif } void sun4_mmu_base_device::device_start() { +#if SUN4CMMU_LOG_MEM_ACCESSES s_mem_log = fopen("sun4c_mem.bin", "wb"); m_fpos = 0; +#endif m_type1_r.resolve_safe(0xffffffff); m_type1_w.resolve_safe(); @@ -841,17 +847,21 @@ uint32_t sun4_mmu_base_device::insn_data_r(const uint32_t offset, const uint32_t { if (cache_fetch<PERM_MODE>(entry, offset, masked_addr, cached_data, entry_index)) { - //uint32_t value = masked_addr | 0x80000000; - //fwrite(&value, 1, 4, s_mem_log); - //fwrite(&cached_data, 1, 4, s_mem_log); - //m_fpos += 8; +#if SUN4CMMU_LOG_MEM_ACCESSES + uint32_t value = masked_addr | 0x80000000; + fwrite(&value, 1, 4, s_mem_log); + fwrite(&cached_data, 1, 4, s_mem_log); + m_fpos += 8; +#endif return cached_data; } } - //uint32_t value = masked_addr | 0x80000000; - //fwrite(&value, 1, 4, s_mem_log); - //fwrite(&m_ram_ptr[masked_addr], 1, 4, s_mem_log); - //m_fpos += 8; +#if SUN4CMMU_LOG_MEM_ACCESSES + uint32_t value = masked_addr | 0x80000000; + fwrite(&value, 1, 4, s_mem_log); + fwrite(&m_ram_ptr[masked_addr], 1, 4, s_mem_log); + m_fpos += 8; +#endif return m_ram_ptr[masked_addr]; } else if (paddr >= 0x4000000 >> 2 && paddr < 0x10000000 >> 2) @@ -1003,9 +1013,11 @@ void sun4_mmu_base_device::insn_data_w(const uint32_t offset, const uint32_t dat } } COMBINE_DATA((m_ram_ptr + masked_addr)); - //fwrite(&masked_addr, 1, 4, s_mem_log); - //fwrite(&m_ram_ptr[masked_addr], 1, 4, s_mem_log); - //m_fpos += 8; +#if SUN4CMMU_LOG_MEM_ACCESSES + fwrite(&masked_addr, 1, 4, s_mem_log); + fwrite(&m_ram_ptr[masked_addr], 1, 4, s_mem_log); + m_fpos += 8; +#endif } else if (paddr >= 0x4000000 >> 2 && paddr < 0x10000000 >> 2) { diff --git a/src/devices/machine/sun4c_mmu.h b/src/devices/machine/sun4c_mmu.h index 09c9b3442ce..0d1fef802e2 100644 --- a/src/devices/machine/sun4c_mmu.h +++ b/src/devices/machine/sun4c_mmu.h @@ -15,6 +15,8 @@ #include "machine/ram.h" #include "machine/z80scc.h" +#define SUN4CMMU_LOG_MEM_ACCESSES (0) + class sun4_mmu_base_device : public device_t, public sparc_mmu_interface { public: @@ -198,7 +200,9 @@ protected: uint32_t m_ram_set_mask[4]; // Used for mirroring within 4 megabyte sets uint32_t m_ram_set_base[4]; uint32_t m_populated_ram_words; +#if SUN4CMMU_LOG_MEM_ACCESSES uint64_t m_fpos; +#endif emu_timer *m_reset_timer; bool m_log_mem; }; |