1 /* Scalar test for new modctl syscall commands available on newer Solaris. */ 2 3 #include "scalar.h" 4 #include "../../../config.h" 5 6 #include <sys/modctl.h> 7 #if defined(HAVE_SYS_SYSNVL_H) 8 #include <sys/sysnvl.h> 9 #endif /* HAVE_SYS_SYSNVL_H */ 10 11 __attribute__((noinline)) 12 static void sys_modctl(void) 13 { 14 GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 5s 1m"); 15 SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, 16 # if defined(HAVE_SYS_SYSNVL_H) 17 x0 + SYSNVL_OP_GET, 18 # else 19 x0 + MODCTL_NVL_OP_GET, 20 # endif /* HAVE_SYS_SYSNVL_H */ 21 x0, x0 + 1, x0); FAIL; 22 } 23 24 __attribute__((noinline)) 25 static void sys_modctl2(void) 26 { 27 uint64_t buflen = x0 + 10; 28 29 GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 4s 2m"); 30 SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, 31 # if defined(HAVE_SYS_SYSNVL_H) 32 x0 + SYSNVL_OP_GET, 33 # else 34 x0 + MODCTL_NVL_OP_GET, 35 # endif /* HAVE_SYS_SYSNVL_H */ 36 x0 + 1, &buflen, x0 + 1); FAIL; 37 } 38 39 __attribute__((noinline)) 40 static void sys_modctl3(void) 41 { 42 GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m"); 43 SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, 44 # if defined(HAVE_SYS_SYSNVL_H) 45 x0 + SYSNVL_OP_UPDATE, 46 # else 47 x0 + MODCTL_NVL_OP_UPDATE, 48 # endif /* HAVE_SYS_SYSNVL_H */ 49 x0, x0 + 1); FAIL; 50 } 51 52 __attribute__((noinline)) 53 static void sys_modctl4(void) 54 { 55 uint64_t buflen = x0 + 10; 56 57 GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m"); 58 SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, 59 # if defined(HAVE_SYS_SYSNVL_H) 60 x0 + SYSNVL_OP_UPDATE, 61 # else 62 x0 + MODCTL_NVL_OP_UPDATE, 63 # endif /* HAVE_SYS_SYSNVL_H */ 64 x0 + 1, &buflen); FAIL; 65 } 66 67 __attribute__((noinline)) 68 static void sys_modctl5(void) 69 { 70 GO(SYS_modctl, "(MODDEVINFO_CACHE_TS) 2s 1m"); 71 SY(SYS_modctl, x0 + MODDEVINFO_CACHE_TS, x0 + 1); FAIL; 72 } 73 74 int main(void) 75 { 76 /* Uninitialised, but we know px[0] is 0x0. */ 77 long *px = malloc(sizeof(long)); 78 x0 = px[0]; 79 80 /* SYS_modctl 152 */ 81 sys_modctl(); 82 sys_modctl2(); 83 sys_modctl3(); 84 sys_modctl4(); 85 sys_modctl5(); 86 87 return 0; 88 } 89 90