29
29
*/
30
30
31
31
#define AFL_MAIN
32
+ #include "android-ashmem.h"
32
33
#define MESSAGES_TO_STDOUT
33
34
34
35
#ifndef _GNU_SOURCE
@@ -888,7 +889,7 @@ EXP_ST void read_bitmap(u8* fname) {
888
889
889
890
static inline u8 has_new_bits (u8 * virgin_map ) {
890
891
891
- #ifdef __x86_64__
892
+ #ifdef WORD_SIZE_64
892
893
893
894
u64 * current = (u64 * )trace_bits ;
894
895
u64 * virgin = (u64 * )virgin_map ;
@@ -902,7 +903,7 @@ static inline u8 has_new_bits(u8* virgin_map) {
902
903
903
904
u32 i = (MAP_SIZE >> 2 );
904
905
905
- #endif /* ^__x86_64__ */
906
+ #endif /* ^WORD_SIZE_64 */
906
907
907
908
u8 ret = 0 ;
908
909
@@ -922,7 +923,7 @@ static inline u8 has_new_bits(u8* virgin_map) {
922
923
/* Looks like we have not found any new bytes yet; see if any non-zero
923
924
bytes in current[] are pristine in virgin[]. */
924
925
925
- #ifdef __x86_64__
926
+ #ifdef WORD_SIZE_64
926
927
927
928
if ((cur [0 ] && vir [0 ] == 0xff ) || (cur [1 ] && vir [1 ] == 0xff ) ||
928
929
(cur [2 ] && vir [2 ] == 0xff ) || (cur [3 ] && vir [3 ] == 0xff ) ||
@@ -936,7 +937,7 @@ static inline u8 has_new_bits(u8* virgin_map) {
936
937
(cur [2 ] && vir [2 ] == 0xff ) || (cur [3 ] && vir [3 ] == 0xff )) ret = 2 ;
937
938
else ret = 1 ;
938
939
939
- #endif /* ^__x86_64__ */
940
+ #endif /* ^WORD_SIZE_64 */
940
941
941
942
}
942
943
@@ -1058,7 +1059,7 @@ static const u8 simplify_lookup[256] = {
1058
1059
1059
1060
};
1060
1061
1061
- #ifdef __x86_64__
1062
+ #ifdef WORD_SIZE_64
1062
1063
1063
1064
static void simplify_trace (u64 * mem ) {
1064
1065
@@ -1115,7 +1116,7 @@ static void simplify_trace(u32* mem) {
1115
1116
1116
1117
}
1117
1118
1118
- #endif /* ^__x86_64__ */
1119
+ #endif /* ^WORD_SIZE_64 */
1119
1120
1120
1121
1121
1122
/* Destructively classify execution counts in a trace. This is used as a
@@ -1152,7 +1153,7 @@ EXP_ST void init_count_class16(void) {
1152
1153
}
1153
1154
1154
1155
1155
- #ifdef __x86_64__
1156
+ #ifdef WORD_SIZE_64
1156
1157
1157
1158
static inline void classify_counts (u64 * mem ) {
1158
1159
@@ -1204,7 +1205,7 @@ static inline void classify_counts(u32* mem) {
1204
1205
1205
1206
}
1206
1207
1207
- #endif /* ^__x86_64__ */
1208
+ #endif /* ^WORD_SIZE_64 */
1208
1209
1209
1210
1210
1211
/* Get rid of shared memory (atexit handler). */
@@ -2441,11 +2442,11 @@ static u8 run_target(char** argv, u32 timeout) {
2441
2442
2442
2443
tb4 = * (u32 * )trace_bits ;
2443
2444
2444
- #ifdef __x86_64__
2445
+ #ifdef WORD_SIZE_64
2445
2446
classify_counts ((u64 * )trace_bits );
2446
2447
#else
2447
2448
classify_counts ((u32 * )trace_bits );
2448
- #endif /* ^__x86_64__ */
2449
+ #endif /* ^WORD_SIZE_64 */
2449
2450
2450
2451
prev_timed_out = child_timed_out ;
2451
2452
@@ -3205,11 +3206,11 @@ static u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) {
3205
3206
3206
3207
if (!dumb_mode ) {
3207
3208
3208
- #ifdef __x86_64__
3209
+ #ifdef WORD_SIZE_64
3209
3210
simplify_trace ((u64 * )trace_bits );
3210
3211
#else
3211
3212
simplify_trace ((u32 * )trace_bits );
3212
- #endif /* ^__x86_64__ */
3213
+ #endif /* ^WORD_SIZE_64 */
3213
3214
3214
3215
if (!has_new_bits (virgin_tmout )) return keeping ;
3215
3216
@@ -3269,11 +3270,11 @@ static u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) {
3269
3270
3270
3271
if (!dumb_mode ) {
3271
3272
3272
- #ifdef __x86_64__
3273
+ #ifdef WORD_SIZE_64
3273
3274
simplify_trace ((u64 * )trace_bits );
3274
3275
#else
3275
3276
simplify_trace ((u32 * )trace_bits );
3276
- #endif /* ^__x86_64__ */
3277
+ #endif /* ^WORD_SIZE_64 */
3277
3278
3278
3279
if (!has_new_bits (virgin_crash )) return keeping ;
3279
3280
@@ -7071,6 +7072,7 @@ static void check_term_size(void) {
7071
7072
7072
7073
if (ioctl (1 , TIOCGWINSZ , & ws )) return ;
7073
7074
7075
+ if (ws .ws_row == 0 && ws .ws_col == 0 ) return ;
7074
7076
if (ws .ws_row < 25 || ws .ws_col < 80 ) term_too_small = 1 ;
7075
7077
7076
7078
}
0 commit comments