chihiro, blkmemory debug prints

This commit is contained in:
espes 2015-08-11 12:15:29 -07:00
parent 3d895a7879
commit ee5232669f
2 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#include "block/blkmemory.h"
//#define DEBUG_BLKMEMORY
typedef struct BDRVMemoryState {
uint64_t size;
@ -61,7 +62,11 @@ static int memory_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
BDRVMemoryState *s = bs->opaque;
#ifdef DEBUG_BLKMEMORY
printf("blkmemory read 0x%llx : %d\n", sector_num, nb_sectors);
#endif
sector_num = MIN(sector_num, bs->total_sectors - 1);
size_t size = MIN(s->size - sector_num * BDRV_SECTOR_SIZE,
nb_sectors * BDRV_SECTOR_SIZE);
@ -76,6 +81,10 @@ static int memory_write(BlockDriverState *bs, int64_t sector_num,
{
BDRVMemoryState *s = bs->opaque;
#ifdef DEBUG_BLKMEMORY
printf("blkmemory write 0x%llx : %d\n", sector_num, nb_sectors);
#endif
sector_num = MIN(sector_num, bs->total_sectors - 1);
size_t size = MIN(s->size - sector_num * BDRV_SECTOR_SIZE,
nb_sectors * BDRV_SECTOR_SIZE);
@ -124,4 +133,4 @@ int bdrv_memory_open(BlockDriverState *bs, AddressSpace *as, uint64_t size)
s->size = size;
return 0;
}
}

View File

@ -41,6 +41,7 @@
# define SEGA_DIMM_SIZE_512M 2
# define SEGA_DIMM_SIZE_1024M 3
//#define DEBUG_CHIHIRO
typedef struct ChihiroLPCState {
ISADevice dev;
@ -63,13 +64,18 @@ static uint64_t chhiro_lpc_io_read(void *opaque, hwaddr addr,
r = SEGA_DIMM_SIZE_128M;
break;
}
#ifdef DEBUG_CHIHIRO
printf("chihiro lpc read [0x%llx] -> 0x%llx\n", addr, r);
#endif
return r;
}
static void chhiro_lpc_io_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
#ifdef DEBUG_CHIHIRO
printf("chihiro lpc write [0x%llx] = 0x%llx\n", addr, val);
#endif
}
static const MemoryRegionOps chihiro_lpc_io_ops = {