summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-01-03 06:17:35 +0100
committerCedric BAIL <cedric@osg.samsung.com>2018-01-04 12:58:45 -0800
commit7af3ad2160339bad193643d4d60dfef4c91de304 (patch)
tree88907cfe477c8e10ee76757f46b4dc934bf9e90f
parent9b2c0d0988970d3c1b60ffd2ca9429cf096ebc84 (diff)
evil: remove useless code
-rw-r--r--src/bin/evil/evil_suite.c1
-rw-r--r--src/bin/evil/evil_test_memcpy.c145
-rw-r--r--src/bin/evil/evil_test_memcpy.h8
-rw-r--r--src/bin/evil/memcpy_glibc_arm.S231
-rw-r--r--src/bin/evil/memcpy_glibc_i686.S81
5 files changed, 0 insertions, 466 deletions
diff --git a/src/bin/evil/evil_suite.c b/src/bin/evil/evil_suite.c
index ba928f0682..07b775875f 100644
--- a/src/bin/evil/evil_suite.c
+++ b/src/bin/evil/evil_suite.c
@@ -15,7 +15,6 @@
15#include "evil_test_environment.h" 15#include "evil_test_environment.h"
16#include "evil_test_gettimeofday.h" 16#include "evil_test_gettimeofday.h"
17#include "evil_test_link.h" 17#include "evil_test_link.h"
18#include "evil_test_memcpy.h"
19#include "evil_test_mkstemp.h" 18#include "evil_test_mkstemp.h"
20#include "evil_test_pipe.h" 19#include "evil_test_pipe.h"
21#include "evil_test_print.h" 20#include "evil_test_print.h"
diff --git a/src/bin/evil/evil_test_memcpy.c b/src/bin/evil/evil_test_memcpy.c
deleted file mode 100644
index f8483db5c5..0000000000
--- a/src/bin/evil/evil_test_memcpy.c
+++ /dev/null
@@ -1,145 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif /* HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#define WIN32_LEAN_AND_MEAN
9#include <windows.h>
10#undef WIN32_LEAN_AND_MEAN
11
12#include "evil_suite.h"
13#include "evil_test_memcpy.h"
14
15
16typedef void *(*memcpy_decl)(void *dest, const void *src, size_t n);
17
18void *memcpy_glibc(void *dest, const void *src, size_t n);
19
20
21static unsigned char *buf1 = NULL;
22static unsigned char *buf2 = NULL;
23static size_t page_size = 0;
24
25
26#if defined (__MINGW32CE__) || defined (_MSC_VER)
27static int
28getpagesize()
29{
30 return 1024;
31}
32#endif /* __MINGW32CE__ || _MSC_VER */
33
34
35static void
36test_memcpy_test_run(suite *s, memcpy_decl fct, char *dst, const char *src, size_t len)
37{
38 double best;
39 int i;
40
41 best = 1000000000.0;
42
43 for (i = 0; i < 128; ++i)
44 {
45 double time;
46
47 suite_time_start(s);
48 fct(dst, src, len);
49 suite_time_stop(s);
50 time = suite_time_get(s);
51 if (time < best) best = time;
52 }
53
54 printf (" %e", best);
55}
56
57static void
58test_memcpy_tests_run(suite *s, size_t align1, size_t align2, size_t len)
59{
60 size_t i, j;
61 char *s1, *s2;
62
63 printf ("running test..\n");
64
65/* align1 &= 63; */
66/* if (align1 + len >= page_size) */
67/* return; */
68
69/* align2 &= 63; */
70/* if (align2 + len >= page_size) */
71/* return; */
72
73 s1 = (char *) (buf1 + align1);
74 s2 = (char *) (buf2 + align2);
75
76 for (i = 0, j = 1; i < len; i++, j += 23)
77 s1[i] = j;
78
79 printf ("length: %6d, align %2Iu/%2Iu:", (int)len, align1, align2);
80
81 test_memcpy_test_run(s, memcpy, s2, s1, len);
82#ifdef _WIN32_WCE
83 test_memcpy_test_run(s, memcpy_glibc, s2, s1, len);
84#endif /* _WIN32_WCE */
85
86 printf ("\n");
87}
88
89int
90test_memcpy(suite *s)
91{
92 size_t i;
93
94 page_size = 2 * 1024;
95
96 buf1 = (unsigned char *)malloc(16 * getpagesize());
97 if (!buf1) return 0;
98
99 buf2 = (unsigned char *)malloc(16 * getpagesize());
100 if (!buf2)
101 {
102 free(buf1);
103 return 0;
104 }
105
106 memset (buf1, 0xa5, page_size);
107 memset (buf2, 0x5a, page_size);
108
109 for (i = 0; i < 5; ++i)
110 {
111 test_memcpy_tests_run(s, 0, 0, 1 << i);
112 test_memcpy_tests_run(s, i, 0, 1 << i);
113 test_memcpy_tests_run(s, 0, i, 1 << i);
114 test_memcpy_tests_run(s, i, i, 1 << i);
115 }
116
117 for (i = 0; i < 32; ++i)
118 {
119 test_memcpy_tests_run(s, 0, 0, i);
120 test_memcpy_tests_run(s, i, 0, i);
121 test_memcpy_tests_run(s, 0, i, i);
122 test_memcpy_tests_run(s, i, i, i);
123 }
124
125 for (i = 3; i < 32; ++i)
126 {
127 if ((i & (i - 1)) == 0)
128 continue;
129 test_memcpy_tests_run(s, 0, 0, 16 * i);
130 test_memcpy_tests_run(s, i, 0, 16 * i);
131 test_memcpy_tests_run(s, 0, i, 16 * i);
132 test_memcpy_tests_run(s, i, i, 16 * i);
133 }
134
135 test_memcpy_tests_run(s, 0, 0, getpagesize ());
136 test_memcpy_tests_run(s, 0, 0, 2 * getpagesize ());
137 test_memcpy_tests_run(s, 0, 0, 4 * getpagesize ());
138 test_memcpy_tests_run(s, 0, 0, 8 * getpagesize ());
139 test_memcpy_tests_run(s, 0, 0, 16 * getpagesize ());
140
141 free(buf2);
142 free(buf1);
143
144 return 1;
145}
diff --git a/src/bin/evil/evil_test_memcpy.h b/src/bin/evil/evil_test_memcpy.h
deleted file mode 100644
index 808dd09f37..0000000000
--- a/src/bin/evil/evil_test_memcpy.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __EVIL_TEST_MEMCPY__
2#define __EVIL_TEST_MEMCPY__
3
4
5int test_memcpy(suite *s);
6
7
8#endif /* __EVIL_TEST_MEMCPY__ */
diff --git a/src/bin/evil/memcpy_glibc_arm.S b/src/bin/evil/memcpy_glibc_arm.S
deleted file mode 100644
index 7c42898647..0000000000
--- a/src/bin/evil/memcpy_glibc_arm.S
+++ /dev/null
@@ -1,231 +0,0 @@
1/* Copyright (C) 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
4 Contributed by MontaVista Software, Inc. (written by Nicolas Pitre)
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
20
21/* Copyright (C) 2008 Vincent Torri
22 modification of the name and of the entry / end declaration
23 */
24
25/*
26 * Data preload for architectures that support it (ARM V5TE and above)
27 */
28#if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
29 && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__) \
30 && !defined (__ARM_ARCH_4T__) && !defined (__ARM_ARCH_5__) \
31 && !defined (__ARM_ARCH_5T__))
32#define PLD(code...) code
33#else
34#define PLD(code...)
35#endif
36
37/*
38 * This can be used to enable code to cacheline align the source pointer.
39 * Experiments on tested architectures (StrongARM and XScale) didn't show
40 * this a worthwhile thing to do. That might be different in the future.
41 */
42//#define CALGN(code...) code
43#define CALGN(code...)
44
45/*
46 * Endian independent macros for shifting bytes within registers.
47 */
48#ifndef __ARMEB__
49#define pull lsr
50#define push lsl
51#else
52#define pull lsl
53#define push lsr
54#endif
55
56 .text
57
58/* Prototype: void *memcpy_glibc(void *dest, const void *src, size_t n); */
59
60 .align
61 .global memcpy_glibc
62 .func memcpy_glibc
63memcpy_glibc:
64
65 stmfd sp!, {r0, r4, lr}
66
67 subs r2, r2, #4
68 blt 8f
69 ands ip, r0, #3
70 PLD( pld [r1, #0] )
71 bne 9f
72 ands ip, r1, #3
73 bne 10f
74
751: subs r2, r2, #(28)
76 stmfd sp!, {r5 - r8}
77 blt 5f
78
79 CALGN( ands ip, r1, #31 )
80 CALGN( rsb r3, ip, #32 )
81 CALGN( sbcnes r4, r3, r2 ) @ C is always set here
82 CALGN( bcs 2f )
83 CALGN( adr r4, 6f )
84 CALGN( subs r2, r2, r3 ) @ C gets set
85 CALGN( add pc, r4, ip )
86
87 PLD( pld [r1, #0] )
882: PLD( subs r2, r2, #96 )
89 PLD( pld [r1, #28] )
90 PLD( blt 4f )
91 PLD( pld [r1, #60] )
92 PLD( pld [r1, #92] )
93
943: PLD( pld [r1, #124] )
954: ldmia r1!, {r3, r4, r5, r6, r7, r8, ip, lr}
96 subs r2, r2, #32
97 stmia r0!, {r3, r4, r5, r6, r7, r8, ip, lr}
98 bge 3b
99 PLD( cmn r2, #96 )
100 PLD( bge 4b )
101
1025: ands ip, r2, #28
103 rsb ip, ip, #32
104 addne pc, pc, ip @ C is always clear here
105 b 7f
1066: nop
107 ldr r3, [r1], #4
108 ldr r4, [r1], #4
109 ldr r5, [r1], #4
110 ldr r6, [r1], #4
111 ldr r7, [r1], #4
112 ldr r8, [r1], #4
113 ldr lr, [r1], #4
114
115 add pc, pc, ip
116 nop
117 nop
118 str r3, [r0], #4
119 str r4, [r0], #4
120 str r5, [r0], #4
121 str r6, [r0], #4
122 str r7, [r0], #4
123 str r8, [r0], #4
124 str lr, [r0], #4
125
126 CALGN( bcs 2b )
127
1287: ldmfd sp!, {r5 - r8}
129
1308: movs r2, r2, lsl #31
131 ldrneb r3, [r1], #1
132 ldrcsb r4, [r1], #1
133 ldrcsb ip, [r1]
134 strneb r3, [r0], #1
135 strcsb r4, [r0], #1
136 strcsb ip, [r0]
137
138 ldmfd sp!, {r0, r4, pc}
139
1409: rsb ip, ip, #4
141 cmp ip, #2
142 ldrgtb r3, [r1], #1
143 ldrgeb r4, [r1], #1
144 ldrb lr, [r1], #1
145 strgtb r3, [r0], #1
146 strgeb r4, [r0], #1
147 subs r2, r2, ip
148 strb lr, [r0], #1
149 blt 8b
150 ands ip, r1, #3
151 beq 1b
152
15310: bic r1, r1, #3
154 cmp ip, #2
155 ldr lr, [r1], #4
156 beq 17f
157 bgt 18f
158
159
160 .macro forward_copy_shift pull push
161
162 subs r2, r2, #28
163 blt 14f
164
165 CALGN( ands ip, r1, #31 )
166 CALGN( rsb ip, ip, #32 )
167 CALGN( sbcnes r4, ip, r2 ) @ C is always set here
168 CALGN( subcc r2, r2, ip )
169 CALGN( bcc 15f )
170
17111: stmfd sp!, {r5 - r9}
172
173 PLD( pld [r1, #0] )
174 PLD( subs r2, r2, #96 )
175 PLD( pld [r1, #28] )
176 PLD( blt 13f )
177 PLD( pld [r1, #60] )
178 PLD( pld [r1, #92] )
179
18012: PLD( pld [r1, #124] )
18113: ldmia r1!, {r4, r5, r6, r7}
182 mov r3, lr, pull #\pull
183 subs r2, r2, #32
184 ldmia r1!, {r8, r9, ip, lr}
185 orr r3, r3, r4, push #\push
186 mov r4, r4, pull #\pull
187 orr r4, r4, r5, push #\push
188 mov r5, r5, pull #\pull
189 orr r5, r5, r6, push #\push
190 mov r6, r6, pull #\pull
191 orr r6, r6, r7, push #\push
192 mov r7, r7, pull #\pull
193 orr r7, r7, r8, push #\push
194 mov r8, r8, pull #\pull
195 orr r8, r8, r9, push #\push
196 mov r9, r9, pull #\pull
197 orr r9, r9, ip, push #\push
198 mov ip, ip, pull #\pull
199 orr ip, ip, lr, push #\push
200 stmia r0!, {r3, r4, r5, r6, r7, r8, r9, ip}
201 bge 12b
202 PLD( cmn r2, #96 )
203 PLD( bge 13b )
204
205 ldmfd sp!, {r5 - r9}
206
20714: ands ip, r2, #28
208 beq 16f
209
21015: mov r3, lr, pull #\pull
211 ldr lr, [r1], #4
212 subs ip, ip, #4
213 orr r3, r3, lr, push #\push
214 str r3, [r0], #4
215 bgt 15b
216 CALGN( cmp r2, #0 )
217 CALGN( bge 11b )
218
21916: sub r1, r1, #(\push / 8)
220 b 8b
221
222 .endm
223
224
225 forward_copy_shift pull=8 push=24
226
22717: forward_copy_shift pull=16 push=16
228
22918: forward_copy_shift pull=24 push=8
230
231.endfunc
diff --git a/src/bin/evil/memcpy_glibc_i686.S b/src/bin/evil/memcpy_glibc_i686.S
deleted file mode 100644
index 72da118cf0..0000000000
--- a/src/bin/evil/memcpy_glibc_i686.S
+++ /dev/null
@@ -1,81 +0,0 @@
1/* Copy memory block and return pointer to beginning of destination block
2 For Intel 80x86, x>=6.
3 This file is part of the GNU C Library.
4 Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
5 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
6
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA. */
21
22# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \
23 CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \
24 addl LENGTH, VAL_REG; \
25 cmpl 8+BP_MEM, VAL_REG; \
26 jbe 0f; /* continue if value <= high */ \
27 BOUNDS_VIOLATED; \
28 0: subl LENGTH, VAL_REG /* restore value */
29
30# define RETURN_BOUNDED_POINTER(BP_MEM) \
31 movl RTN(%esp), %edx; \
32 movl %eax, 0(%edx); \
33 movl 4+BP_MEM, %eax; \
34 movl %eax, 4(%edx); \
35 movl 8+BP_MEM, %eax; \
36 movl %eax, 8(%edx)
37
38#define PTR_SIZE 12
39#define RTN_SIZE 4
40#define LINKAGE 8
41
42#define PARMS LINKAGE /* no space for saved regs */
43#define RTN PARMS
44#define DEST RTN+RTN_SIZE
45#define SRC DEST+PTR_SIZE
46#define LEN SRC+PTR_SIZE
47
48 .text
49
50 .align
51 .global memcpy_glibc
52 .func memcpy_glibc
53memcpy_glibc:
54
55 pushl %ebp
56 movl %esp, %ebp
57
58 movl LEN(%esp), %ecx
59 movl %edi, %eax
60 movl DEST(%esp), %edi
61 movl %esi, %edx
62 movl SRC(%esp), %esi
63
64 cld
65 shrl $1, %ecx
66 jnc 1f
67 movsb
681: shrl $1, %ecx
69 jnc 2f
70 movsw
712: rep
72 movsl
73 movl %eax, %edi
74 movl %edx, %esi
75 movl DEST(%esp), %eax
76 RETURN_BOUNDED_POINTER (DEST(%esp))
77
78 movl %ebp, %esp
79 popl %ebp
80
81.endfunc