This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading register values on FVP

Hello,

While executing programs on FVP (MORELLO PLATFORM MODEL target architecture is morello-purecap) with CHERIBSD OS I like to trace the register values. Any information on how to get it please.

Parents
  • We used this technique for some earlier work, and recorded our method: https://github.com/capablevms/cheri_misidioms/blob/master/code/fvp-analyses/README
    It might work for you, depending on what you're trying to do.

    As a summary:

    You can get the model to generate "TARMAC" trace, but since you're running an OS, you won't want to run it from the start because it traces the whole system and produces a huge amount of output. Instead, you'll want to enable "ToggleMTIPlugin", and then execute a special HLT instruction (typically hlt #0xbeef) from your workload to turn the tracing on and off.

    You'll get a trace that looks something like this:

      314 clk cluster1.cpu1 IT (4950928406) (1|ffffc00000010005|ffff0000004ebc5c):0000f04ebc5c_NS aa0003f4 O EL1h_n : MOV      x20,x0
      314 clk cluster1.cpu1 R X20 FFFF0000E7EF6000
      315 clk cluster1.cpu1 IT (4950928407) (1|ffffc00000010005|ffff0000004ebc60):0000f04ebc60_NS b9400035 O EL1h_n : LDR      w21,[x1,#0]
      315 clk cluster1.cpu1 R X21 0000000000000001
      316 clk cluster1.cpu1 IT (4950928408) (1|ffffc00000010005|ffff0000004ebc64):0000f04ebc64_NS 42c08420 O EL1h_n : LDP      c0,c1,[x1,#0x10]
      316 clk cluster1.cpu1 R C0 1|dc5dc00050a45094|0000000040185094
      316 clk cluster1.cpu1 R C1 1|dc5d40007a30fa20|0000fffffff7fa20

    Notably, this is still a full-system trace, so if any other task (or the kernel) is active, it'll show up here too. That often doesn't matter, but it might do.

    If you want to map this back to ELF symbols, you'll also need to record the VM mappings, and use some tool to combine everything and give you symbol information. On CheriBSD, you can record the mappings using the BSD kinfo_getvmmap (like this). There's a nice tool suite for doing the subsequent analysis, but sadly it doesn't support Morello (or at least, it didn't when we wanted it). We wrote some (much simpler) tools to do a similar thing for Morello FVP.

Reply
  • We used this technique for some earlier work, and recorded our method: https://github.com/capablevms/cheri_misidioms/blob/master/code/fvp-analyses/README
    It might work for you, depending on what you're trying to do.

    As a summary:

    You can get the model to generate "TARMAC" trace, but since you're running an OS, you won't want to run it from the start because it traces the whole system and produces a huge amount of output. Instead, you'll want to enable "ToggleMTIPlugin", and then execute a special HLT instruction (typically hlt #0xbeef) from your workload to turn the tracing on and off.

    You'll get a trace that looks something like this:

      314 clk cluster1.cpu1 IT (4950928406) (1|ffffc00000010005|ffff0000004ebc5c):0000f04ebc5c_NS aa0003f4 O EL1h_n : MOV      x20,x0
      314 clk cluster1.cpu1 R X20 FFFF0000E7EF6000
      315 clk cluster1.cpu1 IT (4950928407) (1|ffffc00000010005|ffff0000004ebc60):0000f04ebc60_NS b9400035 O EL1h_n : LDR      w21,[x1,#0]
      315 clk cluster1.cpu1 R X21 0000000000000001
      316 clk cluster1.cpu1 IT (4950928408) (1|ffffc00000010005|ffff0000004ebc64):0000f04ebc64_NS 42c08420 O EL1h_n : LDP      c0,c1,[x1,#0x10]
      316 clk cluster1.cpu1 R C0 1|dc5dc00050a45094|0000000040185094
      316 clk cluster1.cpu1 R C1 1|dc5d40007a30fa20|0000fffffff7fa20

    Notably, this is still a full-system trace, so if any other task (or the kernel) is active, it'll show up here too. That often doesn't matter, but it might do.

    If you want to map this back to ELF symbols, you'll also need to record the VM mappings, and use some tool to combine everything and give you symbol information. On CheriBSD, you can record the mappings using the BSD kinfo_getvmmap (like this). There's a nice tool suite for doing the subsequent analysis, but sadly it doesn't support Morello (or at least, it didn't when we wanted it). We wrote some (much simpler) tools to do a similar thing for Morello FVP.

Children