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
34 /* x64-only system call numbers */
38 /* x32-only system call numbers (without X32_BIT) */
45 static int nullfd = -1; /* File descriptor for /dev/null */
46 static bool with_x32; /* x32 supported on this kernel? */
65 [PTP_INTNUM] = "sign-extending the syscall number",
81 unsigned int level = sh ? sh->indent : 0; in offset()
86 #define msg(lvl, fmt, ...) printf("%-*s" fmt, offset(), "[" #lvl "]", \
96 sh->nerr++; \
101 sh->indent = 0; \
107 /* Sentinel for ptrace-modified return value */
108 #define MODIFIED_BY_PTRACE -9999
134 sh->probing_syscall = true; in probe_syscall()
141 sh->probing_syscall = false; in probe_syscall()
149 const char * const type = (start & X32_BIT) ? "x32" : "x64"; in syscall_str()
153 * Improve readability by stripping the x32 bit, but round in syscall_str()
154 * toward zero so we don't display -1 as -1073741825. in syscall_str()
166 type, msb, lsb, lsb + (end-start)); in syscall_str()
176 sh->indent++; in _check_for()
178 sh->indent++; in _check_for()
192 sh->indent--; in _check_for()
204 sh->indent--; in _check_for()
219 return check_for(msb, nr, nr, -ENOSYS); in check_enosys()
224 * supports x32. Tell them. This can also be used to conditionalize
225 * tests based on existence or nonexistence of x32.
232 run("Checking for x32 by calling x32 getpid()\n"); in test_x32()
235 sh->indent++; in test_x32()
237 info("x32 is supported\n"); in test_x32()
239 } else if (ret == -ENOSYS) { in test_x32()
240 info("x32 is not supported\n"); in test_x32()
243 …fail("x32 getpid() returned %lld, but it should have returned either %lld or -ENOSYS\n", ret, (lon… in test_x32()
246 sh->indent--; in test_x32()
252 enum ptrace_pass pass = sh->ptrace_pass; in test_syscalls_common()
254 run("Checking some common syscalls as 64 bit\n"); in test_syscalls_common()
258 run("Checking some 64-bit only syscalls as 64 bit\n"); in test_syscalls_common()
263 check_for(msb, -64, -2, -ENOSYS); in test_syscalls_common()
265 check_for(msb, -1, -1, MODIFIED_BY_PTRACE); in test_syscalls_common()
267 check_for(msb, -1, -1, -ENOSYS); in test_syscalls_common()
268 check_for(msb, X32_BIT-64, X32_BIT-1, -ENOSYS); in test_syscalls_common()
269 check_for(msb, -64-X32_BIT, -1-X32_BIT, -ENOSYS); in test_syscalls_common()
270 check_for(msb, INT_MAX-64, INT_MAX-1, -ENOSYS); in test_syscalls_common()
276 * Syscalls 512-547 are "x32" syscalls. They are in test_syscalls_with_x32()
277 * intended to be called with the x32 (0x40000000) bit in test_syscalls_with_x32()
278 * set. Calling them without the x32 bit set is in test_syscalls_with_x32()
281 run("Checking x32 syscalls as 64 bit\n"); in test_syscalls_with_x32()
282 check_for(msb, 512, 547, -ENOSYS); in test_syscalls_with_x32()
284 run("Checking some common syscalls as x32\n"); in test_syscalls_with_x32()
288 run("Checking some x32 syscalls as x32\n"); in test_syscalls_with_x32()
292 run("Checking some 64-bit syscalls as x32\n"); in test_syscalls_with_x32()
300 run("Checking for absence of x32 system calls\n"); in test_syscalls_without_x32()
301 check_for(msb, 0 | X32_BIT, 999 | X32_BIT, -ENOSYS); in test_syscalls_without_x32()
307 0, 1, -1, X32_BIT-1, X32_BIT, X32_BIT-1, -X32_BIT, INT_MAX, in test_syscall_numbering()
311 sh->indent++; in test_syscall_numbering()
322 sh->indent++; in test_syscall_numbering()
330 sh->indent--; in test_syscall_numbering()
333 sh->indent--; in test_syscall_numbering()
346 for (sh->ptrace_pass = pass = PTP_NOTHING; pass < PTP_DONE; in syscall_numbering_tracee()
347 sh->ptrace_pass = ++pass) { in syscall_numbering_tracee()
357 sh->probing_syscall = false; /* Do this on entry only */ in mess_with_syscall()
410 if (sh->probing_syscall && WSTOPSIG(wstatus) == SIGTRAP) in syscall_numbering_tracer()
411 mess_with_syscall(testpid, sh->ptrace_pass); in syscall_numbering_tracer()
412 } while (sh->ptrace_pass != PTP_DONE && in syscall_numbering_tracer()
474 nerr = sh->nerr; in main()