QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Benjamin <benjamin@thatjames.org>
To: qemu-devel@nongnu.org
Subject: Qemu TCG Plugins - how to access guest registers
Date: Thu, 26 Mar 2020 15:32:59 -0600
Message-ID: <CAOragkxgc1cCz9S7oexiELhkvkWiRUW21p+L17Ra40PGCdN4hA@mail.gmail.com> (raw)


[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

Qemu version 4.2.0 includes new functionality for something called TCG
Plugins. There are a few examples in the tests/plugins directory, and the
API is more or less defined in qemu-plugin.h.

This file defines two enumerated types, "qemu_plugin_cb_flags" and
"qemu_plugin_mem_rw", which are passed into functions that register
callbacks. These enums seem to indicate whether the callbacks will read or
write CPU registers or memory. However, all of the example plugins use
"QEMU_PLUGIN_CB_NO_REGS", and only 2 of the plugins use the memory access
enum. hotpages.c and mem.c use "QEMU_PLUGIN_MEM_RW" as the default for
registering a memory callback (qemu_plugin_register_vcpu_mem_cb). mem.c has
an argument when the plugin is loaded to choose if it's read or write,
however, it doesn't seem to make any difference in the callback function.

My question is, how do I access the guest memory and registers from the
plugin callback function? The API seems to indicate that it is possible,
since the callback registering requires you to say if you will access them,
and if it's RW or just read.

Are there any examples of using this part of the API? I realize this is a
very new part of Qemu functionality.

Thanks

[-- Attachment #2: Type: text/html, Size: 1480 bytes --]

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOragkxgc1cCz9S7oexiELhkvkWiRUW21p+L17Ra40PGCdN4hA@mail.gmail.com \
    --to=benjamin@thatjames.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git