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

Q: highly likely incorrect aarch64 ldaxrh instruction disassembly #788

Open
alsam opened this issue Jan 19, 2024 · 2 comments
Open

Q: highly likely incorrect aarch64 ldaxrh instruction disassembly #788

alsam opened this issue Jan 19, 2024 · 2 comments
Labels
arch-arm The ARM ISA bug

Comments

@alsam
Copy link

alsam commented Jan 19, 2024

Hello, the code in the latest stable trunk src/arch/arm/insts/mem64.cc

std::string
MemoryEx64::generateDisassembly(
        Addr pc, const loader::SymbolTable *symtab) const
{
    std::stringstream ss;
    printMnemonic(ss, "", false);
    printIntReg(ss, dest);
    ccprintf(ss, ", ");
    printIntReg(ss, result);
    ccprintf(ss, ", [");
    printIntReg(ss, base);
    ccprintf(ss, "]");
    return ss.str();
}

generates a disassembly for the aarch64 instruction ldaxrh e.g.

ldaxrh w10, wzr, [w0]

with 3 operands instead of 2 follow the ARM reference.
Android toolchain fails to assembly the generated disassembly as expects two operands for the instruction instead of given 3.

I would rather expect to see here:

ldaxrh w10, [w0]
@alsam alsam added the bug label Jan 19, 2024
@giactra
Copy link
Contributor

giactra commented Feb 15, 2024

Disassembling in gem5 has some known issues... I am sure the reason why we are printing in that format is because MemoryEx64 is shared between load and store exclusive. The clean solution would be to provide a different generateDisassembly implementation for load exclusive.

This should definitely be fixed so I am keeping the issue open, but I regard this as low priority: I will deal with it when I'll have some free time. FYI To mitigate the annoyance of dealing with an incorrect disassembly we integrated gem5 with the capstone disassembler: #494

Hope this helps.

@giactra giactra added the arch-arm The ARM ISA label Feb 15, 2024
@alsam
Copy link
Author

alsam commented Feb 16, 2024

Thank you @giactra !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm The ARM ISA bug
Projects
None yet
Development

No branches or pull requests

2 participants