1.1 diff -r 58318104858b -r afe655559cc0 src/main.c 1.2 --- a/src/main.c Tue Dec 28 19:10:36 2010 +0000 1.3 +++ b/src/main.c Tue Dec 28 19:11:46 2010 +0000 1.4 @@ -239,19 +239,42 @@ 1.5 bool access_ok; 1.6 switch (checkMemoryAccess(state.dma_address, !state.dma_reading)) { 1.7 case MEM_PAGEFAULT: 1.8 - case MEM_PAGE_NO_WE: 1.9 - case MEM_KERNEL: 1.10 - case MEM_UIE: 1.11 + // Page fault 1.12 + state.genstat = 0x8BFF 1.13 + | (state.dma_reading ? 0x4000 : 0) 1.14 + | (state.pie ? 0x0400 : 0); 1.15 access_ok = false; 1.16 break; 1.17 + 1.18 + case MEM_UIE: 1.19 + // User access to memory above 4MB 1.20 + // FIXME? Shouldn't be possible with DMA... assert this? 1.21 + state.genstat = 0x9AFF 1.22 + | (state.dma_reading ? 0x4000 : 0) 1.23 + | (state.pie ? 0x0400 : 0); 1.24 + access_ok = false; 1.25 + break; 1.26 + 1.27 + case MEM_KERNEL: 1.28 + case MEM_PAGE_NO_WE: 1.29 + // Kernel access or page not write enabled 1.30 + access_ok = false; 1.31 + break; 1.32 + 1.33 case MEM_ALLOWED: 1.34 access_ok = true; 1.35 break; 1.36 } 1.37 if (!access_ok) { 1.38 - // TODO! 1.39 + state.bsr0 = 0x3C00; 1.40 + state.bsr0 |= (state.dma_address >> 16); 1.41 + state.bsr1 = state.dma_address & 0xffff; 1.42 + m68k_pulse_bus_error(); 1.43 + printf("BUS ERROR FROM DMA: genstat=%04X, bsr0=%04X, bsr1=%04X\n", state.genstat, state.bsr0, state.bsr1); 1.44 + 1.45 // TODO: FIXME: if we get a pagefault, it NEEDS to be tagged as 'peripheral sourced'... this is a HACK! 1.46 printf("REALLY BIG FSCKING HUGE ERROR: DMA Memory Access caused a FAULT!\n"); 1.47 + exit(-1); 1.48 } 1.49 1.50 // Map logical address to a physical RAM address