[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: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status |
Date: |
Thu, 9 Apr 2015 10:04:39 +0100 |
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.
> 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...
-- PMM
- Re: [Qemu-devel] [PATCH 07/14] exec.c: Add new address_space_ld*/st* functions, (continued)
Re: [Qemu-devel] [PATCH 07/14] exec.c: Add new address_space_ld*/st* functions, Edgar E. Iglesias, 2015/04/09
[Qemu-devel] [PATCH 14/14] target-arm: Check watchpoints against CPU security state, Peter Maydell, 2015/04/07
[Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status, Peter Maydell, 2015/04/07
Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status, Edgar E. Iglesias, 2015/04/09
[Qemu-devel] [PATCH 05/14] exec.c: Convert subpage memory ops to _with_attrs, Peter Maydell, 2015/04/07
[Qemu-devel] [PATCH 08/14] Switch non-CPU callers from ld/st*_phys to address_space_ld/st*, Peter Maydell, 2015/04/07