More code clean-up

This commit is contained in:
dingusdev 2024-09-08 13:19:07 -07:00
parent 3c2887f8c3
commit 9d9e826bb3
6 changed files with 15 additions and 28 deletions

View File

@ -746,7 +746,7 @@ void dppc_interpreter::ppc_stfs() {
ppc_grab_regsfpsia(ppc_cur_instruction);
uint32_t ea = int32_t(int16_t(ppc_cur_instruction));
ea += (reg_a) ? val_reg_a : 0;
float result = ppc_state.fpr[reg_s].dbl64_r;
float result = float(ppc_state.fpr[reg_s].dbl64_r);
mmu_write_vmem<uint32_t>(ea, *(uint32_t*)(&result));
}
@ -755,7 +755,7 @@ void dppc_interpreter::ppc_stfsu() {
if (reg_a != 0) {
uint32_t ea = int32_t(int16_t(ppc_cur_instruction));
ea += val_reg_a;
float result = ppc_state.fpr[reg_s].dbl64_r;
float result = float(ppc_state.fpr[reg_s].dbl64_r);
mmu_write_vmem<uint32_t>(ea, *(uint32_t*)(&result));
ppc_state.gpr[reg_a] = ea;
} else {
@ -766,7 +766,7 @@ void dppc_interpreter::ppc_stfsu() {
void dppc_interpreter::ppc_stfsx() {
ppc_grab_regsfpsiab(ppc_cur_instruction);
uint32_t ea = val_reg_b + (reg_a ? val_reg_a : 0);
float result = ppc_state.fpr[reg_s].dbl64_r;
float result = float(ppc_state.fpr[reg_s].dbl64_r);
mmu_write_vmem<uint32_t>(ea, *(uint32_t*)(&result));
}
@ -774,7 +774,7 @@ void dppc_interpreter::ppc_stfsux() {
ppc_grab_regsfpsiab(ppc_cur_instruction);
if (reg_a) {
uint32_t ea = val_reg_a + val_reg_b;
float result = ppc_state.fpr[reg_s].dbl64_r;
float result = float(ppc_state.fpr[reg_s].dbl64_r);
mmu_write_vmem<uint32_t>(ea, *(uint32_t*)(&result));
ppc_state.gpr[reg_a] = ea;
} else {

View File

@ -372,7 +372,7 @@ uint32_t tlb_size_mask = TLB_SIZE - 1;
// fake TLB entry for handling of unmapped memory accesses
uint64_t UnmappedVal = -1ULL;
TLBEntry UnmappedMem = {TLB_INVALID_TAG, TLBFlags::PAGE_NOPHYS, 0, 0};
TLBEntry UnmappedMem = {TLB_INVALID_TAG, TLBFlags::PAGE_NOPHYS, 0, {{0}}};
uint8_t CurITLBMode = {0xFF}; // current ITLB mode
uint8_t CurDTLBMode = {0xFF}; // current DTLB mode

View File

@ -134,17 +134,4 @@ extern T mmu_read_vmem(uint32_t guest_va);
template <class T>
extern void mmu_write_vmem(uint32_t guest_va, T value);
//====================== Deprecated calls =========================
#if 0
extern void mem_write_byte(uint32_t addr, uint8_t value);
extern void mem_write_word(uint32_t addr, uint16_t value);
extern void mem_write_dword(uint32_t addr, uint32_t value);
extern void mem_write_qword(uint32_t addr, uint64_t value);
extern uint8_t mem_grab_byte(uint32_t addr);
extern uint16_t mem_grab_word(uint32_t addr);
extern uint32_t mem_grab_dword(uint32_t addr);
extern uint64_t mem_grab_qword(uint32_t addr);
extern uint8_t* quickinstruction_translate(uint32_t address_grab);
#endif
#endif // PPCMMU_H

View File

@ -47,7 +47,7 @@ void ppc_changecrf0(uint32_t set_result) {
}
// Affects the XER register's Carry Bit
inline void ppc_carry(uint32_t a, uint32_t b) {
inline static void ppc_carry(uint32_t a, uint32_t b) {
if (b < a) {
ppc_state.spr[SPR::XER] |= XER::CA;
} else {
@ -55,7 +55,7 @@ inline void ppc_carry(uint32_t a, uint32_t b) {
}
}
inline void ppc_carry_sub(uint32_t a, uint32_t b) {
inline static void ppc_carry_sub(uint32_t a, uint32_t b) {
if (b >= a) {
ppc_state.spr[SPR::XER] |= XER::CA;
} else {
@ -65,7 +65,7 @@ inline void ppc_carry_sub(uint32_t a, uint32_t b) {
// Affects the XER register's SO and OV Bits
inline void ppc_setsoov(uint32_t a, uint32_t b, uint32_t d) {
inline static void ppc_setsoov(uint32_t a, uint32_t b, uint32_t d) {
if (int32_t((a ^ b) & (a ^ d)) < 0) {
ppc_state.spr[SPR::XER] |= XER::SO | XER::OV;
} else {
@ -84,7 +84,7 @@ void do_ctx_sync() {
}
}
void add_ctx_sync_action(const CtxSyncCallback &cb) {
static void add_ctx_sync_action(const CtxSyncCallback& cb) {
gCtxSyncCallbacks.push_back(cb);
}

View File

@ -60,7 +60,7 @@ static uint32_t str2env(string& num_str) {
bool OfConfigAppl::validate() {
int i;
OfConfigHdrAppl hdr;
OfConfigHdrAppl hdr{};
if (this->nvram_obj == nullptr)
return false;
@ -151,9 +151,9 @@ const OfConfigImpl::config_dict& OfConfigAppl::get_config_vars() {
// populate the remaining variables
for (auto& var : of_vars) {
auto name = var.first;
auto type = std::get<0>(var.second);
auto offset = std::get<1>(var.second);
auto& name = var.first;
auto type = std::get<0>(var.second);
auto offset = std::get<1>(var.second);
switch (type) {
case OF_VAR_TYPE_INT:
@ -354,7 +354,7 @@ bool OfConfigChrp::validate()
if (!of_part_found)
return false;
OfConfigHdrChrp hdr;
OfConfigHdrChrp hdr{};
// read OF partition header
for (i = 0; i < sizeof(OfConfigHdrChrp); i++) {

View File

@ -100,7 +100,7 @@ uint8_t MeshController::read(uint8_t reg_offset) {
}
void MeshController::write(uint8_t reg_offset, uint8_t value) {
uint16_t new_stat;
//uint16_t new_stat;
switch(reg_offset) {
case MeshReg::XferCount0: