qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to


From: Edgar E. Iglesias
Subject: Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status
Date: Thu, 9 Apr 2015 19:32:13 +1000
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Apr 09, 2015 at 10:04:39AM +0100, Peter Maydell wrote:
> On 9 April 2015 at 09:55, Edgar E. Iglesias <address@hidden> wrote:
> > Did you consider using a struct here?
> > e.g:
> >
> > typedef struct MemTxAttrs {
> >     unsigned int secure : 1;
> >     unsigned int master_id : 10;
> >     unsigned int etc : 1;
> > } MemTxAttrs;
> >
> > I think you could still pass it by value and my understanding is
> > that the compiler will generate similar code.
> 
> We discussed this last time round, I think. Whether structs get
> passed in registers depends on the host CPU ABI/calling convention.

Ah sorry, I must have missed that response...

> 
> > I find it more readable, you ca go:
> >
> > attrs.secure = 1;
> > attrs.master_id = 0x77;
> > if (!attrs.secure)
> >
> > instead of:
> >
> > attrs |= MEMTXATTRS_SECURE
> > if (!(attrs & MEMTXATTRS_SECURE))
> >
> > etc...
> >
> > Or do you see any disadvantages with this?
> 
> I prefer the traditional integer-and-bitops approach, then you
> know what you're getting everywhere...

OK :-)

Cheers,
Edgar



reply via email to

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