Further logging work

This commit is contained in:
dingusdev 2020-02-24 19:50:52 -07:00
parent baef838f7c
commit 6c1dc8aaf0
6 changed files with 62 additions and 60 deletions

View File

@ -8,6 +8,7 @@
// The Power-specific opcodes for the processor - ppcopcodes.cpp
// Any shared opcodes are in ppcopcodes.cpp
#include <thirdparty/loguru.hpp>
#include <iostream>
#include <array>
#include <stdio.h>
@ -613,35 +614,35 @@ void power_slliqdot() {
}
void power_sllq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sllq!!! \n");
}
void power_sllqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sllq.!!! \n");
}
void power_slq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slq!!! \n");
}
void power_slqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slq.!!! \n");
}
void power_sraiq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sraiq!!! \n");
}
void power_sraiqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sraiq.!!! \n");
}
void power_sraq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sraq!!! \n");
}
void power_sraqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for sraq.!!! \n");
}
void power_sre() {
@ -672,11 +673,11 @@ void power_sredot() {
}
void power_srea() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for srea!!! \n");
}
void power_sreadot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for srea.!!! \n");
}
void power_sreq() {
@ -770,25 +771,25 @@ void power_sriqdot() {
}
void power_srliq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slriq!!! \n");
}
void power_srliqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slriq.!!! \n");
}
void power_srlq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slrq!!! \n");
}
void power_srlqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for slrq.!!! \n");
}
void power_srq() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for srq!!! \n");
}
void power_srqdot() {
printf("OOPS! Placeholder!!! \n");
LOG_F(WARNING, "OOPS! Placeholder for srq.!!! \n");
}

View File

@ -5,7 +5,7 @@
//if you want to distribute this.
//(divingkatae#1017 or powermax#2286 on Discord)
#include <thirdparty/loguru.hpp>
#include <thirdparty/loguru.cpp>
#include <stdio.h>
#include <string>
#include <iostream>
@ -448,12 +448,12 @@ void ppc_opcode19() {
uint16_t subop_grab = ppc_cur_instruction & 2047;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 19 table subopcode entry %d \n", regrab);
LOG_F(INFO, "Executing Opcode 19 table subopcode entry \n", regrab);
if (SubOpcode19Grabber.count(subop_grab) == 1) {
SubOpcode19Grabber[subop_grab]();
}
else {
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
LOG_F(ERROR, "ILLEGAL SUBOPCODE: %d \n", subop_grab);
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x80000);
}
#else
@ -465,12 +465,12 @@ void ppc_opcode31() {
uint16_t subop_grab = ppc_cur_instruction & 2047;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 31 table subopcode entry %d \n", regrab);
LOG_F(INFO, "Executing Opcode 31 table subopcode entry \n", regrab);
if (SubOpcode31Grabber.count(subop_grab) == 1) {
SubOpcode31Grabber[subop_grab]();
}
else {
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
LOG_F(ERROR, "ILLEGAL SUBOPCODE: %d \n", subop_grab);
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x80000);
}
#else
@ -482,12 +482,12 @@ void ppc_opcode59() {
uint16_t subop_grab = ppc_cur_instruction & 2047;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 59 table subopcode entry %d \n", regrab);
LOG_F(INFO, "Executing Opcode 59 table subopcode entry \n", regrab);
if (SubOpcode59Grabber.count(subop_grab) == 1) {
SubOpcode59Grabber[subop_grab]();
}
else {
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
LOG_F(ERROR, "ILLEGAL SUBOPCODE: %d \n", subop_grab);
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x80000);
}
#else
@ -499,12 +499,12 @@ void ppc_opcode63() {
uint16_t subop_grab = ppc_cur_instruction & 2047;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
std::cout << "Executing Opcode 63 table subopcode entry " << regrab << std::endl;
LOG_F(INFO, "Executing Opcode 63 table subopcode entry \n", regrab);
if (SubOpcode63Grabber.count(subop_grab) == 1) {
SubOpcode63Grabber[subop_grab]();
}
else {
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
LOG_F(ERROR, "ILLEGAL SUBOPCODE: %d \n", subop_grab);
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x80000);
}
#else

View File

@ -1601,23 +1601,25 @@ void ppc_bclrl()
//Compare Instructions
void ppc_cmp() {
//if (!((ppc_cur_instruction >> 21) && 0x1)){
#ifdef CHECK_INVALID
if (ppc_cur_instruction & 0x200000) {
LOG_F(WARNING, "Invalid CMP instruction form (L=1)!\n");
return;
}
#endif
crf_d = (ppc_cur_instruction >> 23) & 7;
crf_d = crf_d << 2;
ppc_grab_regssab();
xercon = (ppc_state.ppc_spr[SPR::XER] & 0x80000000UL) >> 3;
cmp_c = (((int32_t)ppc_result_a) == ((int32_t)ppc_result_b)) ? 0x20000000UL : (((int32_t)ppc_result_a) > ((int32_t)ppc_result_b)) ? 0x40000000UL : 0x80000000UL;
ppc_state.ppc_cr = ((ppc_state.ppc_cr & ~(0xf0000000UL >> crf_d)) | ((cmp_c + xercon) >> crf_d));
//}
//else{
// printf("Warning: Invalid CMP Instruction.");
//}
}
void ppc_cmpi() {
#ifdef CHECK_INVALID
if (ppc_cur_instruction & 0x200000) {
printf("WARNING: invalid CMPI instruction form (L=1)!\n");
LOG_F(WARNING, "Invalid CMPI instruction form (L=1)!\n");
return;
}
#endif
@ -1633,7 +1635,7 @@ void ppc_cmpi() {
void ppc_cmpl() {
#ifdef CHECK_INVALID
if (ppc_cur_instruction & 0x200000) {
printf("WARNING: invalid CMPL instruction form (L=1)!\n");
LOG_F(WARNING, "Invalid CMPL instruction form (L=1)!\n");
return;
}
#endif
@ -1649,7 +1651,7 @@ void ppc_cmpl() {
void ppc_cmpli() {
#ifdef CHECK_INVALID
if (ppc_cur_instruction & 0x200000) {
printf("WARNING: invalid CMPLI instruction form (L=1)!\n");
LOG_F(WARNING, "Invalid CMPLI instruction form (L=1)!\n");
return;
}
#endif

View File

@ -5,6 +5,7 @@
//if you want to distribute this.
//(divingkatae#1017 or powermax#2286 on Discord)
#include <thirdparty/loguru.hpp>
#include <cinttypes>
#include <iostream>
#include "macio.h"
@ -44,18 +45,16 @@ void HeathrowIC::pci_cfg_write(uint32_t reg_offs, uint32_t value, uint32_t size)
case CFG_REG_BAR0: // base address register
value = LE2BE(value);
if (value == 0xFFFFFFFF) {
cout << this->name << " err: BAR0 block size determination not "
<< "implemented yet" << endl;
LOG_F(ERROR, "%s err: BAR0 block size determination not \
implemented yet \n", this->name.c_str());
} else if (value & 1) {
cout << this->name << " err: BAR0 I/O space not supported!" << endl;
LOG_F(ERROR, "%s err: BAR0 I/O space not supported! \n", this->name.c_str());
} else if (value & 0x06) {
cout << this->name << " err: BAR0 64-bit I/O space not supported!"
<< endl;
LOG_F(ERROR, "%s err: BAR0 64-bit I/O space not supported! \n", this->name.c_str());
} else {
this->base_addr = value & 0xFFF80000;
this->host_instance->pci_register_mmio_region(this->base_addr, 0x80000, this);
cout << this->name << " base address set to " << hex << this->base_addr
<< endl;
LOG_F(ERROR, "%s base address set to %x \n", this->name.c_str(), this->base_addr);
}
break;
}
@ -65,7 +64,7 @@ uint32_t HeathrowIC::read(uint32_t offset, int size)
{
uint32_t res = 0;
cout << this->name << ": reading from offset " << hex << offset << endl;
LOG_F(INFO, "%s: reading from offset %x \n", this->name.c_str(), offset);
unsigned sub_addr = (offset >> 12) & 0x7F;
@ -74,10 +73,10 @@ uint32_t HeathrowIC::read(uint32_t offset, int size)
res = mio_ctrl_read(offset, size);
break;
case 8:
cout << "DMA channel register space" << endl;
LOG_F(INFO, "Attempting to read DMA channel register space \n");
break;
case 0x14:
cout << "AWACS-Screamer register space" << endl;
LOG_F(INFO, "Attempting to read AWACS-Screamer register space \n");
break;
case 0x16:
case 0x17:
@ -87,7 +86,7 @@ uint32_t HeathrowIC::read(uint32_t offset, int size)
if (sub_addr >= 0x60) {
res = this->nvram->read_byte((offset - 0x60000) >> 4);
} else {
cout << "unmapped I/O space: " << hex << offset << endl;
LOG_F(WARNING, "Attempting to read unmapped I/O space: %x \n", offset);
}
}
@ -96,7 +95,7 @@ uint32_t HeathrowIC::read(uint32_t offset, int size)
void HeathrowIC::write(uint32_t offset, uint32_t value, int size)
{
cout << this->name << ": writing to offset " << hex << offset << endl;
LOG_F(INFO, "%s: writing to offset %x \n", this->name.c_str(), offset);
unsigned sub_addr = (offset >> 12) & 0x7F;
@ -105,10 +104,10 @@ void HeathrowIC::write(uint32_t offset, uint32_t value, int size)
mio_ctrl_write(offset, value, size);
break;
case 8:
cout << "DMA channel register space" << endl;
LOG_F(INFO, "Attempting to write to DMA channel register space \n");
break;
case 0x14:
cout << "AWACS-Screamer register space" << endl;
LOG_F(INFO, "Attempting to write to AWACS-Screamer register space \n");
break;
case 0x16:
case 0x17:
@ -118,7 +117,7 @@ void HeathrowIC::write(uint32_t offset, uint32_t value, int size)
if (sub_addr >= 0x60) {
this->nvram->write_byte((offset - 0x60000) >> 4, value);
} else {
cout << "unmapped I/O space: " << hex << offset << endl;
LOG_F(WARNING, "Attempting to write to unmapped I/O space: %x \n", offset);
}
}
}
@ -129,22 +128,22 @@ uint32_t HeathrowIC::mio_ctrl_read(uint32_t offset, int size)
switch(offset & 0xFF) {
case 0x24:
cout << "read from MIO:Int_Mask1 register" << endl;
LOG_F(INFO, "read from MIO:Int_Mask1 register \n");
res = this->int_mask1;
break;
case 0x28:
cout << "read from MIO:Int_Clear1 register" << endl;
LOG_F(INFO, "read from MIO:Int_Clear1 register \n");
res = this->int_clear1;
break;
case 0x34: /* heathrowIDs / HEATHROW_MBCR (Linux): media bay config reg? */
res = 0xF0700000UL;
break;
case 0x38:
cout << "read from MIO:Feat_Ctrl register" << endl;
LOG_F(INFO, "read from MIO:Feat_Ctrl register \n");
res = this->feat_ctrl;
break;
default:
cout << "unknown MIO register at " << hex << offset << endl;
LOG_F(WARNING, "unknown MIO register at %x \n", offset);
break;
}
@ -155,19 +154,19 @@ void HeathrowIC::mio_ctrl_write(uint32_t offset, uint32_t value, int size)
{
switch(offset & 0xFF) {
case 0x24:
cout << "write " << hex << value << " to MIO:Int_Mask1 register" << endl;
LOG_F(INFO, "write %x to MIO:Int_Mask1 register \n", value);
this->int_mask1 = value;
break;
case 0x28:
cout << "write " << hex << value << " to MIO:Int_Clear1 register" << endl;
LOG_F(INFO, "write %x to MIO:Int_Clear1 register \n", value);
this->int_clear1 = value;
break;
case 0x38:
cout << "write " << hex << value << " to MIO:Feat_Ctrl register" << endl;
LOG_F(INFO, "write %x to MIO:Feat_Ctrl register \n", value);
this->feat_ctrl = value;
break;
default:
cout << "unknown MIO register at " << hex << offset << endl;
LOG_F(WARNING, "unknown MIO register at %x \n", offset);
break;
}
}

View File

@ -138,7 +138,7 @@ uint32_t MPC106::pci_cfg_read(uint32_t reg_offs, uint32_t size)
void MPC106::pci_cfg_write(uint32_t reg_offs, uint32_t value, uint32_t size)
{
#ifdef MPC106_DEBUG
LOG_F(ERROR, "write %08X to Grackle register %08X\n", value, reg_offs);
LOG_F(INFO, "write %08X to Grackle register %08X\n", value, reg_offs);
#endif
// FIXME: implement write-protection for read-only registers

View File

@ -10,7 +10,7 @@
Author: Max Poliakovski 2019
*/
#include <thirdparty/loguru.cpp>
#include <thirdparty/loguru.hpp>
#include <iostream>
#include <fstream>
#include <cinttypes>
@ -236,9 +236,9 @@ void ViaCuda::cuda_process_packet()
LOG_F(INFO, "Command: %x \n", (uint32_t)(this->in_buf[1]));
LOG_F(INFO, "Data count: %d \n ", this->in_count);
for (int i = 0; i < this->in_count; i++) {
cout << hex << (uint32_t)(this->in_buf[i]) << ", ";
LOG_F(INFO, "%x ,", (uint32_t)(this->in_buf[i]));
}
cout << endl;
LOG_F(INFO, "\n");
cuda_pseudo_command(this->in_buf[1], this->in_count - 2);
break;
default: