qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qmp: extend QMP to provide read/write access to


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH] qmp: extend QMP to provide read/write access to physical memory
Date: Thu, 4 Dec 2014 12:57:33 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, 12/03 19:37, Bryan D. Payne wrote:
> >
> > Out of curiosity, what are existing solutions?
> >
> 
> Basically just attaching gdb and pulling memory out manually (or writing a
> program to do the same).
> 
> 
> > +struct request {
> > > +    uint8_t type;      /* 0 quit, 1 read, 2 write, ... rest reserved */
> > > +    uint64_t address;  /* address to read from OR write to */
> > > +    uint64_t length;   /* number of bytes to read OR write */
> > > +};
> >
> > Please add QEMU_PACKED to this structure, and probably name it
> > QEMUMARequest,
> > for name collision avoidance and CamelCase convension.
> >
> 
> How critical is QEMU_PACKED?  This changes the layout of the struct which
> means that existing clients (LibVMI) would need to change their code as
> well.

It is critical as a transport data structure. You have to define a byte-by-byte
layout (concerning endianness and padding) and use padding fields together with
QEMU_PACKED, so the representation is not dependent on alignment:

http://en.wikipedia.org/wiki/Data_structure_alignment

For example:

typedef struct {
    union {
        uint8_t type;
        uint64_t padding;
    };
    uint64_t address;
    uint64_t length;
} QEMU_PACKED QEMUMARequest;

It also means that client need to use the same endianness with us, but there is
no way to query it.

An alternative might be carry endianness information in the protocol
negotiation or in request.

Fam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]