From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RY3qD-0002az-Qd for qemu-devel@nongnu.org; Tue, 06 Dec 2011 17:50:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RY3qB-0002uN-RI for qemu-devel@nongnu.org; Tue, 06 Dec 2011 17:50:25 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:41758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RY3qB-0002uH-NZ for qemu-devel@nongnu.org; Tue, 06 Dec 2011 17:50:23 -0500 Received: by iafj26 with SMTP id j26so776926iaf.4 for ; Tue, 06 Dec 2011 14:50:22 -0800 (PST) Message-ID: <4EDE9C2B.4030403@codemonkey.ws> Date: Tue, 06 Dec 2011 16:50:19 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <20111205222208.31271.65662.stgit@ginnungagap.bsc.es> <20111205222225.31271.1747.stgit@ginnungagap.bsc.es> In-Reply-To: <20111205222225.31271.1747.stgit@ginnungagap.bsc.es> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 1/5] backdoor: Add documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TGx1w61zIFZpbGFub3Zh?= Cc: Blue Swirl , Zhi Yong Wu , qemu-devel@nongnu.org On 12/05/2011 04:22 PM, Lluís Vilanova wrote: > Signed-off-by: Lluís Vilanova > --- > docs/backdoor.txt | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 167 insertions(+), 0 deletions(-) > create mode 100644 docs/backdoor.txt > > diff --git a/docs/backdoor.txt b/docs/backdoor.txt > new file mode 100644 > index 0000000..1c6502a > --- /dev/null > +++ b/docs/backdoor.txt > @@ -0,0 +1,167 @@ > += Backdoor communication channel = > + > +== Introduction == > + > +This document describes how the guest can use the backdoor communication channel > +to interact with user-provided code inside QEMU. > + > +The backdoor provides a lightweight and guest-initiated communication channel > +between code running inside the guest system and code in QEMU, including both > +QEMU in 'softmmu' and 'user' modes. > + > +The semantics of the backdoor channel are up to the user, who must provide the > +implementation of the QEMU-side callbacks used when the backdoor channel is > +invoked. > + > +On the guest side, code can be linked against a simple library provided in QEMU > +to interface with the backdoor channel. > + > +The features of this mechanism are: > + > +* Minimal setup for the guest. > +* Independent of guest architecture. > +* Works with 'softmmu' and 'user' mode. > +* Negligible guest overhead; guest invocations of the backdoor channel does not > + go through any OS abstraction, except during the setup of the communication > + channel. > +* Negligible host overhead; invocations of the backdoor channel are interpreted > + by QEMU, while a side-channel can be used as regular memory to communicate > + bulk data without any extra overhead. > +* The user-provided backdoor callbacks can perform arbitrary actions on the > + guest system (e.g., read or write memory, change register values, etc.). > + > + > +== QEMU-side code == > + > +1. Create the "Makefile" to build the user-provided backdoor channel library: > + > + mkdir /tmp/my-backdoor-qemu > + cat> /tmp/my-backdoor-qemu/Makefile< + include $(BUILD_DIR)/config-host.mak > + include $(BUILD_DIR)/$(TARGET_DIR)../config-target.mak > + include $(SRC_PATH)/rules.mak > + > + vpath %.c /tmp/my-backdoor-qemu > + > + > + libbackdoor.a: backdoor.o > + > + > + # Include automatically generated dependency files > + -include $(wildcard *.d) > + EOF > + > +2. Implement the callbacks declared in "backdoor/qemu/qemu-backdoor.h": > + > + cat> /tmp/my-backdoor-qemu/backdoor.c<