diff options
author | jhb <jhb@FreeBSD.org> | 2014-12-16 21:57:55 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-12-16 21:57:55 +0000 |
commit | 9adaeb545214b0236fb6cee72c68ecda8a52605c (patch) | |
tree | 488576a8e9270f897180c0b768f8c3d6f97c1f5d /usr.bin/kdump | |
parent | 7cc43d5ff85217e4aff8929e976bc2a175891fca (diff) | |
download | FreeBSD-src-9adaeb545214b0236fb6cee72c68ecda8a52605c.zip FreeBSD-src-9adaeb545214b0236fb6cee72c68ecda8a52605c.tar.gz |
MFC 273053:
Decode the arguments passed to _umtx_op(). In particular, decode the
opcode.
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r-- | usr.bin/kdump/kdump.c | 21 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 60 |
2 files changed, 81 insertions, 0 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 8076ae5..673db53 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -57,6 +57,7 @@ extern int errno; #include <sys/socket.h> #include <sys/stat.h> #include <sys/sysent.h> +#include <sys/umtx.h> #include <sys/un.h> #include <sys/queue.h> #include <sys/wait.h> @@ -1187,6 +1188,26 @@ ktrsyscall(struct ktr_syscall *ktr, u_int flags) ip++; narg--; break; + case SYS__umtx_op: + print_number(ip, narg, c); + putchar(','); + umtxopname(*ip); + switch (*ip) { + case UMTX_OP_CV_WAIT: + ip++; + narg--; + putchar(','); + umtxcvwaitflags(*ip); + break; + case UMTX_OP_RW_RDLOCK: + ip++; + narg--; + putchar(','); + umtxrwlockflags(*ip); + break; + } + ip++; + narg--; } } while (narg > 0) { diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 1859086..c026d2a 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -156,6 +156,7 @@ _EOF_ # C start cat <<_EOF_ +#include <errno.h> #include <stdint.h> #include <stdio.h> #include <sys/fcntl.h> @@ -185,6 +186,8 @@ cat <<_EOF_ #include <sys/ipc.h> #include <sys/rtprio.h> #include <sys/shm.h> +#include <machine/atomic.h> +#include <sys/umtx.h> #include <nfsserver/nfs.h> #include <ufs/ufs/quota.h> #include <sys/capability.h> @@ -489,6 +492,7 @@ auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" auto_or_type "thrcreateflagsname" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" +auto_switch_type "umtxopname" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" auto_switch_type "vmresultname" "KERN_[A-Z]+[[:space:]]+[0-9]+" "vm/vm_param.h" auto_or_type "wait6optname" "W[A-Z]+[[:space:]]+[0-9]+" "sys/wait.h" auto_switch_type "whencename" "SEEK_[A-Z]+[[:space:]]+[0-9]+" "sys/unistd.h" @@ -677,6 +681,62 @@ cat <<_EOF_ } } +/* + * AUTO - Special + * + * Just print 0 as 0. + */ +void +umtxcvwaitflags(intmax_t arg) +{ + int or = 0; + if (arg == 0) { + printf("0"); + return; + } + printf("%#jx<", (uintmax_t)arg); +_EOF_ + egrep "^#[[:space:]]*define[[:space:]]+CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+[[:space:]]*" \ + $include_dir/sys/umtx.h | \ + awk '{ for (i = 1; i <= NF; i++) \ + if ($i ~ /define/) \ + break; \ + ++i; \ + printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' +cat <<_EOF_ + printf(">"); + if (or == 0) + printf("<invalid>%jd", arg); +} + + +/* + * AUTO - Special + * + * Just print 0 as 0. + */ +void +umtxrwlockflags(intmax_t arg) +{ + int or = 0; + if (arg == 0) { + printf("0"); + return; + } + printf("%#jx<", (uintmax_t)arg); +_EOF_ + egrep "^#[[:space:]]*define[[:space:]]+URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+[[:space:]]*" \ + $include_dir/sys/umtx.h | \ + awk '{ for (i = 1; i <= NF; i++) \ + if ($i ~ /define/) \ + break; \ + ++i; \ + printf "\tif (!((arg > 0) ^ ((%s) > 0)))\n\t\tif_print_or(arg, %s, or);\n", $i, $i }' +cat <<_EOF_ + printf(">"); + if (or == 0) + printf("<invalid>%jd", arg); +} _EOF_ egrep '#define[[:space:]]+CAP_[A-Z_]+[[:space:]]+CAPRIGHT\([0-9],[[:space:]]+0x[0-9]{16}ULL\)' \ $include_dir/sys/capability.h | \ |