Hi all, 

I'm trying to run **_addr** **m5ops**. I need the _addr version because I want 
to implement a pseudo instruction that works in all gem5 cpu types, including 
KVM, which only supports _addr pseudo instructions.

If I use this code 
(https://gem5.googlesource.com/public/gem5-resources/+/refs/tags/v21.1.0.2/src/simple/m5_exit_addr.c)

as example:

        `#include <gem5/m5ops.h>`\
`       #include <m5_mmap.h>`\
`       #include <stdio.h>`\
`       int main(void) {`\
`       #if defined(__aarch64__)`\
`           m5op_addr = 0x10010000;`\
`       #endif`\
`           map_m5_mem();`\
`           m5_exit_addr(0);`\
`       }`

I built m5ops following https://www.gem5.org/documentation/general_docs/m5ops/

I compile the test application with:

`gcc test.c -o test -L ~/Projects/gem5/util/m5/build/x86/out -lm5 -I 
~/Projects/gem5/include -I ~/Projects/gem5/util/m5/src -static`

If I run with AtomicSimpleCPU I get

`./build/X86/gem5.opt configs/example/se.py -c tests/test-progs/pedro-test/test 
--cpu-type AtomicSimpleCPU`

`**** REAL SIMULATION ****`\
`build/X86/sim/simulate.cc:107: info: Entering event queue @ 0.  Starting 
simulation...`\
`build/X86/sim/mem_state.cc:443: info: Increasing stack size by one page.`\
`build/X86/sim/syscall_emul.cc:73: warn: ignoring syscall mprotect(...)`\
`build/X86/sim/mem_state.cc:443: info: Increasing stack size by one page.`\
`build/X86/sim/mem_state.cc:443: info: Increasing stack size by one page.`\
`Can't open /dev/mem: Permission denied`\
`Exiting @ tick 11031000 because exiting with last active thread context`\
`Simulated exit code not 0! Exit code is 1`

If I run with KvmCPU 

`./build/X86/gem5.opt configs/example/se.py -c tests/test-progs/pedro-test/test 
--cpu-type X86KvmCPU`

\[...\]

`build/X86/cpu/kvm/x86_cpu.cc:1556: warn: kvm-x86: MSR (0x491) unsupported by 
gem5. Skipping.`\
`build/X86/cpu/kvm/x86_cpu.cc:1556: warn: kvm-x86: MSR (0xc0010015) unsupported 
by gem5. Skipping.`\
`build/X86/cpu/kvm/x86_cpu.cc:1556: warn: kvm-x86: MSR (0x4b564d05) unsupported 
by gem5. Skipping.`\
`build/X86/cpu/kvm/x86_cpu.cc:450: warn: Illegal SS type: 1`\
`build/X86/cpu/kvm/x86_cpu.cc:491: warn: ss: S flag not set`\
`build/X86/cpu/kvm/x86_cpu.cc:517: warn: ss: P flag not set`\
`build/X86/sim/mem_state.cc:443: info: Increasing stack size by one page.`\
`build/X86/cpu/kvm/x86_cpu.cc:450: warn: Illegal SS type: 1`\
`build/X86/cpu/kvm/x86_cpu.cc:491: warn: ss: S flag not set`\
`build/X86/cpu/kvm/x86_cpu.cc:517: warn: ss: P flag not set`\
`build/X86/cpu/kvm/x86_cpu.cc:450: warn: Illegal SS type: 1`\
`build/X86/cpu/kvm/x86_cpu.cc:491: warn: ss: S flag not set`\
`build/X86/cpu/kvm/x86_cpu.cc:517: warn: ss: P flag not set`\
`build/X86/sim/syscall_emul.cc:73: warn: ignoring syscall mprotect(...)`\
`build/X86/arch/x86/linux/se_workload.cc:162: panic: Page fault at addr 0`\
`       Interrupt handler stack:`\
`       ss: 0x1b`\
`       rsp: 0x7fffffffed18`\
`       rflags: 0x10006`\
`       cs: 0x23`\
`       rip: 0x45ca46`\
`       err_code: 0x4`\
`Memory Usage: 636056 KBytes`\
`Program aborted at tick 441533000`\
`--- BEGIN LIBC BACKTRACE ---`\
`./build/X86/gem5.opt(+0x883420)[0x560e0d238420]`\
`./build/X86/gem5.opt(+0x8a4ade)[0x560e0d259ade]`\
`/lib/x86_64-linux-gnu/libpthread.so.0(+0x143c0)[0x7f7c671cb3c0]`\
`/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f7c6637103b]`\
`/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f7c66350859]`\
`./build/X86/gem5.opt(+0x30b5e5)[0x560e0ccc05e5]`\
`./build/X86/gem5.opt(+0xd6109c)[0x560e0d71609c]`\
`./build/X86/gem5.opt(+0xd611db)[0x560e0d7161db]`\
`./build/X86/gem5.opt(+0x913645)[0x560e0d2c8645]`\
`./build/X86/gem5.opt(+0x9827ee)[0x560e0d3377ee]`\
`./build/X86/gem5.opt(+0x983a1a)[0x560e0d338a1a]`\
`./build/X86/gem5.opt(+0x9811c1)[0x560e0d3361c1]`\
`./build/X86/gem5.opt(+0x552ba6)[0x560e0cf07ba6]`\
`./build/X86/gem5.opt(+0x5530ae)[0x560e0cf080ae]`\
`./build/X86/gem5.opt(+0x551b91)[0x560e0cf06b91]`\
`./build/X86/gem5.opt(+0x892796)[0x560e0d247796]`\
`./build/X86/gem5.opt(+0x8c14f4)[0x560e0d2764f4]`\
`./build/X86/gem5.opt(+0x8c1d42)[0x560e0d276d42]`\
`./build/X86/gem5.opt(+0xe1ec92)[0x560e0d7d3c92]`\
`./build/X86/gem5.opt(+0x5bfef1)[0x560e0cf74ef1]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x2a8738)[0x7f7c67482738]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x8dd8)[0x7f7c67257f48]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x8fb)[0x7f7c673a4e3b]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x94)[0x7f7c67482114]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x74d6d)[0x7f7c6724ed6d]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x7d86)[0x7f7c67256ef6]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x8006b)[0x7f7c6725a06b]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x74d6d)[0x7f7c6724ed6d]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x12fd)[0x7f7c6725046d]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x8fb)[0x7f7c673a4e3b]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(_PyFunction_Vectorcall+0x94)[0x7f7c67482114]`\
`/lib/x86_64-linux-gnu/libpython3.8.so.1.0(+0x74d6d)[0x7f7c6724ed6d]`\
`--- END LIBC BACKTRACE ---`\
`Aborted (core dumped)`

Any ideas of why am I getting a /dev/mem permission denied with atomic simple 
cpu and then panic error on KVM?

Thank you.

Ubuntu 20.04

gem5 version 21.1.0.2
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to