Commit 7cd77192 authored by anonymous's avatar anonymous
Browse files

DEBUG -> BD_DEBUG

parent b5bbf5a4
......@@ -60,10 +60,10 @@ int file_mkpath(const char *path)
*end = 0;
if (stat(dir, &s) != 0 || !S_ISDIR(s.st_mode)) {
DEBUG(DBG_FILE, "Creating directory %s\n", dir);
BD_DEBUG(DBG_FILE, "Creating directory %s\n", dir);
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IRWXO) == -1) {
DEBUG(DBG_FILE | DBG_CRIT, "Error creating directory %s\n", dir);
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error creating directory %s\n", dir);
result = 0;
break;
}
......@@ -97,11 +97,11 @@ static char *_probe_config_dir(const char *base, const char *vm, const char *fil
if (fp) {
fclose(fp);
*(strrchr(dir, '/') + 1) = 0;
DEBUG(DBG_BDPLUS, "Found VM config from %s\n", dir);
BD_DEBUG(DBG_BDPLUS, "Found VM config from %s\n", dir);
return dir;
}
DEBUG(DBG_BDPLUS, "VM config not found from %s\n", dir);
BD_DEBUG(DBG_BDPLUS, "VM config not found from %s\n", dir);
free(dir);
return NULL;
}
......@@ -149,7 +149,7 @@ static char *_load_fp(FILE *fp, uint32_t *p_size)
fseek(fp, 0, SEEK_SET);
if (file_size < MIN_FILE_SIZE || file_size > MAX_FILE_SIZE) {
DEBUG(DBG_FILE, "Invalid file size\n");
BD_DEBUG(DBG_FILE, "Invalid file size\n");
return NULL;
}
......@@ -157,7 +157,7 @@ static char *_load_fp(FILE *fp, uint32_t *p_size)
read_size = fread(data, 1, file_size, fp);
if (read_size != file_size) {
DEBUG(DBG_FILE, "Error reading file\n");
BD_DEBUG(DBG_FILE, "Error reading file\n");
free(data);
return NULL;
}
......@@ -179,7 +179,7 @@ char *file_load(const char *path, uint32_t *p_size)
fp = fopen(path, "rb");
if (!fp) {
DEBUG(DBG_FILE | DBG_CRIT, "Error loading %s\n", path);
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error loading %s\n", path);
return NULL;
}
......
......@@ -45,7 +45,7 @@ char *file_get_config_home(void)
return str_printf("%s/%s", user_home, USER_CFG_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -56,7 +56,7 @@ char *file_get_data_home(void)
return str_printf("%s/%s", user_home, USER_DATA_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -67,7 +67,7 @@ char *file_get_cache_home(void)
return str_printf("%s/%s", user_home, USER_CACHE_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......
......@@ -60,7 +60,7 @@ char *file_get_data_home(void)
return appdir;
}
DEBUG(DBG_FILE, "Can't find user configuration directory !\n");
BD_DEBUG(DBG_FILE, "Can't find user configuration directory !\n");
return NULL;
}
......@@ -88,7 +88,7 @@ const char *file_get_config_system(const char *dir)
WideCharToMultiByte (CP_UTF8, 0, wdir, -1, appdir, len, NULL, NULL);
return appdir;
} else {
DEBUG(DBG_FILE, "Can't find common configuration directory !\n");
BD_DEBUG(DBG_FILE, "Can't find common configuration directory !\n");
return NULL;
}
} else {
......
......@@ -53,7 +53,7 @@ char *file_get_config_home(void)
return str_printf("%s/%s", user_home, USER_CFG_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -69,7 +69,7 @@ char *file_get_data_home(void)
return str_printf("%s/%s", user_home, USER_DATA_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......@@ -85,7 +85,7 @@ char *file_get_cache_home(void)
return str_printf("%s/%s", user_home, USER_CACHE_DIR);
}
DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
return NULL;
}
......
......@@ -58,13 +58,13 @@ void bdplus_get_version(int *major, int *minor, int *micro)
static int _load_svm(bdplus_t *plus)
{
if (!plus->config->fopen) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "No device path or filesystem access function provided\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "No device path or filesystem access function provided\n");
return -1;
}
DEBUG(DBG_BDPLUS, "[bdplus] loading BDSVM/00000.svm...\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] loading BDSVM/00000.svm...\n");
if (bdplus_load_svm(plus, "BDSVM/00000.svm")) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] Error loading BDSVM/00000.svm\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] Error loading BDSVM/00000.svm\n");
return -1;
}
......@@ -118,13 +118,13 @@ bdplus_t *bdplus_init(const char *path, const char *config_path, const uint8_t *
bdplus_t *plus = NULL;
// Change to TEAM BLUH-RAY, DOOM9 FORUMS.
DEBUG(DBG_BDPLUS, "[bdplus] initialising...\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] initialising...\n");
/* Ensure libgcrypt is initialized before doing anything else */
DEBUG(DBG_BDPLUS, "Initializing libgcrypt...\n");
BD_DEBUG(DBG_BDPLUS, "Initializing libgcrypt...\n");
if (!crypto_init())
{
DEBUG(DBG_BDPLUS | DBG_CRIT, "Failed to initialize libgcrypt\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "Failed to initialize libgcrypt\n");
return NULL;
}
......@@ -167,12 +167,12 @@ bdplus_t *bdplus_init(const char *path, const char *config_path, const uint8_t *
}
}
DEBUG(DBG_BDPLUS, "[bdplus] loading flash.bin...\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] loading flash.bin...\n");
_load_slots(plus);
memcpy(plus->volumeID, vid, sizeof(plus->volumeID));
DEBUG(DBG_BDPLUS, "[bdplus] created and returning bdplus_t %p\n", plus);
BD_DEBUG(DBG_BDPLUS, "[bdplus] created and returning bdplus_t %p\n", plus);
return plus;
}
......@@ -204,7 +204,7 @@ int32_t bdplus_start(bdplus_t *plus)
bd_mutex_lock(plus->mutex);
DEBUG(DBG_BDPLUS, "[bdplus] running VM for conv_table...\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] running VM for conv_table...\n");
// FIXME: Run this as separate thread?
result = bdplus_run_init(plus->vm);
......@@ -218,7 +218,7 @@ int32_t bdplus_start(bdplus_t *plus)
void bdplus_free(bdplus_t *plus)
{
DEBUG(DBG_BDPLUS, "[bdplus] releasing %p..\n", plus);
BD_DEBUG(DBG_BDPLUS, "[bdplus] releasing %p..\n", plus);
if (!plus) {
return;
......@@ -260,14 +260,14 @@ void bdplus_free(bdplus_t *plus)
bdplus_st_t *bdplus_m2ts(bdplus_t *plus, uint32_t m2ts)
{
DEBUG(DBG_BDPLUS, "[bdplus] set_m2ts %p -> %u\n", plus, m2ts);
BD_DEBUG(DBG_BDPLUS, "[bdplus] set_m2ts %p -> %u\n", plus, m2ts);
if (!plus) return NULL;
bd_mutex_lock(plus->mutex);
if (!plus->conv_tab) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] bdplus_m2ts(%05u.m2ts): no conversion table\n", m2ts);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] bdplus_m2ts(%05u.m2ts): no conversion table\n", m2ts);
bd_mutex_unlock(plus->mutex);
return NULL;
}
......@@ -290,28 +290,28 @@ void bdplus_m2ts_close(bdplus_st_t *st)
void bdplus_mmap(bdplus_t *plus, uint32_t id, void *mem )
{
if (!plus || !plus->config || !plus->config->ram) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: memory not initialized\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: memory not initialized\n");
return;
}
if (plus->started) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap ignored: VM already running\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap ignored: VM already running\n");
return;
}
switch (id) {
case MMAP_ID_PSR:
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: PSR register file at %p\n", mem);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: PSR register file at %p\n", mem);
bdplus_config_mmap(plus->config->ram, MEM_TYPE_PSR, mem, 128 * sizeof(uint32_t));
break;
case MMAP_ID_GPR:
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: GPR register file at %p\n", mem);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: GPR register file at %p\n", mem);
bdplus_config_mmap(plus->config->ram, MEM_TYPE_GPR, mem, 4096 * sizeof(uint32_t));
break;
default:
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: unknown region id %d\n", id);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: unknown region id %d\n", id);
break;
}
}
......@@ -322,12 +322,12 @@ void bdplus_psr ( bdplus_t *plus,
int (*psr_write)(void *, int, uint32_t) )
{
if (!plus || !plus->config) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] set psr: no config loaded\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] set psr: no config loaded\n");
return;
}
if (plus->started) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] set psr ignored: VM already running\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] set psr ignored: VM already running\n");
return;
}
......@@ -358,7 +358,7 @@ static int32_t _bdplus_event(bdplus_t *plus, uint32_t event, uint32_t param1, ui
if (event == BDPLUS_RUN_CONVTAB) {
/* this event is used when disc is played without menus. */
/* try to emulate player to get converson table. */
DEBUG(DBG_BDPLUS, "[bdplus] received CONVERSION TABLE event\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] received CONVERSION TABLE event\n");
unsigned int num_titles = param2;
......@@ -373,17 +373,17 @@ static int32_t _bdplus_event(bdplus_t *plus, uint32_t event, uint32_t param1, ui
if (event == BDPLUS_EVENT_TITLE) {
if (plus->conv_tab && param1 == 0xffff) {
DEBUG(DBG_BDPLUS, "[bdplus] ignoring FirstPlay title event (conversion table exists)\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] ignoring FirstPlay title event (conversion table exists)\n");
return 0;
}
DEBUG(DBG_BDPLUS, "[bdplus] received TITLE event: %d\n", param1);
BD_DEBUG(DBG_BDPLUS, "[bdplus] received TITLE event: %d\n", param1);
return bdplus_run_title(plus, param1);
}
if (event == BDPLUS_EVENT_APPLICATION) {
/* actual communication between BD+ and HDMV/BD-J uses registers PSR102-PSR104. */
/* This event is just a notification that register has been written to. */
DEBUG(DBG_BDPLUS, "[bdplus] received APPLICATION LAYER event\n");
BD_DEBUG(DBG_BDPLUS, "[bdplus] received APPLICATION LAYER event\n");
return bdplus_run_event210(plus->vm, param1);
}
......
......@@ -53,7 +53,7 @@ static int _load_aes_keys(bdplus_aes_key_t *aes_keys, const char *base)
num_keys = MAX_AES_KEYS;
}
if (num_keys * 16 != size) {
DEBUG(DBG_FILE | DBG_CRIT, "Invalid AES key file size\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Invalid AES key file size\n");
}
for (ii = 0; ii < num_keys; ii++) {
......@@ -85,7 +85,7 @@ static int _load_ecdsa_keys(bdplus_ecdsa_key_t *ecdsa_keys, const char *base)
}
else if (3 == sscanf(p, "%40s %40s %40s", key_d, key_Qx, key_Qy)) {
if (num_ecdsa_keys >= MAX_ECDSA_KEYS) {
DEBUG(DBG_FILE | DBG_CRIT, "Too many ECDSA keys\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Too many ECDSA keys\n");
break;
}
memcpy(ecdsa_keys[num_ecdsa_keys].d, key_d, 40);
......@@ -94,7 +94,7 @@ static int _load_ecdsa_keys(bdplus_ecdsa_key_t *ecdsa_keys, const char *base)
num_ecdsa_keys++;
}
else {
DEBUG(DBG_FILE | DBG_CRIT, "invalid line in config file: %4.4s...\n", p);
BD_DEBUG(DBG_FILE | DBG_CRIT, "invalid line in config file: %4.4s...\n", p);
}
p = str_next_line(p);
}
......@@ -119,11 +119,11 @@ static int _load_ram(bdplus_ram_t **p, const char *base, uint32_t address, const
if (!strcmp(file, "PSR")) {
ram->area[ram->num_area].type = MEM_TYPE_PSR;
DEBUG(DBG_BDPLUS, "mapped PSR register file to 0x%x\n", address);
BD_DEBUG(DBG_BDPLUS, "mapped PSR register file to 0x%x\n", address);
} else if (!strcmp(file, "GPR")) {
ram->area[ram->num_area].type = MEM_TYPE_PSR;
DEBUG(DBG_BDPLUS, "mapped GPR register file to 0x%x\n", address);
BD_DEBUG(DBG_BDPLUS, "mapped GPR register file to 0x%x\n", address);
} else {
/* load from file */
......@@ -138,7 +138,7 @@ static int _load_ram(bdplus_ram_t **p, const char *base, uint32_t address, const
return 0;
}
DEBUG(DBG_BDPLUS, "mapped %d bytes from %s to 0x%x\n",
BD_DEBUG(DBG_BDPLUS, "mapped %d bytes from %s to 0x%x\n",
ram->area[ram->num_area].size, file, address);
}
......@@ -199,7 +199,7 @@ static int _load_memory(bdplus_ram_t **ram, const char *base)
X_FREE(path);
if (!cfg) {
DEBUG(DBG_FILE | DBG_CRIT, "Error loading memory map file '"MEMORY_MAP_FILE"'\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Error loading memory map file '"MEMORY_MAP_FILE"'\n");
return -1;
}
......@@ -220,7 +220,7 @@ static int _load_memory(bdplus_ram_t **ram, const char *base)
_load_ram(ram, base, address, name);
}
else {
DEBUG(DBG_FILE | DBG_CRIT, "invalid line in config file: %4.4s...\n", p);
BD_DEBUG(DBG_FILE | DBG_CRIT, "invalid line in config file: %4.4s...\n", p);
}
p = str_next_line(p);
}
......@@ -252,7 +252,7 @@ int bdplus_config_load(const char *config_path,
base = file_get_config_dir(MEMORY_MAP_FILE);
config_path = base;
if (!base) {
DEBUG(DBG_FILE | DBG_CRIT, "VM configuration not found\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "VM configuration not found\n");
return -1;
}
}
......@@ -263,16 +263,16 @@ int bdplus_config_load(const char *config_path,
config->num_aes_keys = _load_aes_keys(config->aes_keys, config_path);
if (config->num_aes_keys < 0) {
DEBUG(DBG_FILE | DBG_CRIT, "Player AES keys not found\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Player AES keys not found\n");
}
if (_load_ecdsa_keys(config->ecdsa_keys, config_path) < 0) {
DEBUG(DBG_FILE | DBG_CRIT, "Player ECDSA keys not found\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Player ECDSA keys not found\n");
}
if (_load_dev_discovery(config->dev, config_path) < 0) {
DEBUG(DBG_FILE | DBG_CRIT, "Player device discovery signatures not found\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Player device discovery signatures not found\n");
}
if (_load_memory(&config->ram, config_path) < 0) {
DEBUG(DBG_FILE | DBG_CRIT, "Player memory loading failed\n");
BD_DEBUG(DBG_FILE | DBG_CRIT, "Player memory loading failed\n");
}
X_FREE(base);
......@@ -298,18 +298,18 @@ void bdplus_config_mmap(bdplus_ram_t *ram, uint32_t type, void *mem, uint32_t si
bdplus_ram_area_t *p;
if (!mem) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: config not read\n");
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: config not read\n");
return;
}
if (((intptr_t)mem) & 3) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: register file %d not aligned\n", type);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: register file %d not aligned\n", type);
return;
}
p = _find_mem(ram, type);
if (!p) {
DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: register file %d not mapped in config\n", type);
BD_DEBUG(DBG_BDPLUS | DBG_CRIT, "[bdplus] mmap: register file %d not mapped in config\n", type);
return;
}
......
......@@ -79,7 +79,7 @@ int32_t diff_loadcore(uint8_t *addr, uint32_t vmsize, char *fname,
fd = fopen(fname, "rb");
if (!fd) return errno;
DEBUG(DBG_BDPLUS,"[diff] opened '%s' to find trap %d...\n", fname, trap);
BD_DEBUG(DBG_BDPLUS,"[diff] opened '%s' to find trap %d...\n", fname, trap);
if (fread(&size, sizeof(size), 1, fd) != 1) goto fail;
if (fread(&count, sizeof(count), 1, fd) != 1) goto fail;
......@@ -88,7 +88,7 @@ int32_t diff_loadcore(uint8_t *addr, uint32_t vmsize, char *fname,
size = FETCH4((uint8_t*)&size);
count = FETCH4((uint8_t*)&count);
DEBUG(DBG_BDPLUS,"[diff] Memory size is %08X, num diff-files %08X\n", size, count);
BD_DEBUG(DBG_BDPLUS,"[diff] Memory size is %08X, num diff-files %08X\n", size, count);
if (trap >= count) return -1;
......@@ -102,7 +102,7 @@ int32_t diff_loadcore(uint8_t *addr, uint32_t vmsize, char *fname,
for (currtrap = 0; currtrap <= trap; currtrap++) {
if (fread(&diffcnt, sizeof(diffcnt), 1, fd) != 1) goto fail;
diffcnt = FETCH4((uint8_t*)&diffcnt);
DEBUG(DBG_BDPLUS," trap %08X has %d diffs\n", currtrap, diffcnt);
BD_DEBUG(DBG_BDPLUS," trap %08X has %d diffs\n", currtrap, diffcnt);
for (currdiff = 0; currdiff < diffcnt; currdiff++) {
if (fread(&start, sizeof(diffcnt), 1, fd) != 1) goto fail;
if (fread(&length, sizeof(diffcnt), 1, fd) != 1) goto fail;
......@@ -137,7 +137,7 @@ int32_t diff_loadcore(uint8_t *addr, uint32_t vmsize, char *fname,
return 0;
fail:
DEBUG(DBG_BDPLUS,"[diff] archive failed at reading trap %08X diff %08X\n",
BD_DEBUG(DBG_BDPLUS,"[diff] archive failed at reading trap %08X diff %08X\n",
currtrap, currdiff);
fclose(fd);
return -1;
......@@ -161,7 +161,7 @@ uint32_t diff_hashdb_load(uint8_t *hashname, uint8_t *fname, uint64_t offset,
struct sha_hdr_s sha_hdr;
uint32_t shalen;
DEBUG(DBG_BDPLUS,"[diff] Attempting to open '%s' looking for '%s'\n",
BD_DEBUG(DBG_BDPLUS,"[diff] Attempting to open '%s' looking for '%s'\n",
hashname, fname);
fd = fopen((char *)hashname, "rb");
......@@ -179,20 +179,20 @@ uint32_t diff_hashdb_load(uint8_t *hashname, uint8_t *fname, uint64_t offset,
(char *)fname);
char str[512];
DEBUG(DBG_BDPLUS,"[diff] namehash: %s\n",
BD_DEBUG(DBG_BDPLUS,"[diff] namehash: %s\n",
str_print_hex(str, namehash, shalen));
// Hash it.
gcry_md_hash_buffer(GCRY_MD_SHA1, digest, namehash, shalen - 1);
memset(str, 0, sizeof(str));
DEBUG(DBG_BDPLUS,"[diff] find hashdb: %s\n",
BD_DEBUG(DBG_BDPLUS,"[diff] find hashdb: %s\n",
str_print_hex(str, digest, sizeof(digest)));
while(fread(&sha_hdr, sizeof(sha_hdr), 1, fd) == 1) {
memset(str, 0, sizeof(str));
DEBUG(DBG_BDPLUS,"[diff] read hashdb: %s\n",
BD_DEBUG(DBG_BDPLUS,"[diff] read hashdb: %s\n",
str_print_hex(str, sha_hdr.digest, sizeof(digest)));
sha_hdr.next = FETCH4((uint8_t *)&sha_hdr.next);
......@@ -200,13 +200,13 @@ uint32_t diff_hashdb_load(uint8_t *hashname, uint8_t *fname, uint64_t offset,
if (!memcmp(digest, sha_hdr.digest, sizeof(digest))) {
// Found the digest we are looking for
sha_hdr.len = FETCH4((uint8_t *)&sha_hdr.len);
DEBUG(DBG_BDPLUS,"[diff] found digest, reading %08X (%u) bytes...\n",
BD_DEBUG(DBG_BDPLUS,"[diff] found digest, reading %08X (%u) bytes...\n",
sha_hdr.next - (uint32_t)sizeof(sha_hdr.len),
sha_hdr.next - (uint32_t)sizeof(sha_hdr.len));
// Read in all digests, perhaps error checking?
if (!fread(dst, sha_hdr.next - sizeof(sha_hdr.len), 1, fd)) {
DEBUG(DBG_BDPLUS,"[diff] Short read on hash_db.bin!\n");
BD_DEBUG(DBG_BDPLUS,"[diff] Short read on hash_db.bin!\n");
}
// Update new len
*len = sha_hdr.len;
......
......@@ -115,7 +115,7 @@ uint32_t dlx_setPC(VM *vm, unsigned int PC)
old = vm->PC;
DEBUG(DBG_BDPLUS,"[dlx] setPC (%p, %08X -> %08X)\n", vm, old, PC);
BD_DEBUG(DBG_BDPLUS,"[dlx] setPC (%p, %08X -> %08X)\n", vm, old, PC);
vm->PC = PC;
......@@ -130,7 +130,7 @@ uint32_t dlx_setPC(VM *vm, unsigned int PC)
uint32_t dlx_getPC(VM *vm)
{
DEBUG(DBG_BDPLUS,"[dlx] getPC (%p): %08X\n", vm, vm->PC);
BD_DEBUG(DBG_BDPLUS,"[dlx] getPC (%p): %08X\n", vm, vm->PC);
return vm->PC;
}
......@@ -142,7 +142,7 @@ int32_t dlx_setWD(VM *vm, int32_t WD)
old = vm->WD;
DEBUG(DBG_BDPLUS,"[dlx] setWD (%p, %08X -> %08X)\n", vm, old, WD);
BD_DEBUG(DBG_BDPLUS,"[dlx] setWD (%p, %08X -> %08X)\n", vm, old, WD);
vm->WD = WD;
return old;
......@@ -153,7 +153,7 @@ int32_t dlx_setWD(VM *vm, int32_t WD)
int32_t dlx_getWD(VM *vm)
{
DEBUG(DBG_BDPLUS,"[dlx] getWD (%p): %08X\n", vm, vm->WD);
BD_DEBUG(DBG_BDPLUS,"[dlx] getWD (%p): %08X\n", vm, vm->WD);
return vm->WD;
}
......@@ -164,7 +164,7 @@ uint32_t dlx_setIF(VM *vm, uint32_t IF)
old = vm->IF;
DEBUG(DBG_BDPLUS,"[dlx] setIF (%p, %08X -> %08X)\n", vm, old, IF);
BD_DEBUG(DBG_BDPLUS,"[dlx] setIF (%p, %08X -> %08X)\n", vm, old, IF);
vm->IF = IF;
return old;
......@@ -175,7 +175,7 @@ uint32_t dlx_setIF(VM *vm, uint32_t IF)
uint32_t dlx_getIF(VM *vm)
{
DEBUG(DBG_BDPLUS,"[dlx] getIF (%p): %08X\n", vm, vm->IF);
BD_DEBUG(DBG_BDPLUS,"[dlx] getIF (%p): %08X\n", vm, vm->IF);
return vm->IF;
}
......@@ -216,7 +216,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
vm->trap = 0;
if (flags != BD_STEP_I) {
DEBUG(DBG_DLX,"[dlx] running VM %p\n", vm);
BD_DEBUG(DBG_DLX,"[dlx] running VM %p\n", vm);
}
do {
......@@ -244,13 +244,13 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x3D: // NOP
case 0x3E: // NOP
case 0x3F: // NOP
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): NOP\n", vm->PC-4, C);
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): NOP\n", vm->PC-4, C);
vm->WD-=1;
break;
case 0x01: // ADD | R-type | Rd = Rs1 + Rs2
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): ADD (R%-2d = R%-2d + R%-2d): %d = %d + %d\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): ADD (R%-2d = R%-2d + R%-2d): %d = %d + %d\n"
, vm->PC-4, C,
d,s1,s2,vm->R[s1]+vm->R[s2],vm->R[s1],vm->R[s2]);
vm->R[d] = vm->R[s1] + vm->R[s2];
......@@ -259,7 +259,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x02: // SUB | R-type | Rd = Rs1 - Rs2
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SUB (R%-2d = R%-2d - R%-2d): %08X = %08X - %08X\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SUB (R%-2d = R%-2d - R%-2d): %08X = %08X - %08X\n"
, vm->PC-4, C,
d,s1,s2,vm->R[s1]-vm->R[s2],vm->R[s1],vm->R[s2]);
vm->R[d] = vm->R[s1] - vm->R[s2];
......@@ -268,7 +268,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x03: // MUL | R-type | Rd = Rs1 * Rs2
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): MUL (R%-2d = R%-2d * R%-2d): %08X = %08X * %08X\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): MUL (R%-2d = R%-2d * R%-2d): %08X = %08X * %08X\n"
, vm->PC-4, C,
d,s1,s2,vm->R[s1]*vm->R[s2],vm->R[s1],vm->R[s2]);
vm->R[d] = vm->R[s1] * vm->R[s2];
......@@ -277,7 +277,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x04: // DIV | R-type | Rd = signed(Rs1) / signed(Rs2)
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): DIV (R%-2d = R%-2d / R%-2d): %08X = %08X / %08X\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): DIV (R%-2d = R%-2d / R%-2d): %08X = %08X / %08X\n"
, vm->PC-4, C,
d,s1,s2,(vm->R[s2] ? (int32_t)vm->R[s1]/(int32_t)vm->R[s2] : 0),vm->R[s1],vm->R[s2]);
if (vm->R[s2])
......@@ -289,7 +289,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x05: // DIVU | R-type | Rd = unsigned(Rs1) / unsigned(Rs2)
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): DIVU(R%-2d = R%-2d / R%-2d): %08X = %08X / %08X\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): DIVU(R%-2d = R%-2d / R%-2d): %08X = %08X / %08X\n"
, vm->PC-4, C,
d,s1,s2,(vm->R[s2] ? vm->R[s1]/vm->R[s2] : 0),vm->R[s1],vm->R[s2]);
if (vm->R[s2])
......@@ -301,7 +301,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x06: // SLL | R-type | Rd = Rs1 << (Rs2 & 0x1F)
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SLL (R%-2d = R%-2d << R%-2d): %08X = %08X << %d\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SLL (R%-2d = R%-2d << R%-2d): %08X = %08X << %d\n"
, vm->PC-4, C,
d,s1,s2,vm->R[s1]<<(vm->R[s2]&0x1F),vm->R[s1],vm->R[s2]);
vm->R[d] = vm->R[s1] << (vm->R[s2]&0x1F);
......@@ -310,7 +310,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x07: // SRL | R-type | Rd = Rs1 >> (Rs2 & 0x1F)
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SRL (R%-2d = R%-2d >> R%-2d): %08X = %08X >> %d\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SRL (R%-2d = R%-2d >> R%-2d): %08X = %08X >> %d\n"
, vm->PC-4, C,
d,s1,s2,vm->R[s1]>>(vm->R[s2]&0x1F),vm->R[s1],vm->R[s2]);
vm->R[d] = vm->R[s1] >> (vm->R[s2]&0x1F);
......@@ -319,7 +319,7 @@ int32_t dlx_run(VM *vm, int32_t flags)
case 0x08: // SRA | R-type | SRL and SRA perform identically if Rs1 is positive. If Rs1 is negative (bit 31 == 1), 1's are shifted in from the left for SRA and SRAI.
OP_RTYPE(I, d, s1, s2);
DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SRA (R%-2d = R%-2d >> R%-2d): %08X = %08X >> %d\n"
BD_DEBUG(DBG_DLX,"[dlx] %08X (I=%02X): SRA (R%-2d = R%-2d >> R%-2d): %08X = %08X >> %d\n"
, vm->