File: prctl-sve.c

package info (click to toggle)
strace 6.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 64,424 kB
  • sloc: ansic: 160,349; sh: 9,223; makefile: 3,817; cpp: 944; awk: 353; perl: 267; exp: 62; sed: 9
file content (55 lines) | stat: -rw-r--r-- 1,456 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Check decoding of prctl PR_SVE_SET_VL/PR_SVE_GET_VL operations.
 *
 * Copyright (c) 2021 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "tests.h"
#include "scno.h"
#include <stdio.h>
#include <unistd.h>
#include <linux/prctl.h>

int
main(void)
{
	long rc;

	prctl_marker();

	rc = syscall(__NR_prctl, PR_SVE_SET_VL, 0xf);
	printf("prctl(PR_SVE_SET_VL, %#lx) = %s\n", (unsigned long) 0xf,
		   sprintrc(rc));

	rc = syscall(__NR_prctl, PR_SVE_SET_VL, 0xff);
	printf("prctl(PR_SVE_SET_VL, %#lx) = %s\n", (unsigned long) 0xff,
		   sprintrc(rc));

	rc = syscall(__NR_prctl, PR_SVE_SET_VL, PR_SVE_SET_VL_ONEXEC | 0xff);
	printf("prctl(PR_SVE_SET_VL, PR_SVE_SET_VL_ONEXEC|%#lx) = %s\n",
		   (unsigned long) 0xff, sprintrc(rc));

	rc = syscall(__NR_prctl, PR_SVE_SET_VL, PR_SVE_VL_INHERIT | 0xff);
	printf("prctl(PR_SVE_SET_VL, PR_SVE_VL_INHERIT|%#lx) = %s\n",
		   (unsigned long) 0xff, sprintrc(rc));

	rc = syscall(__NR_prctl, PR_SVE_SET_VL,
				 PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT | 0xff);
	printf("prctl(PR_SVE_SET_VL, "
		   "PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|%#lx) = %s\n",
		   (unsigned long) 0xff, sprintrc(rc));

	rc = syscall(__NR_prctl, PR_SVE_GET_VL);
	printf("prctl(PR_SVE_GET_VL) = %s", sprintrc(rc));
	if (rc >= 0) {
		printf(" (PR_SVE_SET_VL_ONEXEC|PR_SVE_VL_INHERIT|%#lx)",
			   (unsigned long) 0xff);
	}
	puts("");

	puts("+++ exited with 0 +++");
	return 0;
}