Add include header that redefines common CPU memory I/O functions to make them invalid. This is intended for source files that emulate behavior on hardware outside the CPU and should never issue CPU memory I/O from that source file

This commit is contained in:
Jonathan Campbell 2022-05-24 11:33:35 -07:00
parent 9e39c25a32
commit 8ab82522c5
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#undef mem_readb
#define mem_readb(x) THIS_IS_ILLEGAL_HERE
#undef mem_writeb
#define mem_writeb(x,b) THIS_IS_ILLEGAL_HERE
#undef mem_readw
#define mem_readw(x) THIS_IS_ILLEGAL_HERE
#undef mem_writew
#define mem_writew(x,b) THIS_IS_ILLEGAL_HERE
#undef mem_readd
#define mem_readd(x) THIS_IS_ILLEGAL_HERE
#undef mem_writed
#define mem_writed(x,b) THIS_IS_ILLEGAL_HERE
#undef real_readb
#define real_readb(x) THIS_IS_ILLEGAL_HERE
#undef real_writeb
#define real_writeb(x,b) THIS_IS_ILLEGAL_HERE
#undef real_readw
#define real_readw(x) THIS_IS_ILLEGAL_HERE
#undef real_writew
#define real_writew(x,b) THIS_IS_ILLEGAL_HERE
#undef real_readd
#define real_readd(x) THIS_IS_ILLEGAL_HERE
#undef real_writed
#define real_writed(x,b) THIS_IS_ILLEGAL_HERE
/* NTS: phys_readb/phys_writeb are fine, because they
* go directly to system memory. However unless
* you're emulating a PCI device with bus mastering
* enabled, you should not be using those either. */

View File

@ -9,6 +9,9 @@
#include "pc98_gdc_const.h"
#include <math.h>
/* do not issue CPU-side I/O here -- this code emulates functions that the GDC itself carries out, not on the CPU */
#include "cpu_io_is_forbidden.h"
uint8_t pc98_gdc_vread(const uint32_t addr);
void pc98_gdc_vwrite(const uint32_t addr,const uint8_t b);