From 46bc8567e975302a16306eca67632ba9883db60f Mon Sep 17 00:00:00 2001 From: joevt Date: Wed, 21 Dec 2022 03:36:48 -0800 Subject: [PATCH] Fix compiler warnings: uninitialized variables. - mpc601_block_address_translation will now return 0 for prot and pa when bat_hit is false (when the if statement is not positive during the for loop). The calling function doesn't care what prot and pa are when bat_hit is false, but we do this to remove the compiler warining. - For tlb_flush_entry, the compiler thinks m might not always be in the range 0 to 5 so tlb1 and tlb2 might not get initialized by the switch statement. Add default to get around this warning. --- cpu/ppc/ppcmmu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpu/ppc/ppcmmu.cpp b/cpu/ppc/ppcmmu.cpp index 006acc4..cfc3a06 100644 --- a/cpu/ppc/ppcmmu.cpp +++ b/cpu/ppc/ppcmmu.cpp @@ -125,11 +125,11 @@ static BATResult mpc601_block_address_translation(uint32_t la) // logical to physical translation pa = bat_entry->phys_hi | (la & ~bat_entry->hi_mask); - break; + return BATResult{bat_hit, prot, pa}; } } - return BATResult{bat_hit, prot, pa}; + return BATResult{bat_hit, 0, 0}; } /** PowerPC-style block address translation. */ @@ -742,6 +742,7 @@ void tlb_flush_entry(uint32_t ea) tlb1 = &dtlb1_mode2[0]; tlb2 = &dtlb2_mode2[0]; break; + default: case 5: tlb1 = &dtlb1_mode3[0]; tlb2 = &dtlb2_mode3[0];