From: Toni Wilen Date: Sat, 30 Jun 2018 10:12:44 +0000 (+0300) Subject: Use indirect directory harddrive/hdf access mode if debugger is active. X-Git-Tag: 4010~44 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c1cb6c97332c8cf345f46a2307ac68d4e1aa2861;p=francis%2Fwinuae.git Use indirect directory harddrive/hdf access mode if debugger is active. --- diff --git a/debugmem.cpp b/debugmem.cpp index 6c50fe2d..9b6cf2bb 100644 --- a/debugmem.cpp +++ b/debugmem.cpp @@ -47,7 +47,7 @@ static mem_put_func debugmem_func_lput; static mem_put_func debugmem_func_wput; static mem_put_func debugmem_func_bput; static xlate_func debugmem_func_xlate; -static bool debugmem_initialized; +bool debugmem_initialized; static bool debug_waiting; static uaecptr debug_task; static uae_u8 *exec_thistask; diff --git a/hardfile.cpp b/hardfile.cpp index 76e66cc5..5ae93ca2 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -1278,7 +1278,7 @@ static uae_u64 cmd_read(TrapContext *ctx, struct hardfiledata *hfd, uaecptr data { if (!len) return 0; - if (!ctx) { + if (!ctx && real_address_allowed()) { addrbank *bank_data = &get_mem_bank (dataptr); if (!bank_data || !bank_data->check (dataptr, len)) return 0; @@ -1311,7 +1311,7 @@ static uae_u64 cmd_write(TrapContext *ctx, struct hardfiledata *hfd, uaecptr dat { if (!len) return 0; - if (!ctx) { + if (!ctx && real_address_allowed()) { addrbank *bank_data = &get_mem_bank (dataptr); if (!bank_data || !bank_data->check (dataptr, len)) return 0; diff --git a/include/memory.h b/include/memory.h index da72299c..57c790aa 100644 --- a/include/memory.h +++ b/include/memory.h @@ -695,6 +695,8 @@ STATIC_INLINE void put_pointer (uaecptr addr, void *v) # endif #endif +bool real_address_allowed(void); + STATIC_INLINE uae_u8 *get_real_address (uaecptr addr) { return get_mem_bank (addr).xlateaddr(addr); diff --git a/memory.cpp b/memory.cpp index 57a50ee5..5129f3bc 100644 --- a/memory.cpp +++ b/memory.cpp @@ -136,6 +136,13 @@ __inline__ void byteput (uaecptr addr, uae_u32 b) } #endif +extern bool debugmem_initialized; + +bool real_address_allowed(void) +{ + return debugmem_initialized == false; +} + int addr_valid (const TCHAR *txt, uaecptr addr, uae_u32 len) { addrbank *ab = &get_mem_bank(addr); diff --git a/traps.cpp b/traps.cpp index 3b35d13a..c23035f6 100644 --- a/traps.cpp +++ b/traps.cpp @@ -1093,7 +1093,7 @@ void trap_put_bytes(TrapContext *ctx, const void *haddrp, uaecptr addr, int cnt) cnt -= max; } } else { - if (valid_address(addr, cnt)) { + if (real_address_allowed() && valid_address(addr, cnt)) { memcpy(get_real_address(addr), haddr, cnt); } else { for (int i = 0; i < cnt; i++) { @@ -1118,7 +1118,7 @@ void trap_get_bytes(TrapContext *ctx, void *haddrp, uaecptr addr, int cnt) cnt -= max; } } else { - if (valid_address(addr, cnt)) { + if (real_address_allowed() && valid_address(addr, cnt)) { memcpy(haddr, get_real_address(addr), cnt); } else { for (int i = 0; i < cnt; i++) {