From: Bart Van Assche Date: Sun, 28 Jun 2015 16:30:36 +0000 (+0000) Subject: xen: refactor the various "version not supported" messages into a single helper X-Git-Tag: svn/VALGRIND_3_11_0~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e84ded15a0bc3c2118f87b0dfaecd8397886d6e;p=thirdparty%2Fvalgrind.git xen: refactor the various "version not supported" messages into a single helper Signed-off-by: Ian Campbell Signed-off-by: Andrew Cooper git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15364 --- diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c index 43951039b7..a479d7ab68 100644 --- a/coregrind/m_syswrap/syswrap-xen.c +++ b/coregrind/m_syswrap/syswrap-xen.c @@ -65,6 +65,28 @@ #define PRE(name) static DEFN_PRE_TEMPLATE(xen, name) #define POST(name) static DEFN_POST_TEMPLATE(xen, name) +static void bad_intf_version ( ThreadId tid, + SyscallArgLayout* layout, + /*MOD*/SyscallArgs* args, + /*OUT*/SyscallStatus* status, + /*OUT*/UWord* flags, + const HChar* hypercall, + UWord version) +{ + VG_(dmsg)("WARNING: %s version %#lx not supported\n", + hypercall, version); + if (VG_(clo_verbosity) > 1) { + VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); + } + VG_(dmsg)("You may be able to write your own handler.\n"); + VG_(dmsg)("Read the file README_MISSING_SYSCALL_OR_IOCTL.\n"); + VG_(dmsg)("Nevertheless we consider this a bug. Please report\n"); + VG_(dmsg)("it at http://valgrind.org/support/bug_reports.html &\n"); + VG_(dmsg)("http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen.\n"); + + SET_STATUS_Failure(VKI_ENOSYS); +} + static void bad_subop ( ThreadId tid, SyscallArgLayout* layout, /*MOD*/SyscallArgs* args, @@ -421,18 +443,8 @@ PRE(sysctl) { case 0x0000000a: break; default: - VG_(dmsg)("WARNING: sysctl version %"PRIx32" not supported\n", - sysctl->interface_version); - if (VG_(clo_verbosity) > 1) { - VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); - } - VG_(dmsg)("You may be able to write your own handler.\n"); - VG_(dmsg)("Read the file README_MISSING_SYSCALL_OR_IOCTL.\n"); - VG_(dmsg)("Nevertheless we consider this a bug. Please report\n"); - VG_(dmsg)("it at http://valgrind.org/support/bug_reports.html &\n"); - VG_(dmsg)("http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen.\n"); - - SET_STATUS_Failure(VKI_EINVAL); + bad_intf_version(tid, layout, arrghs, status, flags, + "__HYPERVISOR_sysctl", sysctl->interface_version); return; } @@ -573,18 +585,8 @@ PRE(domctl) case 0x00000009: break; default: - VG_(dmsg)("WARNING: domctl version %"PRIx32" not supported\n", - domctl->interface_version); - if (VG_(clo_verbosity) > 1) { - VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); - } - VG_(dmsg)("You may be able to write your own handler.\n"); - VG_(dmsg)("Read the file README_MISSING_SYSCALL_OR_IOCTL.\n"); - VG_(dmsg)("Nevertheless we consider this a bug. Please report\n"); - VG_(dmsg)("it at http://valgrind.org/support/bug_reports.html &\n"); - VG_(dmsg)("http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen.\n"); - - SET_STATUS_Failure(VKI_EINVAL); + bad_intf_version(tid, layout, arrghs, status, flags, + "__HYPERVISOR_domctl", domctl->interface_version); return; }