~ubuntu-branches/ubuntu/vivid/qemu/vivid

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu/arm64/0061-target-arm-Pull-add-one-cpreg-to-hashtable-into-its-.patch

  • Committer: Package Import Robot
  • Author(s): dann frazier
  • Date: 2014-02-11 15:41:53 UTC
  • Revision ID: package-import@ubuntu.com-20140211154153-2d001tf0ium08u81
Tags: 1.7.0+dfsg-3ubuntu2
* Backport changes to enable qemu-user-static support for aarch64
* debian/control: add ppc64el to Architectures
* debian/rules: only install qemu-system-aarch64 on arm64.
  Fixes a FTBFS  when built twice in a row on non-arm64 due to a stale
  debian/qemu-system-aarch64 directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From b8a2aeda588307fd562c2f88ff079bb0a523daca Mon Sep 17 00:00:00 2001
 
2
From: Peter Maydell <peter.maydell@linaro.org>
 
3
Date: Sun, 22 Dec 2013 22:32:30 +0000
 
4
Subject: [PATCH 061/158] target-arm: Pull "add one cpreg to hashtable" into
 
5
 its own function
 
6
 
 
7
define_one_arm_cp_reg_with_opaque() has a set of nested loops which
 
8
insert a cpreg entry into the hashtable for each of the possible
 
9
opc/crn/crm values allowed by wildcard specifications. We're about
 
10
to add an extra loop to this nesting, so pull the core of the loop
 
11
(which adds a single entry to the hashtable) out into its own
 
12
function for clarity.
 
13
 
 
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 
15
Reviewed-by: Richard Henderson <rth@twiddle.net>
 
16
---
 
17
 target-arm/helper.c | 94 +++++++++++++++++++++++++++++------------------------
 
18
 1 file changed, 52 insertions(+), 42 deletions(-)
 
19
 
 
20
diff --git a/target-arm/helper.c b/target-arm/helper.c
 
21
index 46679ed..923ce25 100644
 
22
--- a/target-arm/helper.c
 
23
+++ b/target-arm/helper.c
 
24
@@ -1946,6 +1946,57 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
 
25
     return cpu_list;
 
26
 }
 
27
 
 
28
+static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
 
29
+                                   void *opaque, int crm, int opc1, int opc2)
 
30
+{
 
31
+    /* Private utility function for define_one_arm_cp_reg_with_opaque():
 
32
+     * add a single reginfo struct to the hash table.
 
33
+     */
 
34
+    uint32_t *key = g_new(uint32_t, 1);
 
35
+    ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo));
 
36
+    int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0;
 
37
+    *key = ENCODE_CP_REG(r->cp, is64, r->crn, crm, opc1, opc2);
 
38
+    if (opaque) {
 
39
+        r2->opaque = opaque;
 
40
+    }
 
41
+    /* Make sure reginfo passed to helpers for wildcarded regs
 
42
+     * has the correct crm/opc1/opc2 for this reg, not CP_ANY:
 
43
+     */
 
44
+    r2->crm = crm;
 
45
+    r2->opc1 = opc1;
 
46
+    r2->opc2 = opc2;
 
47
+    /* By convention, for wildcarded registers only the first
 
48
+     * entry is used for migration; the others are marked as
 
49
+     * NO_MIGRATE so we don't try to transfer the register
 
50
+     * multiple times. Special registers (ie NOP/WFI) are
 
51
+     * never migratable.
 
52
+     */
 
53
+    if ((r->type & ARM_CP_SPECIAL) ||
 
54
+        ((r->crm == CP_ANY) && crm != 0) ||
 
55
+        ((r->opc1 == CP_ANY) && opc1 != 0) ||
 
56
+        ((r->opc2 == CP_ANY) && opc2 != 0)) {
 
57
+        r2->type |= ARM_CP_NO_MIGRATE;
 
58
+    }
 
59
+
 
60
+    /* Overriding of an existing definition must be explicitly
 
61
+     * requested.
 
62
+     */
 
63
+    if (!(r->type & ARM_CP_OVERRIDE)) {
 
64
+        ARMCPRegInfo *oldreg;
 
65
+        oldreg = g_hash_table_lookup(cpu->cp_regs, key);
 
66
+        if (oldreg && !(oldreg->type & ARM_CP_OVERRIDE)) {
 
67
+            fprintf(stderr, "Register redefined: cp=%d %d bit "
 
68
+                    "crn=%d crm=%d opc1=%d opc2=%d, "
 
69
+                    "was %s, now %s\n", r2->cp, 32 + 32 * is64,
 
70
+                    r2->crn, r2->crm, r2->opc1, r2->opc2,
 
71
+                    oldreg->name, r2->name);
 
72
+            g_assert_not_reached();
 
73
+        }
 
74
+    }
 
75
+    g_hash_table_insert(cpu->cp_regs, key, r2);
 
76
+}
 
77
+
 
78
+
 
79
 void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
 
80
                                        const ARMCPRegInfo *r, void *opaque)
 
81
 {
 
82
@@ -1986,48 +2037,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
 
83
     for (crm = crmmin; crm <= crmmax; crm++) {
 
84
         for (opc1 = opc1min; opc1 <= opc1max; opc1++) {
 
85
             for (opc2 = opc2min; opc2 <= opc2max; opc2++) {
 
86
-                uint32_t *key = g_new(uint32_t, 1);
 
87
-                ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo));
 
88
-                int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0;
 
89
-                *key = ENCODE_CP_REG(r->cp, is64, r->crn, crm, opc1, opc2);
 
90
-                if (opaque) {
 
91
-                    r2->opaque = opaque;
 
92
-                }
 
93
-                /* Make sure reginfo passed to helpers for wildcarded regs
 
94
-                 * has the correct crm/opc1/opc2 for this reg, not CP_ANY:
 
95
-                 */
 
96
-                r2->crm = crm;
 
97
-                r2->opc1 = opc1;
 
98
-                r2->opc2 = opc2;
 
99
-                /* By convention, for wildcarded registers only the first
 
100
-                 * entry is used for migration; the others are marked as
 
101
-                 * NO_MIGRATE so we don't try to transfer the register
 
102
-                 * multiple times. Special registers (ie NOP/WFI) are
 
103
-                 * never migratable.
 
104
-                 */
 
105
-                if ((r->type & ARM_CP_SPECIAL) ||
 
106
-                    ((r->crm == CP_ANY) && crm != 0) ||
 
107
-                    ((r->opc1 == CP_ANY) && opc1 != 0) ||
 
108
-                    ((r->opc2 == CP_ANY) && opc2 != 0)) {
 
109
-                    r2->type |= ARM_CP_NO_MIGRATE;
 
110
-                }
 
111
-
 
112
-                /* Overriding of an existing definition must be explicitly
 
113
-                 * requested.
 
114
-                 */
 
115
-                if (!(r->type & ARM_CP_OVERRIDE)) {
 
116
-                    ARMCPRegInfo *oldreg;
 
117
-                    oldreg = g_hash_table_lookup(cpu->cp_regs, key);
 
118
-                    if (oldreg && !(oldreg->type & ARM_CP_OVERRIDE)) {
 
119
-                        fprintf(stderr, "Register redefined: cp=%d %d bit "
 
120
-                                "crn=%d crm=%d opc1=%d opc2=%d, "
 
121
-                                "was %s, now %s\n", r2->cp, 32 + 32 * is64,
 
122
-                                r2->crn, r2->crm, r2->opc1, r2->opc2,
 
123
-                                oldreg->name, r2->name);
 
124
-                        g_assert_not_reached();
 
125
-                    }
 
126
-                }
 
127
-                g_hash_table_insert(cpu->cp_regs, key, r2);
 
128
+                add_cpreg_to_hashtable(cpu, r, opaque, crm, opc1, opc2);
 
129
             }
 
130
         }
 
131
     }
 
132
-- 
 
133
1.9.rc1
 
134