Lines Matching +full:2 +full:x32 +full:- +full:bit

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * syscall_numbering.c - test calling the x86-64 kernel with various
33 /* x64-only system call numbers */
37 /* x32-only system call numbers (without X32_BIT) */
44 static int nullfd = -1; /* File descriptor for /dev/null */
45 static bool with_x32; /* x32 supported on this kernel? */
64 [PTP_INTNUM] = "sign-extending the syscall number",
80 unsigned int level = sh ? sh->indent : 0; in offset()
85 #define msg(lvl, fmt, ...) printf("%-*s" fmt, offset(), "[" #lvl "]", \
95 sh->nerr++; \
100 sh->indent = 0; \
106 /* Sentinel for ptrace-modified return value */
107 #define MODIFIED_BY_PTRACE -9999
133 sh->probing_syscall = true; in probe_syscall()
140 sh->probing_syscall = false; in probe_syscall()
148 const char * const type = (start & X32_BIT) ? "x32" : "x64"; in syscall_str()
152 * Improve readability by stripping the x32 bit, but round in syscall_str()
153 * toward zero so we don't display -1 as -1073741825. in syscall_str()
165 type, msb, lsb, lsb + (end-start)); in syscall_str()
175 sh->indent++; in _check_for()
177 sh->indent++; in _check_for()
191 sh->indent--; in _check_for()
203 sh->indent--; in _check_for()
218 return check_for(msb, nr, nr, -ENOSYS); in check_enosys()
223 * supports x32. Tell them. This can also be used to conditionalize
224 * tests based on existence or nonexistence of x32.
231 run("Checking for x32 by calling x32 getpid()\n"); in test_x32()
234 sh->indent++; in test_x32()
236 info("x32 is supported\n"); in test_x32()
238 } else if (ret == -ENOSYS) { in test_x32()
239 info("x32 is not supported\n"); in test_x32()
242 …fail("x32 getpid() returned %lld, but it should have returned either %lld or -ENOSYS\n", ret, (lon… in test_x32()
245 sh->indent--; in test_x32()
251 enum ptrace_pass pass = sh->ptrace_pass; in test_syscalls_common()
253 run("Checking some common syscalls as 64 bit\n"); in test_syscalls_common()
257 run("Checking some 64-bit only syscalls as 64 bit\n"); in test_syscalls_common()
262 check_for(msb, -64, -2, -ENOSYS); in test_syscalls_common()
264 check_for(msb, -1, -1, MODIFIED_BY_PTRACE); in test_syscalls_common()
266 check_for(msb, -1, -1, -ENOSYS); in test_syscalls_common()
267 check_for(msb, X32_BIT-64, X32_BIT-1, -ENOSYS); in test_syscalls_common()
268 check_for(msb, -64-X32_BIT, -1-X32_BIT, -ENOSYS); in test_syscalls_common()
269 check_for(msb, INT_MAX-64, INT_MAX-1, -ENOSYS); in test_syscalls_common()
275 * Syscalls 512-547 are "x32" syscalls. They are in test_syscalls_with_x32()
276 * intended to be called with the x32 (0x40000000) bit in test_syscalls_with_x32()
277 * set. Calling them without the x32 bit set is in test_syscalls_with_x32()
280 run("Checking x32 syscalls as 64 bit\n"); in test_syscalls_with_x32()
281 check_for(msb, 512, 547, -ENOSYS); in test_syscalls_with_x32()
283 run("Checking some common syscalls as x32\n"); in test_syscalls_with_x32()
287 run("Checking some x32 syscalls as x32\n"); in test_syscalls_with_x32()
291 run("Checking some 64-bit syscalls as x32\n"); in test_syscalls_with_x32()
299 run("Checking for absence of x32 system calls\n"); in test_syscalls_without_x32()
300 check_for(msb, 0 | X32_BIT, 999 | X32_BIT, -ENOSYS); in test_syscalls_without_x32()
306 0, 1, -1, X32_BIT-1, X32_BIT, X32_BIT-1, -X32_BIT, INT_MAX, in test_syscall_numbering()
310 sh->indent++; in test_syscall_numbering()
321 sh->indent++; in test_syscall_numbering()
329 sh->indent--; in test_syscall_numbering()
332 sh->indent--; in test_syscall_numbering()
345 for (sh->ptrace_pass = pass = PTP_NOTHING; pass < PTP_DONE; in syscall_numbering_tracee()
346 sh->ptrace_pass = ++pass) { in syscall_numbering_tracee()
356 sh->probing_syscall = false; /* Do this on entry only */ in mess_with_syscall()
409 if (sh->probing_syscall && WSTOPSIG(wstatus) == SIGTRAP) in syscall_numbering_tracer()
410 mess_with_syscall(testpid, sh->ptrace_pass); in syscall_numbering_tracer()
411 } while (sh->ptrace_pass != PTP_DONE && in syscall_numbering_tracer()
473 nerr = sh->nerr; in main()