Skip to content

Commit

Permalink
change some logging levels
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonjesus committed Nov 9, 2022
1 parent a245f1a commit 7457e1e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions core/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static void spi_reigon_read(uc_engine* uc, uc_mem_type type, uint32_t address, i
uint32_t pc;
uc_reg_read(uc, UC_ARM_REG_PC, &pc);
disassemble(uc, pc, size, spi_disasm_buffer);
log_trace("SPI %d Reigon Read 0x%x @ PC = 0x%x (%s)", meta->port, address, pc, spi_disasm_buffer);
log_trace("SPICTRL: 0x%X, SPISETUP: 0x%X, SPISTATUS: 0x%X, SPIPIN: 0x%X, SPITXDATA: 0x%X, SPIRXDATA: 0x%X, SPICLKDIV: 0x%X, SPIRXLIMIT: 0x%X, SPIDD: 0x%X", spi->SPICTRL, spi->SPISETUP, spi->SPISTATUS, spi->SPIPIN, spi->SPITXDATA, spi->SPIRXDATA, spi->SPICLKDIV, spi->SPIRXLIMIT, spi->SPIDD);
log_debug("SPI %d Reigon Read 0x%x @ PC = 0x%x (%s)", meta->port, address, pc, spi_disasm_buffer);
log_debug("SPICTRL: 0x%X, SPISETUP: 0x%X, SPISTATUS: 0x%X, SPIPIN: 0x%X, SPITXDATA: 0x%X, SPIRXDATA: 0x%X, SPICLKDIV: 0x%X, SPIRXLIMIT: 0x%X, SPIDD: 0x%X", spi->SPICTRL, spi->SPISETUP, spi->SPISTATUS, spi->SPIPIN, spi->SPITXDATA, spi->SPIRXDATA, spi->SPICLKDIV, spi->SPIRXLIMIT, spi->SPIDD);

if((address - self->address) == 0x08) {
if(spi->SPISETUP & 1) {
Expand Down Expand Up @@ -70,8 +70,8 @@ static void spi_reigon_write(uc_engine* uc, uc_mem_type type, uint32_t address,

uint32_t pc;
uc_reg_read(uc, UC_ARM_REG_PC, &pc);
log_trace("SPI %d Reigon Write 0x%x = 0x%x @ PC = 0x%x", meta->port, address, value, pc);
log_trace("SPICTRL: 0x%X, SPISETUP: 0x%X, SPISTATUS: 0x%X, SPIPIN: 0x%X, SPITXDATA: 0x%X, SPIRXDATA: 0x%X, SPICLKDIV: 0x%X, SPIRXLIMIT: 0x%X, SPIDD: 0x%X", spi->SPICTRL, spi->SPISETUP, spi->SPISTATUS, spi->SPIPIN, spi->SPITXDATA, spi->SPIRXDATA, spi->SPICLKDIV, spi->SPIRXLIMIT, spi->SPIDD);
log_debug("SPI %d Reigon Write 0x%x = 0x%x @ PC = 0x%x", meta->port, address, value, pc);
log_debug("SPICTRL: 0x%X, SPISETUP: 0x%X, SPISTATUS: 0x%X, SPIPIN: 0x%X, SPITXDATA: 0x%X, SPIRXDATA: 0x%X, SPICLKDIV: 0x%X, SPIRXLIMIT: 0x%X, SPIDD: 0x%X", spi->SPICTRL, spi->SPISETUP, spi->SPISTATUS, spi->SPIPIN, spi->SPITXDATA, spi->SPIRXDATA, spi->SPICLKDIV, spi->SPIRXLIMIT, spi->SPIDD);

if(spi->SPICTRL == 0 && (address - self->address) == 0x0) {
spi->SPICTRL = 0x2;
Expand Down
4 changes: 2 additions & 2 deletions devices/nor_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int norboot_init(void* dev) {
meta->content = calloc(1, 0x100000);
meta->content_buffer_index = 0;

// load nor_image.bin into norflash at 0x8000
// load nor_image.bin into norflash at 0x0
FILE* efi = fopen("nor_image.bin", "rb");
if(efi == NULL) {
log_error("Failed to open nor_image.bin");
Expand Down Expand Up @@ -79,7 +79,7 @@ int norboot_write(void* self, uint32_t cmd) {

meta->cmd_buffer[meta->cmd_buffer_index++] = cmd;

log_trace("NORBOOT: Recv Command 0x%x (full buffer: 0x%02x%02x%02x%02x)", cmd, meta->cmd_buffer[0], meta->cmd_buffer[1], meta->cmd_buffer[2], meta->cmd_buffer[3]);
log_debug("NORBOOT: Recv Command 0x%x (full buffer: 0x%02x%02x%02x%02x)", cmd, meta->cmd_buffer[0], meta->cmd_buffer[1], meta->cmd_buffer[2], meta->cmd_buffer[3]);

if(cmd == 0xFF) {
log_debug("NORBOOT: Resetting");
Expand Down
2 changes: 2 additions & 0 deletions disassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ void disassemble(uc_engine* uc, uint32_t addr, uint32_t size, char* out) {
cs_insn *insn;
size_t count;

out[0] = '\0';

uint32_t cpsr;
uc_reg_read(uc, UC_ARM_REG_CPSR, &cpsr);

Expand Down
3 changes: 0 additions & 3 deletions emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ int start_emulation(uc_engine* uc, uint32_t start, uint32_t count) {

uint32_t pc, instruction, cpsr;
uc_reg_read(uc, UC_ARM_REG_CPSR, &cpsr);
uint32_t size = (cpsr & 0x20) ? 2 : 4;
log_fatal("CPU is in %s mode", (cpsr & 0x20) ? "THUMB" : "ARM");

start |= (cpsr & 0x20) >> 5;

uc_err err = uc_emu_start(uc, start, ~0, 0, count);
Expand Down
2 changes: 1 addition & 1 deletion paravirtualization/delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
int delay_execute(uc_engine* uc, uint32_t address, uint32_t size, void* user_data) {
uint32_t ticks; // r0
uc_reg_read(uc, UC_ARM_REG_R0, &ticks);
log_debug("Delay called for %d ticks", ticks);
log_trace("Delay called for %d ticks", ticks);

//skip the function
uint32_t pc;
Expand Down
2 changes: 1 addition & 1 deletion paravirtualization/memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int memcpy_execute(uc_engine* uc, uint32_t address, uint32_t size, void* user_da
uc_reg_read(uc, UC_ARM_REG_R0, &dest);
uc_reg_read(uc, UC_ARM_REG_R1, &src);
uc_reg_read(uc, UC_ARM_REG_R2, &zsize);
log_debug("%s called for 0x%x bytes from 0x%08x to 0x%08x",pv->name, zsize, dest, src);
log_trace("%s called for 0x%x bytes from 0x%08x to 0x%08x",pv->name, zsize, dest, src);

void* memory = malloc(zsize);
uc_mem_read(uc, src, memory, zsize);
Expand Down
2 changes: 1 addition & 1 deletion paravirtualization/memzero.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int memzero_execute(uc_engine* uc, uint32_t address, uint32_t size, void* user_d
uint32_t zsize; // r1
uc_reg_read(uc, UC_ARM_REG_R0, &zaddress);
uc_reg_read(uc, UC_ARM_REG_R1, &zsize);
log_debug("%s called for 0x%x bytes at 0x%08x",pv->name, zsize, zaddress);
log_trace("%s called for 0x%x bytes at 0x%08x",pv->name, zsize, zaddress);

void* memory = calloc(1, zsize);
uc_mem_write(uc, zaddress, memory, zsize);
Expand Down

0 comments on commit 7457e1e

Please sign in to comment.