From 005b66cec8dc823a05ee63ef8ce4fe41eae9db6c Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 13 Oct 2014 16:37:06 +0000 Subject: Decode the arguments passed to _umtx_op(). In particular, decode the opcode. MFC after: 1 week Sponsored by: Norse --- usr.bin/truss/syscall.h | 5 +++-- usr.bin/truss/syscalls.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'usr.bin/truss') diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index f13fa8b..a573611 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -5,6 +5,7 @@ * Hex -- values that should be printed in hex (addresses) * Octal -- Same as above, but octal * Int -- normal integer values (file descriptors, for example) + * LongHex -- long value that should be printed in hex * Name -- pointer to a NULL-terminated string. * BinString -- pointer to an array of chars, printed via strvisx(). * Ptr -- pointer to some unspecified structure. Just print as hex for now. @@ -34,13 +35,13 @@ * $FreeBSD$ */ -enum Argtype { None = 1, Hex, Octal, Int, Name, Ptr, Stat, Ioctl, Quad, +enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres, Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open, Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, - LinuxSockArgs }; + LinuxSockArgs, Umtxop }; #define ARG_MASK 0xff #define OUT 0x100 diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index ebdc72e..700af60 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -279,6 +279,9 @@ static struct syscall syscalls[] = { { Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, .args = { { Idtype, 0 }, { Int, 1 }, { Procctl, 2 }, { Ptr, 3 } } }, + { .name = "_umtx_op", .ret_type = 1, .nargs = 5, + .args = { { Ptr, 0 }, { Umtxop, 1 }, { LongHex, 2 }, { Ptr, 3 }, + { Ptr, 4 } } }, { .name = 0 }, }; @@ -412,6 +415,18 @@ static struct xlat procctl_arg[] = { X(PROC_SPROTECT) XEND }; +static struct xlat umtx_ops[] = { + X(UMTX_OP_RESERVED0) X(UMTX_OP_RESERVED1) X(UMTX_OP_WAIT) + X(UMTX_OP_WAKE) X(UMTX_OP_MUTEX_TRYLOCK) X(UMTX_OP_MUTEX_LOCK) + X(UMTX_OP_MUTEX_UNLOCK) X(UMTX_OP_SET_CEILING) X(UMTX_OP_CV_WAIT) + X(UMTX_OP_CV_SIGNAL) X(UMTX_OP_CV_BROADCAST) X(UMTX_OP_WAIT_UINT) + X(UMTX_OP_RW_RDLOCK) X(UMTX_OP_RW_WRLOCK) X(UMTX_OP_RW_UNLOCK) + X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE) + X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT) + X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2) + XEND +}; + #undef X #undef XEND @@ -608,6 +623,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, case Int: asprintf(&tmp, "%d", (int)args[sc->offset]); break; + case LongHex: + asprintf(&tmp, "0x%lx", args[sc->offset]); + break; case Name: { /* NULL-terminated string. */ char *tmp2; @@ -1275,6 +1293,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, case Procctl: tmp = strdup(xlookup(procctl_arg, args[sc->offset])); break; + case Umtxop: + tmp = strdup(xlookup(umtx_ops, args[sc->offset])); + break; default: errx(1, "Invalid argument type %d\n", sc->type & ARG_MASK); } -- cgit v1.1