Project

General

Profile

Emulator Issues #11528

Debugger displays wrong bitmask

Added by nwplayer123 about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

I've run into an instruction (rlwimi r6, r7, 16, 6, 15) that displays the wrong bitmask, debugger shows it as 0x000003FF when it should be 0x03FF0000 (bits 6-15), I've tracked it down to this line, with HelperRotateMask. I'm not sure if it's the disassembler or the interpreter too but it's worth double checking, rlwinm/rlwimi is a pain. Instruction opcode is 0x50E6819E, used in every GameCube game in MEMIntrruptHandler+0x2C
https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Common/GekkoDisassembler.cpp#L615

Screenshot_76.png (34.1 KB) Screenshot_76.png nwplayer123, 01/15/2019 12:47 AM
7189

History

#1 Updated by taolas about 1 month ago

12345678 rl 16 -> 56781234 wimi 6, 15 -> 06780000 (678 = 3FF).

Therefore unscrambled: a mask 3FF is applied to 678 = 000003FF. It's correct, as it takes the rotation into account. You just did the mask. Using the rotation and mask is good because you can look at the original hex and immediately know what's being masked.

#2 Updated by nwplayer123 about 1 month ago

7189

Should still be 0x03FF0000, upper halfword is 0x4022, lower halfword is 0x4024, that's how it gets this address, insert 10 bits at bit 6(to 15)
https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/MemoryInterface.cpp#L115

#3 Updated by taolas about 1 month ago

Insert what 10 bits? Isn't the helper consistently showing the what and not the where to?
What would you expect rlwimi r6, r7, 20, 6, 15 to show, the same 0x03FF0000?

I could be wrong here, but it seems to be consistent with what it's showing.

#4 Updated by nwplayer123 about 1 month ago

oh, yeah, I guess that's what I'm thinking of. I'm expecting the where to and not the what. insrwi is just the simplified opcode for that rlwimi, insert right word immediate. I'm expecting it to be 0x03FF0000 cuz it overwrites those bits in r6 vs what it takes from r7.

Also available in: Atom PDF