You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
(21) |
2
(18) |
3
(19) |
4
(16) |
5
(20) |
6
(22) |
7
(17) |
|
8
(13) |
9
(1) |
10
(3) |
11
(28) |
12
(13) |
13
(12) |
14
(25) |
|
15
(15) |
16
(29) |
17
(19) |
18
(15) |
19
(27) |
20
(29) |
21
(21) |
|
22
(16) |
23
(24) |
24
(18) |
25
(26) |
26
(27) |
27
(21) |
28
(30) |
|
29
(23) |
30
(3) |
31
(19) |
|
|
|
|
|
From: Christian B. <bor...@de...> - 2012-07-20 02:12:11
|
valgrind revision: 12765 VEX revision: 2441 C compiler: gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973] Assembler: GNU assembler (GNU Binutils; SUSE Linux Enterprise 11) 2.20.0.20100122-0.7.9 C library: GNU C Library stable release version 2.11.1 (20100118) uname -mrs: Linux 2.6.32.59-0.3-default s390x Vendor version: Welcome to SUSE Linux Enterprise Server 11 SP1 (s390x) - Kernel %r (%t). Nightly build on sless390 ( SUSE Linux Enterprise Server 11 SP1 gcc 4.3.4 on z196 (s390x) ) Started at 2012-07-20 03:45:01 CEST Ended at 2012-07-20 04:11:57 CEST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 549 tests, 2 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 546 tests, 2 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Fri Jul 20 03:58:32 2012 --- new.short Fri Jul 20 04:11:57 2012 *************** *** 8,10 **** ! == 546 tests, 2 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == helgrind/tests/tc18_semabuse (stderr) --- 8,10 ---- ! == 549 tests, 2 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == helgrind/tests/tc18_semabuse (stderr) |
|
From: Christian B. <bor...@de...> - 2012-07-20 02:04:21
|
valgrind revision: 12765 VEX revision: 2441 C compiler: gcc (GCC) 4.5.3 20110121 (Red Hat 4.5.3-5) Assembler: GNU assembler version 2.20.51.0.7-4bb6.fc13 20100318 C library: GNU C Library stable release version 2.12.1 uname -mrs: Linux 3.3.4-53.x.20120504-s390xperformance s390x Vendor version: unknown Nightly build on fedora390 ( Fedora 13/14/15 mix with gcc 3.5.3 on z196 (s390x) ) Started at 2012-07-20 03:45:01 CEST Ended at 2012-07-20 04:04:27 CEST Results differ from 24 hours ago Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 548 tests, 5 stderr failures, 0 stdout failures, 1 stderrB failure, 1 stdoutB failure, 0 post failures == gdbserver_tests/mcinvokeWS (stdoutB) gdbserver_tests/mcinvokeWS (stderrB) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) drd/tests/tc21_pthonce (stderr) ================================================= == Results from 24 hours ago == ================================================= Checking out valgrind source tree ... done Configuring valgrind ... done Building valgrind ... done Running regression tests ... failed Regression test results follow == 545 tests, 5 stderr failures, 0 stdout failures, 1 stderrB failure, 1 stdoutB failure, 0 post failures == gdbserver_tests/mcinvokeWS (stdoutB) gdbserver_tests/mcinvokeWS (stderrB) helgrind/tests/tc18_semabuse (stderr) helgrind/tests/tc20_verifywrap (stderr) helgrind/tests/tc21_pthonce (stderr) helgrind/tests/tc22_exit_w_lock (stderr) drd/tests/tc21_pthonce (stderr) ================================================= == Difference between 24 hours ago and now == ================================================= *** old.short Fri Jul 20 03:54:46 2012 --- new.short Fri Jul 20 04:04:27 2012 *************** *** 8,10 **** ! == 545 tests, 5 stderr failures, 0 stdout failures, 1 stderrB failure, 1 stdoutB failure, 0 post failures == gdbserver_tests/mcinvokeWS (stdoutB) --- 8,10 ---- ! == 548 tests, 5 stderr failures, 0 stdout failures, 1 stderrB failure, 1 stdoutB failure, 0 post failures == gdbserver_tests/mcinvokeWS (stdoutB) |
|
From: <sv...@va...> - 2012-07-20 00:17:24
|
florian 2012-07-20 01:17:16 +0100 (Fri, 20 Jul 2012)
New Revision: 12765
Log:
Add testcases for CU21. Update opcode table.
WRT the memcheck test: the good news is we get all the complaints
we want. The bad news is:
- the line numbers from within do_cu21 are off
- there are 2 complaints when attempting to convert from
an uninitialised input buffer instead of one. One of them has a
completely bogus line number.
Possibly due to bad debug info? Let's see what happens on machines
with more recent GCCs.
Added files:
trunk/memcheck/tests/s390x/cu21.c
trunk/memcheck/tests/s390x/cu21.stderr.exp
trunk/memcheck/tests/s390x/cu21.stdout.exp
trunk/memcheck/tests/s390x/cu21.vgtest
trunk/none/tests/s390x/cu21.c
trunk/none/tests/s390x/cu21.stderr.exp
trunk/none/tests/s390x/cu21.stdout.exp
trunk/none/tests/s390x/cu21.vgtest
trunk/none/tests/s390x/cu21_1.c
trunk/none/tests/s390x/cu21_1.stderr.exp
trunk/none/tests/s390x/cu21_1.stdout.exp
trunk/none/tests/s390x/cu21_1.vgtest
Modified directories:
trunk/memcheck/tests/s390x/
trunk/none/tests/s390x/
Modified files:
trunk/docs/internals/s390-opcodes.csv
trunk/memcheck/tests/s390x/Makefile.am
trunk/none/tests/s390x/Makefile.am
Modified: trunk/memcheck/tests/s390x/
Modified: trunk/none/tests/s390x/
Added: trunk/none/tests/s390x/cu21.stdout.exp (+212 -0)
===================================================================
--- trunk/none/tests/s390x/cu21.stdout.exp 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21.stdout.exp 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,212 @@
+
+------------- test1 ----------------
+UTF8: <none>
+ cc = 0
+ dst len: 0
+ src len: 0
+
+------------- test2.1 ----------------
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 3
+
+------------- test2.2 ----------------
+UTF8: 00
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 1
+UTF8: c2 80 df bf
+ cc = 0
+ dst address difference: 4 dst len: 996
+ src address difference: 4 src len: 1
+UTF8: e0 a0 80 ed 9f bf ed b0 80
+ cc = 0
+ dst address difference: 9 dst len: 991
+ src address difference: 6 src len: 1
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 1
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 2
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 3
+
+------------- test3.1 ----------------
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 18
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 18
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 2
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 2
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 3
+ src address difference: 0 src len: 16
+
+------------- test3.2 ----------------
+UTF8: 00 7f 47
+ cc = 1
+ dst address difference: 3 dst len: 0
+ src address difference: 6 src len: 10
+UTF8: c2 80 df bf
+ cc = 1
+ dst address difference: 4 dst len: 1
+ src address difference: 4 src len: 14
+UTF8: e0 a0 80 ed 9f bf
+ cc = 1
+ dst address difference: 6 dst len: 1
+ src address difference: 4 src len: 18
+UTF8: e0 a0 80 ed 9f bf
+ cc = 1
+ dst address difference: 6 dst len: 2
+ src address difference: 4 src len: 18
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 1
+ src address difference: 8 src len: 8
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 2
+ src address difference: 8 src len: 8
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 3
+ src address difference: 8 src len: 8
+
+------------- test4 ----------------
+UTF8: 00 7f 47
+ cc = 0
+ dst address difference: 3 dst len: 3
+ src address difference: 6 src len: 0
+
+------------- test5 ----------------
+UTF8: f0 90 92 98
+ cc = 0
+ dst address difference: 4 dst len: 996
+ src address difference: 4 src len: 0
+UTF8: <none>
+ cc = 1
+ dst address difference: 0 dst len: 0
+ src address difference: 0 src len: 4
+
+------------- test6 ----------------
+UTF8: 00 7f 47 56 45 21 7b 3a
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 16 src len: 0
+UTF8: c2 80 df bf df 9f c2 8f c4 80 c5 bf d4 af d8 80 db bf
+ cc = 0
+ dst address difference: 18 dst len: 982
+ src address difference: 18 src len: 0
+UTF8: e0 a0 80 ed 9f bf ed b0 80 ef bf bf e0 a0 bf e1 a8 a1 e1 ac 90 e2 88 80 e2 89 9e e2 8b 89 ee 80 81
+ cc = 0
+ dst address difference: 33 dst len: 967
+ src address difference: 22 src len: 0
+UTF8: f0 90 80 80 f4 8f bf bf f3 86 a7 9d ed ba af ed b3 9c
+ cc = 0
+ dst address difference: 18 dst len: 982
+ src address difference: 16 src len: 0
+UTF8: 78 c8 80 ef bf bf f0 90 80 81
+ cc = 0
+ dst address difference: 10 dst len: 990
+ src address difference: 10 src len: 0
+
+------------- test7.1 ----------------
+UTF8: 10
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 0
+UTF8: 10
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 0
+
+------------- test7.2 ----------------
+UTF8: c2 8f
+ cc = 0
+ dst address difference: 2 dst len: 998
+ src address difference: 2 src len: 0
+UTF8: c2 8f
+ cc = 0
+ dst address difference: 2 dst len: 998
+ src address difference: 2 src len: 0
+
+------------- test7.3 ----------------
+UTF8: e0 a1 82
+ cc = 0
+ dst address difference: 3 dst len: 997
+ src address difference: 2 src len: 0
+UTF8: e0 a1 82
+ cc = 0
+ dst address difference: 3 dst len: 997
+ src address difference: 2 src len: 0
+
+------------- test7.4 ----------------
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
Added: trunk/none/tests/s390x/cu21.c (+269 -0)
===================================================================
--- trunk/none/tests/s390x/cu21.c 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21.c 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,269 @@
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "opcodes.h"
+
+#ifndef M3
+#define M3 0
+#endif
+
+/* The abstracted result of an CU21 insn */
+typedef struct {
+ uint64_t addr1; // target
+ uint64_t len1;
+ uint64_t addr2; // source
+ uint64_t len2;
+ uint32_t cc;
+} cu21_t;
+
+/* Define various input buffers. */
+
+/* U+0000 to U+007f: Result is 1 byte for each uint16_t */
+uint16_t pattern1[] = {
+ 0x0000, 0x007f, /* corner cases */
+ 0x0047, 0x0056, 0x0045, 0x0021, 0x007b, 0x003a /* misc */
+};
+
+/* U+0080 to U+07ff: Result is 2 bytes for each uint16_t */
+uint16_t pattern2[] = {
+ 0x0080, 0x07ff, /* corner cases */
+ 0x07df, 0x008f, 0x0100, 0x017f, 0x052f, 0x0600, 0x06ff /* misc */
+};
+
+/* U+0800 to U+d7ff: Result is 3 bytes for each uint16_t
+ U+dc00 to U+ffff: Result is 3 bytes for each uint16_t */
+uint16_t pattern3[] = {
+ 0x0800, 0xd7ff, /* corner cases */
+ 0xdc00, 0xffff, /* corner cases */
+ 0x083f, 0x1a21, 0x1b10, 0x2200, 0x225e, 0x22c9, 0xe001 /* misc */
+};
+
+/* U+d800 to U+dbff: Result is 4 bytes for each uint16_t pair */
+uint16_t pattern4[] = {
+ 0xd800, 0xdc00, /* left corner case */
+ 0xdbff, 0xdfff, /* right corner case */
+ 0xdada, 0xdddd, 0xdeaf, 0xdcdc /* misc */
+};
+
+/* Invalid low surrogate */
+uint16_t invalid[] = { 0xd801, 0x0098 };
+
+/* Mixed bytes */
+uint16_t mixed[] = {
+ 0x0078 /* 1 byte */,
+ 0x0200 /* 2 bytes */,
+ 0xffff /* 3 bytes */,
+ 0xd800, 0xdc01 /* 4 bytes */
+};
+
+/* This is the buffer for the converted bytes. */
+uint8_t buff[1000]; /* Large so we con'don't have to worry about it */
+
+void write_and_check(uint16_t *, unsigned, unsigned);
+
+
+static cu21_t
+do_cu21(uint8_t *dst, uint64_t dst_len, uint16_t *src, uint64_t src_len)
+{
+ int cc = 42;
+ cu21_t regs;
+
+ /* build up the register pairs */
+ register uint16_t *source asm("4") = src;
+ register uint64_t source_len asm("5") = src_len;
+ register uint8_t *dest asm("2") = dst;
+ register uint64_t dest_len asm("3") = dst_len;
+
+ asm volatile(
+ CU21(M3,2,4)
+ "ipm %2\n\t"
+ "srl %2,28\n\t"
+ : "+d"(dest), "+d"(source), "=d"(cc),
+ "+d"(source_len), "+d"(dest_len)
+ :
+ : "memory", "cc");
+
+ /* Capture register contents at end of cu21 */
+ regs.addr1 = (uint64_t)dest;
+ regs.len1 = dest_len;
+ regs.addr2 = (uint64_t)source;
+ regs.len2 = source_len;
+ regs.cc = cc;
+
+ return regs;
+}
+
+void
+run_test(uint8_t *dst, uint64_t dst_len, uint16_t *src, uint64_t src_len)
+{
+ int i;
+ cu21_t result;
+
+ result = do_cu21(dst, dst_len, src, src_len);
+
+ // Write out the converted bytes, if any
+ printf("UTF8: ");
+ if (dst_len - result.len1 == 0)
+ printf(" <none>");
+ else
+ for (i = 0; i < dst_len - result.len1; i++) {
+ printf(" %02x", dst[i]);
+ }
+ printf("\n");
+
+ printf(" cc = %d\n", result.cc);
+ if (dst != NULL)
+ printf(" dst address difference: %"PRId64, result.addr1 - (uint64_t)dst);
+ printf(" dst len: %"PRId64"\n", result.len1);
+
+ if (src != NULL)
+ printf(" src address difference: %"PRId64, result.addr2 - (uint64_t)src);
+ printf(" src len: %"PRId64"\n", result.len2);
+}
+
+int main()
+{
+ /* Length == 0, no memory should be read or written */
+ printf("\n------------- test1 ----------------\n");
+ run_test(NULL, 0, NULL, 0);
+
+ /* Test exhaustion of source length (source bytes are valid) */
+ printf("\n------------- test2.1 ----------------\n");
+
+ /* No character will be written to BUFF, i.e. loop in jitted code
+ is not iterated */
+ run_test(buff, sizeof buff, NULL, 1);
+ run_test(buff, sizeof buff, pattern1, 1);
+ run_test(buff, sizeof buff, pattern2, 1);
+ run_test(buff, sizeof buff, pattern3, 1);
+ run_test(buff, sizeof buff, pattern4, 1);
+ run_test(buff, sizeof buff, pattern4, 2);
+ run_test(buff, sizeof buff, pattern4, 3);
+
+ printf("\n------------- test2.2 ----------------\n");
+ /* At least one character will be written to BUFF, i.e. loop in jitted
+ code is iterated */
+ run_test(buff, sizeof buff, pattern1, 3);
+ run_test(buff, sizeof buff, pattern2, 5);
+ run_test(buff, sizeof buff, pattern3, 7);
+ run_test(buff, sizeof buff, pattern4, 9);
+ run_test(buff, sizeof buff, pattern4, 10);
+ run_test(buff, sizeof buff, pattern4, 11);
+
+ /* Test exhaustion of destination length (source bytes are valid) */
+ printf("\n------------- test3.1 ----------------\n");
+
+ /* No character will be written to BUFF, i.e. loop in jitted code
+ is not iterated */
+
+ /* Want to write a single byte */
+ run_test(NULL, 0, pattern1, sizeof pattern1);
+
+ /* Want to write two bytes */
+ run_test(NULL, 0, pattern2, sizeof pattern2);
+ run_test(NULL, 1, pattern2, sizeof pattern2);
+
+ /* Want to write three bytes */
+ run_test(NULL, 0, pattern3, sizeof pattern3);
+ run_test(NULL, 1, pattern3, sizeof pattern3);
+ run_test(NULL, 2, pattern3, sizeof pattern3);
+
+ /* Want to write four bytes */
+ run_test(NULL, 0, pattern4, sizeof pattern4);
+ run_test(NULL, 1, pattern4, sizeof pattern4);
+ run_test(NULL, 2, pattern4, sizeof pattern4);
+ run_test(NULL, 3, pattern4, sizeof pattern4);
+
+ printf("\n------------- test3.2 ----------------\n");
+ /* At least one character will be written to BUFF, i.e. loop in jitted
+ code is iterated */
+ run_test(buff, 3, pattern1, sizeof pattern1);
+
+ run_test(buff, 5, pattern2, sizeof pattern2);
+
+ run_test(buff, 7, pattern3, sizeof pattern3);
+ run_test(buff, 8, pattern3, sizeof pattern3);
+
+ run_test(buff, 9, pattern4, sizeof pattern4);
+ run_test(buff, 10, pattern4, sizeof pattern4);
+ run_test(buff, 11, pattern4, sizeof pattern4);
+
+ /* When both operands are exhausted, cc=0 takes precedence.
+ (test1 tests this for len == 0) */
+ printf("\n------------- test4 ----------------\n");
+ run_test(buff, 6, pattern1, 6);
+
+ /* Input has invalid low surrogate. */
+ printf("\n------------- test5 ----------------\n");
+ run_test(buff, sizeof buff, invalid, sizeof invalid);
+ run_test(buff, 0, invalid, sizeof invalid);
+
+ /* Convert all pattern buffers */
+ printf("\n------------- test6 ----------------\n");
+ run_test(buff, sizeof buff, pattern1, sizeof pattern1);
+ run_test(buff, sizeof buff, pattern2, sizeof pattern2);
+ run_test(buff, sizeof buff, pattern3, sizeof pattern3);
+ run_test(buff, sizeof buff, pattern4, sizeof pattern4);
+ run_test(buff, sizeof buff, mixed, sizeof mixed);
+
+ /* Make sure we only write the exact number of bytes (and not more) */
+ uint16_t pat[2];
+
+ /* Write 1 byte */
+ printf("\n------------- test7.1 ----------------\n");
+ pat[0] = 0x10;
+ write_and_check(pat, 2, 1);
+
+ /* Write 2 bytes */
+ printf("\n------------- test7.2 ----------------\n");
+ pat[0] = 0x8f;
+ write_and_check(pat, 2, 2);
+
+ /* Write 3 bytes */
+ printf("\n------------- test7.3 ----------------\n");
+ pat[0] = 0x842;
+ write_and_check(pat, 2, 3);
+
+ /* Write 4 bytes */
+ printf("\n------------- test7.4 ----------------\n");
+ pat[0] = 0xd842;
+ pat[1] = 0xdc42;
+ write_and_check(pat, 2, 4);
+
+ return 0;
+}
+
+
+void
+write_and_check_aux(uint16_t *input, unsigned num_input_bytes,
+ unsigned num_expected_output_bytes,
+ unsigned fill_byte)
+{
+ int num_errors, i;
+
+ /* Fill output buffer with FILL_BYTE */
+ memset(buff, fill_byte, sizeof buff);
+
+ /* Execute cu21 */
+ run_test(buff, sizeof buff, input, num_input_bytes);
+
+ /* Make sure the rest of the buffer is unmodified. */
+ num_errors = 0;
+ for (i = num_expected_output_bytes; i < sizeof buff; ++i)
+ if (buff[i] != fill_byte) ++num_errors;
+ if (num_errors)
+ fprintf(stderr, "*** wrote more than one byte\n");
+}
+
+void
+write_and_check(uint16_t *input, unsigned num_input_bytes,
+ unsigned num_expected_output_bytes)
+{
+ write_and_check_aux(input, num_input_bytes, num_expected_output_bytes, 0x0);
+
+ /* Run again with different fill pattern to make sure we did not write
+ an extra 0x0 byte */
+ write_and_check_aux(input, num_input_bytes, num_expected_output_bytes, 0xFF);
+}
Added: trunk/none/tests/s390x/cu21_1.vgtest (+2 -0)
===================================================================
--- trunk/none/tests/s390x/cu21_1.vgtest 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21_1.vgtest 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,2 @@
+prereq: ../../../tests/s390x_features s390x-etf3
+prog: cu21_1
Modified: trunk/none/tests/s390x/Makefile.am (+2 -1)
===================================================================
--- trunk/none/tests/s390x/Makefile.am 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/Makefile.am 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -7,7 +7,7 @@
and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \
trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \
- cs csg cds cdsg
+ cs csg cds cdsg cu21 cu21_1
check_PROGRAMS = $(INSN_TESTS) \
allexec \
@@ -33,3 +33,4 @@
ex_clone_LDFLAGS = -lpthread
tcxb_CFLAGS = $(AM_CFLAGS) -std=gnu99
+cu21_1_CFLAGS = $(AM_CFLAGS) -DM3=1
Modified: trunk/memcheck/tests/s390x/Makefile.am (+1 -1)
===================================================================
--- trunk/memcheck/tests/s390x/Makefile.am 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/memcheck/tests/s390x/Makefile.am 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -2,7 +2,7 @@
dist_noinst_SCRIPTS = filter_stderr
-INSN_TESTS = cs csg cds cdsg
+INSN_TESTS = cs csg cds cdsg cu21
check_PROGRAMS = $(INSN_TESTS)
Added: trunk/none/tests/s390x/cu21.stderr.exp (+2 -0)
===================================================================
--- trunk/none/tests/s390x/cu21.stderr.exp 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21.stderr.exp 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,2 @@
+
+
Added: trunk/none/tests/s390x/cu21_1.stdout.exp (+212 -0)
===================================================================
--- trunk/none/tests/s390x/cu21_1.stdout.exp 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21_1.stdout.exp 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,212 @@
+
+------------- test1 ----------------
+UTF8: <none>
+ cc = 0
+ dst len: 0
+ src len: 0
+
+------------- test2.1 ----------------
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 1
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 3
+
+------------- test2.2 ----------------
+UTF8: 00
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 1
+UTF8: c2 80 df bf
+ cc = 0
+ dst address difference: 4 dst len: 996
+ src address difference: 4 src len: 1
+UTF8: e0 a0 80 ed 9f bf ed b0 80
+ cc = 0
+ dst address difference: 9 dst len: 991
+ src address difference: 6 src len: 1
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 1
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 2
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 8 src len: 3
+
+------------- test3.1 ----------------
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 18
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 18
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 2
+ src address difference: 0 src len: 22
+UTF8: <none>
+ cc = 1
+ dst len: 0
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 1
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 2
+ src address difference: 0 src len: 16
+UTF8: <none>
+ cc = 1
+ dst len: 3
+ src address difference: 0 src len: 16
+
+------------- test3.2 ----------------
+UTF8: 00 7f 47
+ cc = 1
+ dst address difference: 3 dst len: 0
+ src address difference: 6 src len: 10
+UTF8: c2 80 df bf
+ cc = 1
+ dst address difference: 4 dst len: 1
+ src address difference: 4 src len: 14
+UTF8: e0 a0 80 ed 9f bf
+ cc = 1
+ dst address difference: 6 dst len: 1
+ src address difference: 4 src len: 18
+UTF8: e0 a0 80 ed 9f bf
+ cc = 1
+ dst address difference: 6 dst len: 2
+ src address difference: 4 src len: 18
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 1
+ src address difference: 8 src len: 8
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 2
+ src address difference: 8 src len: 8
+UTF8: f0 90 80 80 f4 8f bf bf
+ cc = 1
+ dst address difference: 8 dst len: 3
+ src address difference: 8 src len: 8
+
+------------- test4 ----------------
+UTF8: 00 7f 47
+ cc = 0
+ dst address difference: 3 dst len: 3
+ src address difference: 6 src len: 0
+
+------------- test5 ----------------
+UTF8: <none>
+ cc = 2
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 4
+UTF8: <none>
+ cc = 2
+ dst address difference: 0 dst len: 0
+ src address difference: 0 src len: 4
+
+------------- test6 ----------------
+UTF8: 00 7f 47 56 45 21 7b 3a
+ cc = 0
+ dst address difference: 8 dst len: 992
+ src address difference: 16 src len: 0
+UTF8: c2 80 df bf df 9f c2 8f c4 80 c5 bf d4 af d8 80 db bf
+ cc = 0
+ dst address difference: 18 dst len: 982
+ src address difference: 18 src len: 0
+UTF8: e0 a0 80 ed 9f bf ed b0 80 ef bf bf e0 a0 bf e1 a8 a1 e1 ac 90 e2 88 80 e2 89 9e e2 8b 89 ee 80 81
+ cc = 0
+ dst address difference: 33 dst len: 967
+ src address difference: 22 src len: 0
+UTF8: f0 90 80 80 f4 8f bf bf f3 86 a7 9d ed ba af ed b3 9c
+ cc = 0
+ dst address difference: 18 dst len: 982
+ src address difference: 16 src len: 0
+UTF8: 78 c8 80 ef bf bf f0 90 80 81
+ cc = 0
+ dst address difference: 10 dst len: 990
+ src address difference: 10 src len: 0
+
+------------- test7.1 ----------------
+UTF8: 10
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 0
+UTF8: 10
+ cc = 0
+ dst address difference: 1 dst len: 999
+ src address difference: 2 src len: 0
+
+------------- test7.2 ----------------
+UTF8: c2 8f
+ cc = 0
+ dst address difference: 2 dst len: 998
+ src address difference: 2 src len: 0
+UTF8: c2 8f
+ cc = 0
+ dst address difference: 2 dst len: 998
+ src address difference: 2 src len: 0
+
+------------- test7.3 ----------------
+UTF8: e0 a1 82
+ cc = 0
+ dst address difference: 3 dst len: 997
+ src address difference: 2 src len: 0
+UTF8: e0 a1 82
+ cc = 0
+ dst address difference: 3 dst len: 997
+ src address difference: 2 src len: 0
+
+------------- test7.4 ----------------
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
+UTF8: <none>
+ cc = 0
+ dst address difference: 0 dst len: 1000
+ src address difference: 0 src len: 2
Added: trunk/none/tests/s390x/cu21_1.stderr.exp (+2 -0)
===================================================================
--- trunk/none/tests/s390x/cu21_1.stderr.exp 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21_1.stderr.exp 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,2 @@
+
+
Modified: trunk/docs/internals/s390-opcodes.csv (+1 -1)
===================================================================
--- trunk/docs/internals/s390-opcodes.csv 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/docs/internals/s390-opcodes.csv 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -666,7 +666,7 @@
mvcos,"move with optional specifications",N/A,"privileged instruction"
lptea,"load page-table-entry address",N/A,"privileged instruction"
cu24,"convert utf-16 to utf-32","not implemented","open bugzilla"
-cu21,"convert utf-16 to utf-8","not implemented","open bugzilla"
+cu21,"convert utf-16 to utf-8",implemented
cu42,"convert utf-32 to utf-16","not implemented","open bugzilla"
cu41,"convert utf-32 to utf-8","not implemented","open bugzilla"
cu12,"convert utf-8 to utf-16","not implemented","open bugzilla"
Added: trunk/none/tests/s390x/cu21.vgtest (+1 -0)
===================================================================
--- trunk/none/tests/s390x/cu21.vgtest 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21.vgtest 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1 @@
+prog: cu21
Added: trunk/memcheck/tests/s390x/cu21.vgtest (+2 -0)
===================================================================
--- trunk/memcheck/tests/s390x/cu21.vgtest 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/memcheck/tests/s390x/cu21.vgtest 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,2 @@
+prog: cu21
+vgopts: -q
Added: trunk/memcheck/tests/s390x/cu21.c (+115 -0)
===================================================================
--- trunk/memcheck/tests/s390x/cu21.c 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/memcheck/tests/s390x/cu21.c 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,115 @@
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "../../../none/tests/s390x/opcodes.h"
+
+/* Define various input buffers. */
+
+/* U+0000 to U+007f: Result is 1 byte for each uint16_t */
+uint16_t pattern1[] = {
+ 0x0000, 0x007f, /* corner cases */
+ 0x0047, 0x0056, 0x0045, 0x0021, 0x007b, 0x003a /* misc */
+};
+
+/* U+0080 to U+07ff: Result is 2 bytes for each uint16_t */
+uint16_t pattern2[] = {
+ 0x0080, 0x07ff, /* corner cases */
+ 0x07df, 0x008f, 0x0100, 0x017f, 0x052f, 0x0600, 0x06ff /* misc */
+};
+
+/* U+0800 to U+d7ff: Result is 3 bytes for each uint16_t
+ U+dc00 to U+ffff: Result is 3 bytes for each uint16_t */
+uint16_t pattern3[] = {
+ 0x0800, 0xd7ff, /* corner cases */
+ 0xdc00, 0xffff, /* corner cases */
+ 0x083f, 0x1a21, 0x1b10, 0x2200, 0x225e, 0x22c9, 0xe001 /* misc */
+};
+
+/* U+d800 to U+dbff: Result is 4 bytes for each uint16_t pair */
+uint16_t pattern4[] = {
+ 0xd800, 0xdc00, /* left corner case */
+ 0xdbff, 0xdfff, /* right corner case */
+ 0xdada, 0xdddd, 0xdeaf, 0xdcdc /* misc */
+};
+
+
+void
+do_cu21(uint8_t *dst, uint64_t dst_len, uint16_t *src, uint64_t src_len)
+{
+ /* build up the register pairs */
+ register uint16_t *source asm("4") = src;
+ register uint64_t source_len asm("5") = src_len;
+ register uint8_t *dest asm("2") = dst;
+ register uint64_t dest_len asm("3") = dst_len;
+
+ asm volatile(
+ CU21(0,2,4)
+ : "+d"(dest), "+d"(source), "+d"(source_len), "+d"(dest_len)
+ :
+ : "memory", "cc");
+ return;
+}
+
+int main()
+{
+ /*------------------------------------------------------------*/
+ /* Write to a too small buffer */
+ /*------------------------------------------------------------*/
+
+ /* Write 2 bytes into buffer of length 1 */
+ do_cu21(malloc(1), 10, pattern2, 2); // complaint (2 bytes)
+
+ /* Write 2 bytes into buffer of length 2 */
+ do_cu21(malloc(2), 10, pattern2, 2); // no complaint
+
+ /* Write 3 bytes into buffer of length 1 */
+ do_cu21(malloc(1), 10, pattern3, 2); // 2 complaints (3 = 2+1)
+
+ /* Write 3 bytes into buffer of length 2 */
+ do_cu21(malloc(2), 10, pattern3, 2); // complaint (1 byte)
+
+ /* Write 3 bytes into buffer of length 3 */
+ do_cu21(malloc(3), 10, pattern3, 2); // no complaint
+
+ /* Write 4 bytes into buffer of length 1 */
+ do_cu21(malloc(1), 10, pattern4, 4); // complaint (4 bytes)
+
+ /* Write 4 bytes into buffer of length 2 */
+ do_cu21(malloc(2), 10, pattern4, 4); // complaint (4 bytes)
+
+ /* Write 4 bytes into buffer of length 3 */
+ do_cu21(malloc(3), 10, pattern4, 4); // complaint (4 bytes)
+
+ /* Write 4 bytes into buffer of length 4 */
+ do_cu21(malloc(4), 10, pattern4, 4); // no complaint
+
+ /*------------------------------------------------------------*/
+ /* Read uninitialised data */
+ /*------------------------------------------------------------*/
+ uint8_t *input = malloc(10);
+
+ /* Input buffer is completely uninitialised */
+ do_cu21(malloc(4), 4, (void *)input, 2); // complaint
+
+ /* Read 2 bytes from input buffer. First byte is uninitialised */
+ input = malloc(10);
+ input[0] = 0x0;
+ do_cu21(malloc(4), 4, (void *)input, 2); // complaint
+
+ /* Read 2 bytes from input buffer. Second byte is uninitialised */
+ input = malloc(10);
+ input[1] = 0x0;
+ do_cu21(malloc(4), 4, (void *)input, 2); // complaint
+
+ /* Read 2 bytes from input buffer. All bytes are uninitialised */
+ input = malloc(10);
+ input[0] = input[1] = 0x0;
+ do_cu21(malloc(4), 4, (void *)input, 2); // no complaint
+
+ /* Write to NULL */
+ // do_cu21(NULL, 10, pattern1, sizeof pattern1); // complaint
+
+ return 0;
+}
Property changed: trunk/none/tests/s390x/cu21_1.c (+0 -0)
___________________________________________________________________
Name: svn:special
+ *
Added: trunk/none/tests/s390x/cu21_1.c (+1 -0)
===================================================================
--- trunk/none/tests/s390x/cu21_1.c 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/none/tests/s390x/cu21_1.c 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1 @@
+link cu21.c
\ No newline at end of file
Added: trunk/memcheck/tests/s390x/cu21.stderr.exp (+73 -0)
===================================================================
--- trunk/memcheck/tests/s390x/cu21.stderr.exp 2012-07-20 00:29:06 -23:00 (rev 12764)
+++ trunk/memcheck/tests/s390x/cu21.stderr.exp 2012-07-20 01:17:16 +01:00 (rev 12765)
@@ -0,0 +1,73 @@
+Invalid write of size 2
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:62)
+ Address 0x........ is 0 bytes inside a block of size 1 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:62)
+
+Invalid write of size 2
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:68)
+ Address 0x........ is 0 bytes inside a block of size 1 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:68)
+
+Invalid write of size 1
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:68)
+ Address 0x........ is 1 bytes after a block of size 1 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:68)
+
+Invalid write of size 1
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:71)
+ Address 0x........ is 0 bytes after a block of size 2 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:71)
+
+Invalid write of size 4
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:77)
+ Address 0x........ is 0 bytes inside a block of size 1 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:77)
+
+Invalid write of size 4
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:80)
+ Address 0x........ is 0 bytes inside a block of size 2 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:80)
+
+Invalid write of size 4
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:83)
+ Address 0x........ is 0 bytes inside a block of size 3 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (cu21.c:83)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:94)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:45)
+ by 0x........: main (cu21.c:94)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:99)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:45)
+ by 0x........: main (cu21.c:99)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:53)
+ by 0x........: main (cu21.c:104)
+
+Conditional jump or move depends on uninitialised value(s)
+ at 0x........: do_cu21 (cu21.c:45)
+ by 0x........: main (cu21.c:104)
+
Property changed: trunk/none/tests/s390x (+0 -0)
___________________________________________________________________
Name: svn:ignore
- .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
+ .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
cu21
cu21_1
Added: trunk/memcheck/tests/s390x/cu21.stdout.exp (+0 -0)
===================================================================
Property changed: trunk/memcheck/tests/s390x (+0 -0)
___________________________________________________________________
Name: svn:ignore
- .deps
Makefile
Makefile.in
cs
csg
cds
cdsg
+ .deps
Makefile
Makefile.in
cs
csg
cds
cdsg
cu21
|
|
From: <sv...@va...> - 2012-07-20 00:06:43
|
florian 2012-07-20 01:06:35 +0100 (Fri, 20 Jul 2012)
New Revision: 2441
Log:
Add support for the CU21 instruction (s390x).
Modified files:
trunk/priv/guest_s390_defs.h
trunk/priv/guest_s390_helpers.c
trunk/priv/guest_s390_toIR.c
Modified: trunk/priv/guest_s390_defs.h (+2 -0)
===================================================================
--- trunk/priv/guest_s390_defs.h 2012-07-19 18:22:33 +01:00 (rev 2440)
+++ trunk/priv/guest_s390_defs.h 2012-07-20 01:06:35 +01:00 (rev 2441)
@@ -80,7 +80,9 @@
ULong s390x_dirtyhelper_STCKF(ULong *addr);
ULong s390x_dirtyhelper_STCKE(ULong *addr);
ULong s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, HWord addr);
+void s390x_dirtyhelper_CUxy(UChar *addr, ULong data, ULong num_bytes);
+ULong s390_do_cu21(UInt srcvalue, UInt low_surrogate);
UInt s390_do_cvb(ULong decimal);
ULong s390_do_cvd(ULong binary);
Modified: trunk/priv/guest_s390_toIR.c (+134 -1)
===================================================================
--- trunk/priv/guest_s390_toIR.c 2012-07-19 18:22:33 +01:00 (rev 2440)
+++ trunk/priv/guest_s390_toIR.c 2012-07-20 01:06:35 +01:00 (rev 2441)
@@ -11193,7 +11193,138 @@
return "tre";
}
+static IRExpr *
+s390_call_cu21(IRExpr *srcval, IRExpr *low_surrogate)
+{
+ IRExpr **args, *call;
+ args = mkIRExprVec_2(srcval, low_surrogate);
+ call = mkIRExprCCall(Ity_I64, 0 /*regparm*/,
+ "s390_do_cu21", &s390_do_cu21, args);
+ /* Nothing is excluded from definedness checking. */
+ call->Iex.CCall.cee->mcx_mask = 0;
+
+ return call;
+}
+
+static HChar *
+s390_irgen_CU21(UChar m3, UChar r1, UChar r2)
+{
+ IRTemp addr1 = newTemp(Ity_I64);
+ IRTemp addr2 = newTemp(Ity_I64);
+ IRTemp len1 = newTemp(Ity_I64);
+ IRTemp len2 = newTemp(Ity_I64);
+
+ assign(addr1, get_gpr_dw0(r1));
+ assign(addr2, get_gpr_dw0(r2));
+ assign(len1, get_gpr_dw0(r1 + 1));
+ assign(len2, get_gpr_dw0(r2 + 1));
+
+ /* We're processing the 2nd operand 2 bytes at a time. Therefore, if
+ there are less than 2 bytes left, then the 2nd operand is exhausted
+ and we're done here. cc = 0 */
+ s390_cc_set(0);
+ if_condition_goto(binop(Iop_CmpLT64U, mkexpr(len2), mkU64(2)),
+ guest_IA_next_instr);
+
+ /* There are at least two bytes there. Read them. */
+ IRTemp srcval = newTemp(Ity_I32);
+ assign(srcval, unop(Iop_16Uto32, load(Ity_I16, mkexpr(addr2))));
+
+ /* Find out whether this is a high surrogate. I.e. SRCVAL lies
+ inside the interval [0xd800 - 0xdbff] */
+ IRTemp is_high_surrogate = newTemp(Ity_I32);
+ IRExpr *flag1 = mkite(binop(Iop_CmpLE32U, mkU32(0xd800), mkexpr(srcval)),
+ mkU32(1), mkU32(0));
+ IRExpr *flag2 = mkite(binop(Iop_CmpLE32U, mkexpr(srcval), mkU32(0xdbff)),
+ mkU32(1), mkU32(0));
+ assign(is_high_surrogate, binop(Iop_And32, flag1, flag2));
+
+ /* If SRCVAL is a high surrogate and there are less than 4 bytes left,
+ then the 2nd operand is exhausted and we're done here. cc = 0 */
+ IRExpr *not_enough_bytes =
+ mkite(binop(Iop_CmpLT64U, mkexpr(len2), mkU64(4)), mkU32(1), mkU32(0));
+
+ if_condition_goto(binop(Iop_CmpEQ32,
+ binop(Iop_And32, mkexpr(is_high_surrogate),
+ not_enough_bytes),
+ mkU32(1)), guest_IA_next_instr);
+
+ /* The 2nd operand is not exhausted. If the first 2 bytes are a high
+ surrogate, read the next two bytes (low surrogate). */
+ IRTemp low_surrogate = newTemp(Ity_I32);
+ IRExpr *low_surrogate_addr = binop(Iop_Add64, mkexpr(addr2), mkU64(2));
+
+ assign(low_surrogate,
+ mkite(binop(Iop_CmpEQ32, mkexpr(is_high_surrogate), mkU32(1)),
+ unop(Iop_16Uto32, load(Ity_I16, low_surrogate_addr)),
+ mkU32(0))); // any value is fine; it will not be used
+
+ /* Call the helper */
+ IRTemp retval = newTemp(Ity_I64);
+ assign(retval, s390_call_cu21(mkexpr(srcval), mkexpr(low_surrogate)));
+
+ /* Before we can test whether the 1st operand is exhausted we need to
+ test for an invalid low surrogate. Because cc=2 outranks cc=1. */
+ if (s390_host_has_etf3 && (m3 & 0x1) == 1) {
+ IRExpr *invalid_low_surrogate =
+ binop(Iop_And64, mkexpr(retval), mkU64(0xff));
+
+ s390_cc_set(2);
+ if_condition_goto(binop(Iop_CmpEQ64, invalid_low_surrogate, mkU64(1)),
+ guest_IA_next_instr);
+ }
+
+ /* Now test whether the 1st operand is exhausted */
+ IRTemp num_bytes = newTemp(Ity_I64);
+ assign(num_bytes, binop(Iop_And64,
+ binop(Iop_Shr64, mkexpr(retval), mkU8(8)),
+ mkU64(0xff)));
+ s390_cc_set(1);
+ if_condition_goto(binop(Iop_CmpLT64U, mkexpr(len1), mkexpr(num_bytes)),
+ guest_IA_next_instr);
+
+ /* Extract the bytes to be stored at addr1 */
+ IRTemp data = newTemp(Ity_I64);
+ assign(data, binop(Iop_Shr64, mkexpr(retval), mkU8(16)));
+
+ /* To store the bytes construct 4 dirty helper calls. The helper calls
+ are guarded (num_bytes == 1, num_bytes == 2, etc) such that only
+ one of them will be called at runtime. */
+ int i;
+ for (i = 1; i <= 4; ++i) {
+ IRDirty *d;
+
+ d = unsafeIRDirty_0_N(0 /* regparms */, "s390x_dirtyhelper_CUxy",
+ &s390x_dirtyhelper_CUxy,
+ mkIRExprVec_3(mkexpr(addr1), mkexpr(data),
+ mkexpr(num_bytes)));
+ d->guard = binop(Iop_CmpEQ64, mkexpr(num_bytes), mkU64(i));
+ d->mFx = Ifx_Write;
+ d->mAddr = mkexpr(addr1);
+ d->mSize = i;
+ stmt(IRStmt_Dirty(d));
+ }
+
+ /* Update source address and length */
+ IRTemp num_src_bytes = newTemp(Ity_I64);
+ assign(num_src_bytes,
+ mkite(binop(Iop_CmpEQ32, mkexpr(is_high_surrogate), mkU32(1)),
+ mkU64(4), mkU64(2)));
+ put_gpr_dw0(r2, binop(Iop_Add64, mkexpr(addr2), mkexpr(num_src_bytes)));
+ put_gpr_dw0(r2 + 1, binop(Iop_Sub64, mkexpr(len2), mkexpr(num_src_bytes)));
+
+ /* Update destination address and length */
+ put_gpr_dw0(r1, binop(Iop_Add64, mkexpr(addr1), mkexpr(num_bytes)));
+ put_gpr_dw0(r1 + 1, binop(Iop_Sub64, mkexpr(len1), mkexpr(num_bytes)));
+
+ /* Iterate */
+ always_goto_and_chase(guest_IA_curr_instr);
+
+ return "cu21";
+}
+
+
/*------------------------------------------------------------*/
/*--- Build IR for special instructions ---*/
/*------------------------------------------------------------*/
@@ -11635,7 +11766,9 @@
case 0xb29d: s390_format_S_RD(s390_irgen_LFPC, ovl.fmt.S.b2, ovl.fmt.S.d2);
goto ok;
case 0xb2a5: s390_format_RRE_FF(s390_irgen_TRE, ovl.fmt.RRE.r1, ovl.fmt.RRE.r2); goto ok;
- case 0xb2a6: /* CU21 */ goto unimplemented;
+ case 0xb2a6: s390_format_RRF_M0RERE(s390_irgen_CU21, ovl.fmt.RRF3.r3,
+ ovl.fmt.RRF3.r1, ovl.fmt.RRF3.r2);
+ goto ok;
case 0xb2a7: /* CU12 */ goto unimplemented;
case 0xb2b0: s390_format_S_RD(s390_irgen_STFLE, ovl.fmt.S.b2, ovl.fmt.S.d2);
goto ok;
Modified: trunk/priv/guest_s390_helpers.c (+115 -0)
===================================================================
--- trunk/priv/guest_s390_helpers.c 2012-07-19 18:22:33 +01:00 (rev 2440)
+++ trunk/priv/guest_s390_helpers.c 2012-07-20 01:06:35 +01:00 (rev 2441)
@@ -339,8 +339,123 @@
}
#endif /* VGA_s390x */
+/*------------------------------------------------------------*/
+/*--- Dirty helper for the "convert unicode" insn family. ---*/
+/*------------------------------------------------------------*/
+void
+s390x_dirtyhelper_CUxy(UChar *address, ULong data, ULong num_bytes)
+{
+ UInt i;
+ vassert(num_bytes >= 1 && num_bytes <= 4);
+
+ /* Store the least significant NUM_BYTES bytes in DATA left to right
+ at ADDRESS. */
+ for (i = 1; i <= num_bytes; ++i) {
+ address[num_bytes - i] = data & 0xff;
+ data >>= 8;
+ }
+}
+
+
/*------------------------------------------------------------*/
+/*--- Clean helper for CU21. ---*/
+/*------------------------------------------------------------*/
+
+/* The function performs a CU21 operation. It returns three things
+ encoded in an ULong value:
+ - the converted bytes (at most 4)
+ - the number of converted bytes
+ - an indication whether LOW_SURROGATE, if any, is invalid
+
+ 64 48 16 8 0
+ +-------+-----------------+-----------+-----------------------+
+ | 0x0 | converted bytes | num_bytes | invalid_low_surrogate |
+ +-------+-----------------+-----------+-----------------------+
+*/
+ULong
+s390_do_cu21(UInt srcval, UInt low_surrogate)
+{
+ ULong retval = 0; // shut up gcc
+ UInt b1, b2 , b3 , b4, num_bytes, invalid_low_surrogate = 0;
+
+ srcval &= 0xffff;
+
+ /* Determine the number of bytes in the converted value */
+ if (srcval <= 0x007f)
+ num_bytes = 1;
+ else if (srcval >= 0x0080 && srcval <= 0x07ff)
+ num_bytes = 2;
+ else if ((srcval >= 0x0800 && srcval <= 0xd7ff) ||
+ (srcval >= 0xdc00 && srcval <= 0xffff))
+ num_bytes = 3;
+ else
+ num_bytes = 4;
+
+ /* Determine UTF-8 bytes according to calculated num_bytes */
+ switch (num_bytes){
+ case 1:
+ retval = srcval;
+ break;
+
+ case 2:
+ /* order of bytes left to right: b1, b2 */
+ b1 = 0xc0;
+ b1 |= srcval >> 6;
+
+ b2 = 0x80;
+ b2 |= srcval & 0x3f;
+
+ retval = (b1 << 8) | b2;
+ break;
+
+ case 3:
+ /* order of bytes left to right: b1, b2, b3 */
+ b1 = 0xe0;
+ b1 |= srcval >> 12;
+
+ b2 = 0x80;
+ b2 |= (srcval >> 6) & 0x3f;
+
+ b3 = 0x80;
+ b3 |= srcval & 0x3f;
+
+ retval = (b1 << 16) | (b2 << 8) | b3;
+ break;
+
+ case 4: {
+ /* order of bytes left to right: b1, b2, b3, b4 */
+ UInt high_surrogate = srcval;
+ UInt uvwxy = ((high_surrogate >> 6) & 0xf) + 1; // abcd + 1
+
+ b1 = 0xf0;
+ b1 |= uvwxy >> 2; // uvw
+
+ b2 = 0x80;
+ b2 |= (uvwxy & 0x3) << 4; // xy
+ b2 |= (high_surrogate >> 2) & 0xf; // efgh
+
+ b3 = 0x80;
+ b3 |= (high_surrogate & 0x3) << 4; // ij
+ b3 |= (low_surrogate >> 6) & 0xf; // klmn
+
+ b4 = 0x80;
+ b4 |= low_surrogate & 0x3f;
+
+ retval = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+
+ invalid_low_surrogate = (low_surrogate & 0xfc00) != 0xdc00;
+ break;
+ }
+ }
+
+ /* At this point RETVAL contains the converted bytes.
+ Build up the final return value. */
+ return (retval << 16) | (num_bytes << 8) | invalid_low_surrogate;
+}
+
+
+/*------------------------------------------------------------*/
/*--- Clean helper for "convert to binary". ---*/
/*------------------------------------------------------------*/
#if defined(VGA_s390x)
|