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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status
Date: Thu, 09 Apr 2015 11:21:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0


On 09/04/2015 11:04, Peter Maydell wrote:
> We discussed this last time round, I think. Whether structs get
> passed in registers depends on the host CPU ABI/calling convention.

Because of C++, structs up to pointer size are in practice always passed
in registers.  64-bit structs may or may not.

The main advantage of structs is that it's impossible to mismatch the
parameter order.  That even trumps readability in my opinion.

I'm ambivalent, but I wouldn't mind at all using structs.

Paolo

>> > 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...



reply via email to

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