1.1 --- a/src/memory.c Fri Mar 04 01:37:42 2011 +0000 1.2 +++ b/src/memory.c Fri Mar 04 01:38:39 2011 +0000 1.3 @@ -83,17 +83,24 @@ 1.4 1.5 // If we're here, then we must be in User mode. 1.6 // Check that the user didn't access memory outside of the RAM area 1.7 - if (addr >= 0x400000) 1.8 + if (addr >= 0x400000) { 1.9 + LOGS("User accessed privileged memory"); 1.10 return MEM_UIE; 1.11 + } 1.12 1.13 // User attempt to access the kernel 1.14 // A19, A20, A21, A22 low (kernel access): RAM addr before paging; not in Supervisor mode 1.15 - if (((addr >> 19) & 0x0F) == 0) 1.16 + if (((addr >> 19) & 0x0F) == 0) { 1.17 + LOGS("Attempt by user code to access kernel space"); 1.18 return MEM_KERNEL; 1.19 + } 1.20 1.21 // Check page is write enabled 1.22 - if (writing && ((pagebits & 0x04) == 0)) 1.23 + if (writing && ((pagebits & 0x04) == 0)) { 1.24 + LOG("Page not write enabled: inaddr %08X, page %04X, mapram %04X [%02X %02X], pagebits %d", 1.25 + addr, page, MAPRAM(page), state.map[page*2], state.map[(page*2)+1], pagebits); 1.26 return MEM_PAGE_NO_WE; 1.27 + } 1.28 1.29 // Page access allowed. 1.30 return MEM_ALLOWED;