Yes, but you need to use the magic address call mechanism, not the default
special instruction mechanism which KVM doesn't recognize since it's
executing on real hardware. If you're calling from userspace, then you can
use the map_m5_mem() function to mmap /dev/mem so you can access the right
physical address, and then use the m5_exit_addr function (this CL adds it
to the header: https://gem5-review.googlesource.com/c/public/gem5/+/36896).
It looks like you're calling it from the kernel which the library was not
designed to handle. Instead of calling map_m5_mem, you'd need to set up a
virtual to physical mapping for the magic address on your own somehow, and
then set the m5_mem pointer to whatever virtual address it should use.

Gabe

On Wed, Nov 4, 2020 at 3:00 PM Patrick Sheridan (psheridan) via gem5-users <
[email protected]> wrote:

> Micron Confidential
>
> I was wondering if it is possible to use m5ops (e.g. m5_exit(0)) while
> using the X86KvmCPU.  Currently, when I hit this instruction, rather than
> exiting, the kernel panics with the message below.  If this is not
> possible, is there a workaround to use the X86KvmCPU to fast-forward to a
> region of interest?
>
>
>
> traps: Application[1] trap invalid opcode ip:402459 sp:7fff84d38c00
> error:0 in Application[400000+10000]
>
> Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
>
> CPU: 0 PID: 1 Comm: Application Not tainted 5.2.3 #3
>
> Hardware name:  , BIOS  06/08/2008
>
> Call Trace:
>
> dump_stack+0x46/0x59
>
> panic+0xf6/0x2b7
>
> do_exit+0x513/0x951
>
> do_group_exit+0x93/0x93
>
> get_signal+0x68a/0x6b0
>
> ? try_to_wake_up+0x311/0x337
>
> do_signal+0x2b/0x4e1
>
> ? signal_wake_up_state+0x11/0x21
>
> ? __send_signal.constprop.0+0x1f2/0x2da
>
> ? invalid_op+0xa/0x20
>
> exit_to_usermode_loop+0x38/0x8b
>
> ? invalid_op+0xa/0x20
>
> prepare_exit_to_usermode+0x66/0x91
>
> retint_user+0x8/0x8
>
> RIP: 0033:0x402459
>
> Code: Bad RIP value.
>
> RSP: 002b:00007fff84d38c00 EFLAGS: 00010246
>
> RAX: 0000000000000051 RBX: 00007fff84d38e78 RCX: 00007f781ac20133
>
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
>
> RBP: 0000000000000001 R08: 0000000000000051 R09: 000000000000002e
>
> R10: 00007fff84d38a23 R11: 0000000000000246 R12: 00007fff84d38e58
>
> R13: 00007fff84d38e50 R14: 0000000000000000 R15: 0000000000000000
>
> Kernel Offset: disabled
>
> ---[ end Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x00000004 ]---
>
> Micron Confidential
> _______________________________________________
> gem5-users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
_______________________________________________
gem5-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to