File: scalar_modctl_modnvl.c

package info (click to toggle)
valgrind 1%3A3.24.0-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 176,332 kB
  • sloc: ansic: 795,029; exp: 26,134; xml: 23,472; asm: 14,393; cpp: 9,397; makefile: 7,464; sh: 6,122; perl: 5,446; python: 1,498; javascript: 981; awk: 166; csh: 1
file content (89 lines) | stat: -rw-r--r-- 2,063 bytes parent folder | download | duplicates (7)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* Scalar test for new modctl syscall commands available on newer Solaris. */

#include "scalar.h"
#include "../../../config.h"

#include <sys/modctl.h>
#if defined(HAVE_SYS_SYSNVL_H)
#include <sys/sysnvl.h>
#endif /* HAVE_SYS_SYSNVL_H */

__attribute__((noinline))
static void sys_modctl(void)
{
   GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 5s 1m");
   SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC,
#     if defined(HAVE_SYS_SYSNVL_H)
      x0 + SYSNVL_OP_GET,
#     else
      x0 + MODCTL_NVL_OP_GET,
#     endif /* HAVE_SYS_SYSNVL_H */
      x0, x0 + 1, x0); FAIL;
}

__attribute__((noinline))
static void sys_modctl2(void)
{
   uint64_t buflen = x0 + 10;

   GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 4s 2m");
   SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC,
#     if defined(HAVE_SYS_SYSNVL_H)
      x0 + SYSNVL_OP_GET,
#     else
      x0 + MODCTL_NVL_OP_GET,
#     endif /* HAVE_SYS_SYSNVL_H */
      x0 + 1, &buflen, x0 + 1); FAIL;
}

__attribute__((noinline))
static void sys_modctl3(void)
{
   GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m");
   SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC,
#     if defined(HAVE_SYS_SYSNVL_H)
      x0 + SYSNVL_OP_UPDATE,
#     else
      x0 + MODCTL_NVL_OP_UPDATE,
#     endif /* HAVE_SYS_SYSNVL_H */
      x0, x0 + 1); FAIL;
}

__attribute__((noinline))
static void sys_modctl4(void)
{
   uint64_t buflen = x0 + 10;

   GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m");
   SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC,
#     if defined(HAVE_SYS_SYSNVL_H)
      x0 + SYSNVL_OP_UPDATE,
#     else
      x0 + MODCTL_NVL_OP_UPDATE,
#     endif /* HAVE_SYS_SYSNVL_H */
      x0 + 1, &buflen); FAIL;
}

__attribute__((noinline))
static void sys_modctl5(void)
{
   GO(SYS_modctl, "(MODDEVINFO_CACHE_TS) 2s 1m");
   SY(SYS_modctl, x0 + MODDEVINFO_CACHE_TS, x0 + 1); FAIL;
}

int main(void)
{
   /* Uninitialised, but we know px[0] is 0x0. */
   long *px = malloc(sizeof(long));
   x0 = px[0];

   /* SYS_modctl                152 */
   sys_modctl();
   sys_modctl2();
   sys_modctl3();
   sys_modctl4();
   sys_modctl5();

   return 0;
}