How to introduce an MSR in gem5 and integrate it with Linux kernel?

107 Views Asked by At

I am trying to evaluate performance of custom prefetching models for Intel x86 architecture for which I would like to set and read some MSR registers. We are using Gem5 and Linux 5.4.84 kernel on a TimingSimpleCPU.

I have introduced the registers at some unused address in these files: https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/src/arch/x86/regs/msr.cc https://gem5.googlesource.com/public/gem5/+/refs/heads/stable/src/arch/x86/regs/misc.hh say MY_CUSTOM_REGISTER at 0xc0010118

I have also defined these addresses in : https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/msr-index.h https://github.com/torvalds/linux/blob/master/tools/testing/selftests/kvm/include/x86_64/processor.h

as I felt that somehow we need to add definitions in the kernel too.

However, after building gem5.opt binary and kernel, I am not able to access these registers with msr-tools. I get a segmentation fault while trying to get/set any values: sudo rdmsr 0xc0010118

Can someone point out somewhere else I need to add something?

0

There are 0 best solutions below