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

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu/arm64/0063-target-arm-Remove-ARMCPU-CPUARMState-from-cpregs-API.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 a451a7a6c7ea238490771d660b95dccc60dcd7ed Mon Sep 17 00:00:00 2001
 
2
From: Peter Maydell <peter.maydell@linaro.org>
 
3
Date: Sat, 4 Jan 2014 22:15:44 +0000
 
4
Subject: [PATCH 063/158] target-arm: Remove ARMCPU/CPUARMState from cpregs
 
5
 APIs used by decoder
 
6
 
 
7
The cpregs APIs used by the decoder (get_arm_cp_reginfo() and
 
8
cp_access_ok()) currently take either a CPUARMState* or an ARMCPU*.
 
9
This is problematic for the A64 decoder, which doesn't pass the
 
10
environment pointer around everywhere the way the 32 bit decoder
 
11
does. Adjust the parameters these functions take so that we can
 
12
copy only the relevant info from the CPUARMState into the
 
13
DisasContext and then use that.
 
14
 
 
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
 
16
Reviewed-by: Richard Henderson <rth@twiddle.net>
 
17
---
 
18
 target-arm/cpu.h           |  6 +++---
 
19
 target-arm/helper.c        | 12 ++++++------
 
20
 target-arm/translate-a64.c |  2 ++
 
21
 target-arm/translate.c     |  7 ++++---
 
22
 target-arm/translate.h     |  2 ++
 
23
 5 files changed, 17 insertions(+), 12 deletions(-)
 
24
 
 
25
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
 
26
index a154429..9dade70 100644
 
27
--- a/target-arm/cpu.h
 
28
+++ b/target-arm/cpu.h
 
29
@@ -857,7 +857,7 @@ static inline void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *regs)
 
30
 {
 
31
     define_one_arm_cp_reg_with_opaque(cpu, regs, 0);
 
32
 }
 
33
-const ARMCPRegInfo *get_arm_cp_reginfo(ARMCPU *cpu, uint32_t encoded_cp);
 
34
+const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp);
 
35
 
 
36
 /* CPWriteFn that can be used to implement writes-ignored behaviour */
 
37
 int arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri,
 
38
@@ -870,10 +870,10 @@ int arm_cp_read_zero(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t *value);
 
39
  */
 
40
 void arm_cp_reset_ignore(CPUARMState *env, const ARMCPRegInfo *opaque);
 
41
 
 
42
-static inline bool cp_access_ok(CPUARMState *env,
 
43
+static inline bool cp_access_ok(int current_pl,
 
44
                                 const ARMCPRegInfo *ri, int isread)
 
45
 {
 
46
-    return (ri->access >> ((arm_current_pl(env) * 2) + isread)) & 1;
 
47
+    return (ri->access >> ((current_pl * 2) + isread)) & 1;
 
48
 }
 
49
 
 
50
 /**
 
51
diff --git a/target-arm/helper.c b/target-arm/helper.c
 
52
index ef73df9..be641bc 100644
 
53
--- a/target-arm/helper.c
 
54
+++ b/target-arm/helper.c
 
55
@@ -186,7 +186,7 @@ bool write_cpustate_to_list(ARMCPU *cpu)
 
56
         uint32_t regidx = kvm_to_cpreg_id(cpu->cpreg_indexes[i]);
 
57
         const ARMCPRegInfo *ri;
 
58
         uint64_t v;
 
59
-        ri = get_arm_cp_reginfo(cpu, regidx);
 
60
+        ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
 
61
         if (!ri) {
 
62
             ok = false;
 
63
             continue;
 
64
@@ -214,7 +214,7 @@ bool write_list_to_cpustate(ARMCPU *cpu)
 
65
         uint64_t readback;
 
66
         const ARMCPRegInfo *ri;
 
67
 
 
68
-        ri = get_arm_cp_reginfo(cpu, regidx);
 
69
+        ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
 
70
         if (!ri) {
 
71
             ok = false;
 
72
             continue;
 
73
@@ -242,7 +242,7 @@ static void add_cpreg_to_list(gpointer key, gpointer opaque)
 
74
     const ARMCPRegInfo *ri;
 
75
 
 
76
     regidx = *(uint32_t *)key;
 
77
-    ri = get_arm_cp_reginfo(cpu, regidx);
 
78
+    ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
 
79
 
 
80
     if (!(ri->type & ARM_CP_NO_MIGRATE)) {
 
81
         cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx);
 
82
@@ -258,7 +258,7 @@ static void count_cpreg(gpointer key, gpointer opaque)
 
83
     const ARMCPRegInfo *ri;
 
84
 
 
85
     regidx = *(uint32_t *)key;
 
86
-    ri = get_arm_cp_reginfo(cpu, regidx);
 
87
+    ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
 
88
 
 
89
     if (!(ri->type & ARM_CP_NO_MIGRATE)) {
 
90
         cpu->cpreg_array_len++;
 
91
@@ -2145,9 +2145,9 @@ void define_arm_cp_regs_with_opaque(ARMCPU *cpu,
 
92
     }
 
93
 }
 
94
 
 
95
-const ARMCPRegInfo *get_arm_cp_reginfo(ARMCPU *cpu, uint32_t encoded_cp)
 
96
+const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp)
 
97
 {
 
98
-    return g_hash_table_lookup(cpu->cp_regs, &encoded_cp);
 
99
+    return g_hash_table_lookup(cpregs, &encoded_cp);
 
100
 }
 
101
 
 
102
 int arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri,
 
103
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
 
104
index 7d98337..e35d2f3 100644
 
105
--- a/target-arm/translate-a64.c
 
106
+++ b/target-arm/translate-a64.c
 
107
@@ -3007,6 +3007,8 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu,
 
108
     dc->vfp_enabled = 0;
 
109
     dc->vec_len = 0;
 
110
     dc->vec_stride = 0;
 
111
+    dc->cp_regs = cpu->cp_regs;
 
112
+    dc->current_pl = arm_current_pl(env);
 
113
 
 
114
     init_tmp_a64_array(dc);
 
115
 
 
116
diff --git a/target-arm/translate.c b/target-arm/translate.c
 
117
index a0a1ab2..e00c650 100644
 
118
--- a/target-arm/translate.c
 
119
+++ b/target-arm/translate.c
 
120
@@ -6484,7 +6484,6 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
 
121
 {
 
122
     int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2;
 
123
     const ARMCPRegInfo *ri;
 
124
-    ARMCPU *cpu = arm_env_get_cpu(env);
 
125
 
 
126
     cpnum = (insn >> 8) & 0xf;
 
127
     if (arm_feature(env, ARM_FEATURE_XSCALE)
 
128
@@ -6527,11 +6526,11 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
 
129
     isread = (insn >> 20) & 1;
 
130
     rt = (insn >> 12) & 0xf;
 
131
 
 
132
-    ri = get_arm_cp_reginfo(cpu,
 
133
+    ri = get_arm_cp_reginfo(s->cp_regs,
 
134
                             ENCODE_CP_REG(cpnum, is64, crn, crm, opc1, opc2));
 
135
     if (ri) {
 
136
         /* Check access permissions */
 
137
-        if (!cp_access_ok(env, ri, isread)) {
 
138
+        if (!cp_access_ok(s->current_pl, ri, isread)) {
 
139
             return 1;
 
140
         }
 
141
 
 
142
@@ -10266,6 +10265,8 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu,
 
143
     dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags);
 
144
     dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags);
 
145
     dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags);
 
146
+    dc->cp_regs = cpu->cp_regs;
 
147
+    dc->current_pl = arm_current_pl(env);
 
148
 
 
149
     cpu_F0s = tcg_temp_new_i32();
 
150
     cpu_F1s = tcg_temp_new_i32();
 
151
diff --git a/target-arm/translate.h b/target-arm/translate.h
 
152
index a6f6b3e..67da699 100644
 
153
--- a/target-arm/translate.h
 
154
+++ b/target-arm/translate.h
 
155
@@ -24,6 +24,8 @@ typedef struct DisasContext {
 
156
     int vec_len;
 
157
     int vec_stride;
 
158
     int aarch64;
 
159
+    int current_pl;
 
160
+    GHashTable *cp_regs;
 
161
 #define TMP_A64_MAX 16
 
162
     int tmp_a64_count;
 
163
     TCGv_i64 tmp_a64[TMP_A64_MAX];
 
164
-- 
 
165
1.9.rc1
 
166