diff mbox

[v1,3/4] target-arm/helper.c: Allow const opaques in arm CP

Message ID cf0a3ac3438d97464240db9f5f4ef1585cbc1d77.1373429432.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite July 10, 2013, 4:22 a.m. UTC
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Allow for defining const opaque data in ARM CP register definitions by
setting .opaque = foo. If non null opaque is passes into
define_one_arm_cp_reg_with_opaque then that opaque will take
precedence, otherwise if null opaque is passed, the original opaque
data will be used.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 target-arm/helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Peter Maydell July 10, 2013, 7:32 a.m. UTC | #1
On 10 July 2013 05:22,  <peter.crosthwaite@xilinx.com> wrote:
> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Allow for defining const opaque data in ARM CP register definitions by
> setting .opaque = foo. If non null opaque is passes into
> define_one_arm_cp_reg_with_opaque then that opaque will take
> precedence, otherwise if null opaque is passed, the original opaque
> data will be used.

This doesn't seem to have any motivating use in later
patches in the series, or did I miss it? I guess being able
to have the opaque data in the data-tables is nice, though.

thanks
-- PMM
Peter Crosthwaite July 10, 2013, 7:35 a.m. UTC | #2
Hi Peter,

On Wed, Jul 10, 2013 at 5:32 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 10 July 2013 05:22,  <peter.crosthwaite@xilinx.com> wrote:
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>> Allow for defining const opaque data in ARM CP register definitions by
>> setting .opaque = foo. If non null opaque is passes into
>> define_one_arm_cp_reg_with_opaque then that opaque will take
>> precedence, otherwise if null opaque is passed, the original opaque
>> data will be used.
>
> This doesn't seem to have any motivating use in later
> patches in the series, or did I miss it? I guess being able
> to have the opaque data in the data-tables is nice, though.
>

No on-list motivation but I thought I might send this through to get
opinion on its validity before I start relying on it out of tree.

Regards,
peter

> thanks
> -- PMM
>
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 6f0a87e..f8b9ef4 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -1608,7 +1608,9 @@  void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
                 ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo));
                 int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0;
                 *key = ENCODE_CP_REG(r->cp, is64, r->crn, crm, opc1, opc2);
-                r2->opaque = opaque;
+                if (opaque) {
+                    r2->opaque = opaque;
+                }
                 /* Make sure reginfo passed to helpers for wildcarded regs
                  * has the correct crm/opc1/opc2 for this reg, not CP_ANY:
                  */