--- np2/i386c/ia32/cpu_mem.mcr 2012/01/08 18:26:10 1.8 +++ np2/i386c/ia32/cpu_mem.mcr 2012/06/18 14:30:27 1.10 @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#define VIRTUAL_ADDRESS_MEMORY_ACCESS_FUNCTION(width, valtype, length) \ +#define DECLARE_VIRTUAL_ADDRESS_MEMORY_RW_FUNCTIONS(width, valtype, length) \ valtype MEMCALL \ cpu_vmemoryread_##width(int idx, UINT32 offset) \ { \ @@ -47,7 +47,7 @@ cpu_vmemoryread_##width(int idx, UINT32 cpu_memoryread_check(sdp, offset, (length), \ CHOOSE_EXCEPTION(idx)); \ } else if (!(sdp->flag & CPU_DESC_FLAG_WHOLEADR)) { \ - if (!check_limit_upstairs(sdp, offset, (length))) \ + if (!check_limit_upstairs(sdp, offset, (length), SEG_IS_32BIT(sdp))) \ goto range_failure; \ } \ return cpu_lmemoryread_##width(addr, CPU_PAGE_READ_DATA | CPU_STAT_USER_MODE); \ @@ -85,7 +85,7 @@ cpu_vmemorywrite_##width(int idx, UINT32 cpu_memorywrite_check(sdp, offset, (length), \ CHOOSE_EXCEPTION(idx)); \ } else if (!(sdp->flag & CPU_DESC_FLAG_WHOLEADR)) { \ - if (!check_limit_upstairs(sdp, offset, (length))) \ + if (!check_limit_upstairs(sdp, offset, (length), SEG_IS_32BIT(sdp))) \ goto range_failure; \ } \ cpu_lmemorywrite_##width(addr, value, CPU_PAGE_WRITE_DATA | CPU_STAT_USER_MODE); \ @@ -96,10 +96,11 @@ range_failure: \ exc = CHOOSE_EXCEPTION(idx); \ err: \ EXCEPTION(exc, 0); \ -} \ -\ +} + +#define DECLARE_VIRTUAL_ADDRESS_MEMORY_RMW_FUNCTIONS(width, valtype, length) \ UINT32 MEMCALL \ -cpu_memory_access_va_RMW_##width(int idx, UINT32 offset, UINT32 (CPUCALL *func)(UINT32, void *), void *arg) \ +cpu_vmemory_RMW_##width(int idx, UINT32 offset, UINT32 (CPUCALL *func)(UINT32, void *), void *arg) \ { \ descriptor_t *sdp; \ UINT32 addr; \ @@ -127,13 +128,13 @@ cpu_memory_access_va_RMW_##width(int idx cpu_memorywrite_check(sdp, offset, (length), \ CHOOSE_EXCEPTION(idx)); \ } else if (!(sdp->flag & CPU_DESC_FLAG_WHOLEADR)) { \ - if (!check_limit_upstairs(sdp, offset, (length))) \ + if (!check_limit_upstairs(sdp, offset, (length), SEG_IS_32BIT(sdp))) \ goto range_failure; \ } \ return cpu_lmemory_RMW_##width(addr, func, arg); \ \ range_failure: \ - VERBOSE(("cpu_memory_access_va_RMW_" #width ": type = %d, offset = %08x, length = %d, limit = %08x", sdp->type, offset, length, sdp->u.seg.limit)); \ + VERBOSE(("cpu_vmemory_RMW_" #width ": type = %d, offset = %08x, length = %d, limit = %08x", sdp->type, offset, length, sdp->u.seg.limit)); \ exc = CHOOSE_EXCEPTION(idx); \ err: \ EXCEPTION(exc, 0); \