summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch')
-rw-r--r--recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch250
1 files changed, 250 insertions, 0 deletions
diff --git a/recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch b/recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch
new file mode 100644
index 0000000..a25f541
--- /dev/null
+++ b/recipes-devtools/valgrind/files/bug344802-unhandled-0xec510f1e.patch
@@ -0,0 +1,250 @@
1diff --git a/VEX/priv/guest_arm_defs.h b/VEX/priv/guest_arm_defs.h
2index 2ccbe4398..90312fbd4 100644
3--- a/VEX/priv/guest_arm_defs.h
4+++ b/VEX/priv/guest_arm_defs.h
5@@ -350,6 +350,10 @@ typedef
6 }
7 ARMCondcode;
8
9+extern UInt arm_dirtyhelper_MRS_CNTFRQ ( void );
10+extern ULong arm_dirtyhelper_MRRS_CNTVCT ( void );
11+extern ULong arm_dirtyhelper_MRRS_CNTPCT ( void );
12+
13 #endif /* ndef __VEX_GUEST_ARM_DEFS_H */
14
15 /*---------------------------------------------------------------*/
16diff --git a/VEX/priv/guest_arm_helpers.c b/VEX/priv/guest_arm_helpers.c
17index 8a028736e..89b17ce7b 100644
18--- a/VEX/priv/guest_arm_helpers.c
19+++ b/VEX/priv/guest_arm_helpers.c
20@@ -1445,6 +1445,53 @@ VexGuestLayout
21 };
22
23
24+UInt arm_dirtyhelper_MRS_CNTFRQ ( void )
25+{
26+#if __ARM_ARCH_ISA_ARM //{
27+ UInt w = 0x55555555UL; /* overwritten */
28+ __asm__ __volatile__("mrc p15, 0, %0, c14, c0, 0" : "=r"(w));
29+ return w;
30+#elif __ARM_ARCH_ISA_A64 //}{
31+ UInt w;
32+ __asm__ __volatile__("mrs %0,cntfrq_el0": "=r"(w));
33+ return w;
34+#else //}{
35+ return 0;
36+#endif //}
37+}
38+
39+ULong arm_dirtyhelper_MRRS_CNTVCT ( void )
40+{
41+#if __ARM_ARCH_ISA_ARM //}{
42+ UInt w0;
43+ UInt w1;
44+ __asm__ __volatile__("mrrc p15, 1, %0, %1, c14" : "=r"(w0), "=r"(w1));
45+ return (((ULong)w1)<<32) | w0;
46+#elif __ARM_ARCH_ISA_A64 //{
47+ ULong w;
48+ __asm__ __volatile__("mrs %0, cntvct_el0" : "=r"(w));
49+ return w;
50+#else //}{
51+ return 0;
52+#endif //}
53+}
54+
55+ULong arm_dirtyhelper_MRRS_CNTPCT ( void )
56+{
57+#if __ARM_ARCH_ISA_ARM //}{
58+ UInt w0;
59+ UInt w1;
60+ __asm__ __volatile__("mrrc p15, 0, %0, %1, c14" : "=r"(w0), "=r"(w1));
61+ return (((ULong)w1)<<32) | w0;
62+#elif __ARM_ARCH_ISA_A64 //{
63+ ULong w;
64+ __asm__ __volatile__("mrs %0, cntpct_el0" : "=r"(w));
65+ return w;
66+#else //}{
67+ return 0;
68+#endif //}
69+}
70+
71 /*---------------------------------------------------------------*/
72 /*--- end guest_arm_helpers.c ---*/
73 /*---------------------------------------------------------------*/
74diff --git a/VEX/priv/guest_arm_toIR.c b/VEX/priv/guest_arm_toIR.c
75index d858c85e0..f96af92c4 100644
76--- a/VEX/priv/guest_arm_toIR.c
77+++ b/VEX/priv/guest_arm_toIR.c
78@@ -18755,6 +18755,87 @@ DisResult disInstr_ARM_WRK (
79 /* fall through */
80 }
81
82+ /* CNTFRQ: mrc p15, 0, rX, c14, c0, 0 */
83+ if (0x0e1e0f10 == (insn & 0x0FFF0FFF)) {
84+ UInt rD = INSN(15,12);
85+ if (rD <= 14) {
86+ /* skip r15, that's too stupid to handle */
87+ IRTemp val = newTemp(Ity_I32);
88+ IRExpr** args = mkIRExprVec_0();
89+ IRDirty* d = unsafeIRDirty_1_N(
90+ val,
91+ 0/*regparms*/,
92+ "arm_dirtyhelper_MRS_CNTFRQ",
93+ &arm_dirtyhelper_MRS_CNTFRQ,
94+ args
95+ );
96+ /* execute the dirty call, dumping the result in val. */
97+ stmt( IRStmt_Dirty(d) );
98+ putIRegA(rD, mkexpr(val), condT, Ijk_Boring);
99+ DIP("mrc%s p15, 0, r%u, c14, c0, 0\n", nCC(INSN_COND), rD);
100+ goto decode_success;
101+ }
102+ /* fall through */
103+ }
104+
105+ /* CNTPCT */
106+ if (0x0c500f0e == (insn & 0x0FF00FFF)) {
107+ UInt rDhi = INSN(19,16);
108+ UInt rDlo = INSN(15,12);
109+ if (rDhi <= 14 && rDlo <= 14) {
110+ /* skip r15, that's too stupid to handle */
111+ IRTemp resHi = newTemp(Ity_I32);
112+ IRTemp resLo = newTemp(Ity_I32);
113+ IRTemp val = newTemp(Ity_I64);
114+ IRExpr** args = mkIRExprVec_0();
115+ IRDirty* d = unsafeIRDirty_1_N(
116+ val,
117+ 0/*regparms*/,
118+ "arm_dirtyhelper_MRRS_CNTPCT",
119+ &arm_dirtyhelper_MRRS_CNTPCT,
120+ args
121+ );
122+ /* execute the dirty call, dumping the result in val. */
123+ stmt( IRStmt_Dirty(d) );
124+ assign( resHi, unop(Iop_64HIto32, mkexpr(val)) );
125+ assign( resLo, unop(Iop_64to32, mkexpr(val)) );
126+ putIRegA( rDhi, mkexpr(resHi), condT, Ijk_Boring );
127+ putIRegA( rDlo, mkexpr(resLo), condT, Ijk_Boring );
128+ DIP("mrrc%s p15, 0, r%u, r%u, c14\n", nCC(INSN_COND), rDlo, rDhi);
129+ goto decode_success;
130+ }
131+ /* fall through */
132+ }
133+
134+ /* CNTVCT */
135+ if (0x0c500f1e == (insn & 0x0FF00FFF)) {
136+ UInt rDhi = INSN(19,16);
137+ UInt rDlo = INSN(15,12);
138+ if (rDhi <= 14 && rDlo <= 14) {
139+ /* skip r15, that's too stupid to handle */
140+ IRTemp resHi = newTemp(Ity_I32);
141+ IRTemp resLo = newTemp(Ity_I32);
142+ IRTemp val = newTemp(Ity_I64);
143+ IRExpr** args = mkIRExprVec_0();
144+ IRDirty* d = unsafeIRDirty_1_N(
145+ val,
146+ 0/*regparms*/,
147+ "arm_dirtyhelper_MRRS_CNTVCT",
148+ &arm_dirtyhelper_MRRS_CNTVCT,
149+ args
150+ );
151+ /* execute the dirty call, dumping the result in val. */
152+ stmt( IRStmt_Dirty(d) );
153+ assign( resHi, unop(Iop_64HIto32, mkexpr(val)) );
154+ assign( resLo, unop(Iop_64to32, mkexpr(val)) );
155+ putIRegA( rDhi, mkexpr(resHi), condT, Ijk_Boring );
156+ putIRegA( rDlo, mkexpr(resLo), condT, Ijk_Boring );
157+ DIP("mrrc%s p15, 1, r%u, r%u, c14\n", nCC(INSN_COND), rDlo, rDhi);
158+ goto decode_success;
159+ }
160+ /* fall through */
161+ }
162+
163 /* Handle various kinds of barriers. This is rather indiscriminate
164 in the sense that they are all turned into an IR Fence, which
165 means we don't know which they are, so the back end has to
166@@ -23196,6 +23277,84 @@ DisResult disInstr_THUMB_WRK (
167 /* fall through */
168 }
169
170+ /* CNTFRQ: mrc p15, 0, rX, c14, c0, 0 */
171+ if ((INSN0(15,0) == 0xee1e) && (INSN1(11,0) == 0xf10)) {
172+ UInt rD = INSN1(15,12);
173+ if (!isBadRegT(rD)) {
174+ IRTemp val = newTemp(Ity_I32);
175+ IRExpr** args = mkIRExprVec_0();
176+ IRDirty* d = unsafeIRDirty_1_N(
177+ val,
178+ 0/*regparms*/,
179+ "arm_dirtyhelper_MRS_CNTFRQ",
180+ &arm_dirtyhelper_MRS_CNTFRQ,
181+ args
182+ );
183+ /* execute the dirty call, dumping the result in val. */
184+ stmt( IRStmt_Dirty(d) );
185+ putIRegT(rD, mkexpr(val), condT);
186+ DIP("mrc p15, 0, r%u, c14, c0, 0\n", rD);
187+ goto decode_success;
188+ }
189+ /* fall through */
190+ }
191+
192+ /* CNTPCT */
193+ if ((INSN0(15,4) == 0xec5) && (INSN1(11,0) == 0xf0e)) {
194+ UInt rDhi = INSN0(3,0);
195+ UInt rDlo = INSN1(15,12);
196+ if (!isBadRegT(rDhi) && !isBadRegT(rDlo)) {
197+ IRTemp resHi = newTemp(Ity_I32);
198+ IRTemp resLo = newTemp(Ity_I32);
199+ IRTemp val = newTemp(Ity_I64);
200+ IRExpr** args = mkIRExprVec_0();
201+ IRDirty* d = unsafeIRDirty_1_N(
202+ val,
203+ 0/*regparms*/,
204+ "arm_dirtyhelper_MRRS_CNTPCT",
205+ &arm_dirtyhelper_MRRS_CNTPCT,
206+ args
207+ );
208+ /* execute the dirty call, dumping the result in val. */
209+ stmt( IRStmt_Dirty(d) );
210+ assign( resHi, unop(Iop_64HIto32, mkexpr(val)) );
211+ assign( resLo, unop(Iop_64to32, mkexpr(val)) );
212+ putIRegT( rDhi, mkexpr(resHi), condT );
213+ putIRegT( rDlo, mkexpr(resLo), condT );
214+ DIP("mrrc p15, 0, r%u, r%u, c14\n", rDlo, rDhi);
215+ goto decode_success;
216+ }
217+ /* fall through */
218+ }
219+
220+ /* CNTVCT */
221+ if ((INSN0(15,4) == 0xec5) && (INSN1(11,0) == 0xf1e)) {
222+ UInt rDhi = INSN0(3,0);
223+ UInt rDlo = INSN1(15,12);
224+ if (!isBadRegT(rDhi) && !isBadRegT(rDlo)) {
225+ IRTemp resHi = newTemp(Ity_I32);
226+ IRTemp resLo = newTemp(Ity_I32);
227+ IRTemp val = newTemp(Ity_I64);
228+ IRExpr** args = mkIRExprVec_0();
229+ IRDirty* d = unsafeIRDirty_1_N(
230+ val,
231+ 0/*regparms*/,
232+ "arm_dirtyhelper_MRRS_CNTVCT",
233+ &arm_dirtyhelper_MRRS_CNTVCT,
234+ args
235+ );
236+ /* execute the dirty call, dumping the result in val. */
237+ stmt( IRStmt_Dirty(d) );
238+ assign( resHi, unop(Iop_64HIto32, mkexpr(val)) );
239+ assign( resLo, unop(Iop_64to32, mkexpr(val)) );
240+ putIRegT( rDhi, mkexpr(resHi), condT );
241+ putIRegT( rDlo, mkexpr(resLo), condT );
242+ DIP("mrrc p15, 1, r%u, r%u, c14\n", rDlo, rDhi);
243+ goto decode_success;
244+ }
245+ /* fall through */
246+ }
247+
248 /* ------------------- CLREX ------------------ */
249 if (INSN0(15,0) == 0xF3BF && INSN1(15,0) == 0x8F2F) {
250 /* AFAICS, this simply cancels a (all?) reservations made by a