Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TriCore disassembly seams to be wrong #7480

Open
gmgunderground opened this issue Feb 11, 2025 · 1 comment
Open

TriCore disassembly seams to be wrong #7480

gmgunderground opened this issue Feb 11, 2025 · 1 comment
Assignees
Labels
Feature: Processor/Tricore Status: Triage Information is being gathered Type: Bug Something isn't working

Comments

@gmgunderground
Copy link

Can someone explane the disassembly ? I think it's completely wrong or completely foolish .

Image

The following code

iVar1 = ((int)(char)(BYTE_60005196 & 0x3f) << 0x1a) >> 0x1a;
return (0x1 << iVar1) * (uint)(-0x1 < iVar1) + (0x1U >> -iVar1) * (uint)(-0x1 >= iVar1);

should be

iVar1  =  (* (byte *)BYTE_60005196) << 1;
return ivar1;
@GhidorahRex
Copy link
Collaborator

the SH D[c], D[a], D[b] instruction takes D[a] and shifts it by D[b] where the shift is a signed number which can be positive or negative. So it should be d2 = d15 << d2 or iVar1 = 1 << (* (byte *) BYTE_6005196) without knowing whether the shift is positive or negative, we can't be sure about whether the shift is left or right.

The iVar1 = ((int)(char)(BYTE_60005196 & 0x3f) << 0x1a) >> 0x1a; is messy. The pcode for the shift instruction is using a pair of shifts to mask off the upper bits of the shift amount.

@GhidorahRex GhidorahRex self-assigned this Feb 11, 2025
@GhidorahRex GhidorahRex added Type: Bug Something isn't working Feature: Processor/Tricore Status: Triage Information is being gathered labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Processor/Tricore Status: Triage Information is being gathered Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants