简体   繁体   中英

Undefined TLBI instruction for armv8 processor in gem5

I encountered a gem5 error while running gem5 fs simulation for aarch64 in bare metal mode. Especially, when my custom boot code tried to invalidate TLB with an assembly instruction tlbi ALLE3 , the simulator reported the following message:

system.cpu T0 : @core0+72    :   msr   tlbi_alle3, xzr    : IntAlu :
Undefined Instruction: Invoking Fault (AArch64 target EL) : Undefined Instruction cpsr:0x3c5 PC:0x2186c elr:0x2186c newVec: 0xa00

Also, I tested with "tlbi ALLE1" but it ended up with the same error. For your reference, I configured a cpu type with TimingSimpleCPU. Based on the message, the passed tlbi instruction seems to be unimplemented in ARM64 processor model. However, since I know that gem5 successfully boots Linux for aarch64 in fs mode, I am wondering how the case could handle the tlbi instruction. In other words, if the tlbi instruction is really unimplemented instruction in gem5, I think that booting Linux should also have run into the same error. Can I know if anyone has experienced the undefined instruction fault of tlbi in gem5? Thanks for your answer/comment in advance.

Update1 : Further investigation showed that tlbi VMALLE3 did not cause any error, while tlbi ALLE3 instruction caused an undefined instruction fault.

The Linux kernel only exercises a subset of all ARM functionality.

For example, Linux v4.18 ARMv7 broke because it started using CSDB, and so we just marked that instruction as ignored for now: https://github.com/gem5/gem5/commit/33b311d8d8b8d527d500d62a35b50be63e41b556 which just emits a warning instead, since that instruction is implementation defined and could be a NOP.

Notably, there are several ARMv8.x instructions which are not yet implemented.

So I recommend the following:

  • grep the .isa files under src/arch/arm/isa/ and search for the exact tlbi encoding that you are using.

    Those files are responsible for the instruction decoding, so if an instruction is implemented, that is where you have to look.

    There are already hits under tlbi , but make sure that your exact instruction bytes are going to the right place.

    GDB step debug gem5 if necessary, and remember that there might be a decoding bug and that the bytes actually should be another instruction.

  • Actually do a Linux kernel boot trace with --debug-flags=Exec and see if it contains the mentioned instruction.

  • Provide a line of assembly that reproduces the problem, and a GNU GAS version used to assemble it so that others can reproduce.

If you find that there is a missing encoding, and are able to implement it fully, or if it is a implementation defined NOP like CSDB just ignore it with a warning, send a patch on Gerrit and CC me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM