mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-12 06:11:37 +00:00
The new memcheck/tests/arm64-linux/scalar test is based on the memcheck/tests/x86-linux/scalar test and contains all syscalls that are also available on arm64. To make comparison of exp results easier the order of the tested syscalls is the same as on x86. This enables a couple extra arm64 syscalls. Part of the fix for bug #359503 - Add missing syscalls for aarch64 (arm64). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15825
63 lines
1.8 KiB
C
63 lines
1.8 KiB
C
/* This is the arm64 variant of memcheck/tests/x86-linux/scalar.h */
|
|
#include "../../../include/vki/vki-scnums-arm64-linux.h"
|
|
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/syscall.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/ptrace.h>
|
|
#include <sys/types.h>
|
|
#include <sys/mman.h>
|
|
|
|
// Since we use vki_unistd.h, we can't include <unistd.h>. So we have to
|
|
// declare this ourselves.
|
|
extern long int syscall (long int __sysno, ...) __THROW;
|
|
|
|
// Thorough syscall scalar arg checking. Also serves as thorough checking
|
|
// for (very) basic syscall use. Generally not trying to do anything
|
|
// meaningful with the syscalls.
|
|
|
|
#define GO(__NR_xxx, s) \
|
|
fprintf(stderr, "-----------------------------------------------------\n" \
|
|
"%3d:%20s %s\n" \
|
|
"-----------------------------------------------------\n", \
|
|
__NR_xxx, #__NR_xxx, s);
|
|
|
|
#define SY res = syscall
|
|
|
|
#define FAIL assert(-1 == res);
|
|
#define SUCC assert(-1 != res);
|
|
#define SUCC_OR_FAIL /* no test */
|
|
|
|
#define FAILx(E) \
|
|
do { \
|
|
int myerrno = errno; \
|
|
if (-1 == res) { \
|
|
if (E == myerrno) { \
|
|
/* as expected */ \
|
|
} else { \
|
|
fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
|
|
exit(1); \
|
|
} \
|
|
} else { \
|
|
fprintf(stderr, "Expected error %s (%d), got success\n", #E, E); \
|
|
exit(1); \
|
|
} \
|
|
} while (0);
|
|
|
|
#define SUCC_OR_FAILx(E) \
|
|
do { \
|
|
int myerrno = errno; \
|
|
if (-1 == res) { \
|
|
if (E == myerrno) { \
|
|
/* as expected */ \
|
|
} else { \
|
|
fprintf(stderr, "Expected error %s (%d), got %d\n", #E, E, myerrno); \
|
|
exit(1); \
|
|
} \
|
|
} \
|
|
} while (0);
|