Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Sep 2013 13:33:05 +0000 (UTC)
From:      Mark Murray <markm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r255121 - in projects/random_number_generator: contrib/gcc contrib/gcc/config/arm contrib/gcc/doc contrib/gcclibs/libcpp contrib/gcclibs/libcpp/include lib/libc/gen lib/libc/include lib...
Message-ID:  <201309011333.r81DX5tt019618@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markm
Date: Sun Sep  1 13:33:05 2013
New Revision: 255121
URL: http://svnweb.freebsd.org/changeset/base/255121

Log:
  MFC

Added:
  projects/random_number_generator/lib/libc/include/errlst.h
     - copied unchanged from r255120, head/lib/libc/include/errlst.h
Modified:
  projects/random_number_generator/contrib/gcc/ChangeLog.gcc43
  projects/random_number_generator/contrib/gcc/config/arm/libunwind.S
  projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.c
  projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.h
  projects/random_number_generator/contrib/gcc/doc/extend.texi
  projects/random_number_generator/contrib/gcclibs/libcpp/expr.c
  projects/random_number_generator/contrib/gcclibs/libcpp/include/cpplib.h
  projects/random_number_generator/lib/libc/gen/errlst.c
  projects/random_number_generator/lib/libc/stdio/xprintf_errno.c
  projects/random_number_generator/lib/libc/string/strerror.c
  projects/random_number_generator/lib/libelf/libelf_data.c
  projects/random_number_generator/share/examples/scsi_target/scsi_target.c
  projects/random_number_generator/share/man/man4/vtnet.4
  projects/random_number_generator/sys/amd64/amd64/apic_vector.S
  projects/random_number_generator/sys/amd64/amd64/pmap.c
  projects/random_number_generator/sys/cam/ctl/scsi_ctl.c
  projects/random_number_generator/sys/cam/scsi/scsi_enc.c
  projects/random_number_generator/sys/cam/scsi/scsi_targ_bh.c
  projects/random_number_generator/sys/cam/scsi/scsi_target.c
  projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
  projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c
  projects/random_number_generator/sys/cddl/dev/fbt/fbt_powerpc.c
  projects/random_number_generator/sys/dev/virtio/network/if_vtnet.c
  projects/random_number_generator/sys/dev/virtio/network/if_vtnetvar.h
  projects/random_number_generator/sys/dev/virtio/network/virtio_net.h
  projects/random_number_generator/sys/dev/virtio/pci/virtio_pci.c
  projects/random_number_generator/sys/dev/virtio/virtio_if.m
  projects/random_number_generator/sys/dev/virtio/virtqueue.c
  projects/random_number_generator/sys/dev/virtio/virtqueue.h
  projects/random_number_generator/sys/mips/mips/pmap.c
  projects/random_number_generator/sys/modules/virtio/network/Makefile
  projects/random_number_generator/sys/powerpc/powermac/atibl.c
  projects/random_number_generator/sys/powerpc/powermac/nvbl.c
  projects/random_number_generator/sys/vm/uma_core.c
Directory Properties:
  projects/random_number_generator/   (props changed)
  projects/random_number_generator/contrib/gcc/   (props changed)
  projects/random_number_generator/lib/libc/   (props changed)
  projects/random_number_generator/share/man/man4/   (props changed)
  projects/random_number_generator/sys/   (props changed)

Modified: projects/random_number_generator/contrib/gcc/ChangeLog.gcc43
==============================================================================
--- projects/random_number_generator/contrib/gcc/ChangeLog.gcc43	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcc/ChangeLog.gcc43	Sun Sep  1 13:33:05 2013	(r255121)
@@ -1,3 +1,9 @@
+2007-06-05  Joerg Wunsch  <j.gnu@uriah.heep.sax.de> (r23479)
+
+	PR preprocessor/23479
+	* doc/extend.texi: Document the 0b-prefixed binary integer
+	constant extension.
+	
 2007-05-01  Dwarakanath Rajagopal <dwarak.rajagopal@amd.com> (r124341)
 
 	* doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of 

Modified: projects/random_number_generator/contrib/gcc/config/arm/libunwind.S
==============================================================================
--- projects/random_number_generator/contrib/gcc/config/arm/libunwind.S	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcc/config/arm/libunwind.S	Sun Sep  1 13:33:05 2013	(r255121)
@@ -116,5 +116,6 @@ UNWIND_WRAPPER _Unwind_RaiseException 1
 UNWIND_WRAPPER _Unwind_Resume 1
 UNWIND_WRAPPER _Unwind_Resume_or_Rethrow 1
 UNWIND_WRAPPER _Unwind_ForcedUnwind 3
+UNWIND_WRAPPER _Unwind_Backtrace 2
 
-#endif  /* __symbian__ */
+#endif  /* ndef __symbian__ */

Modified: projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.c
==============================================================================
--- projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -747,6 +747,66 @@ _Unwind_DeleteException (_Unwind_Excepti
 }
 
 
+/* Perform stack backtrace through unwind data.  */
+_Unwind_Reason_Code
+__gnu_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument,
+		       phase2_vrs * entry_vrs);
+_Unwind_Reason_Code
+__gnu_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument,
+		       phase2_vrs * entry_vrs)
+{
+  phase1_vrs saved_vrs;
+  _Unwind_Reason_Code code;
+
+  _Unwind_Control_Block ucb;
+  _Unwind_Control_Block *ucbp = &ucb;
+
+  /* Set the pc to the call site.  */
+  entry_vrs->core.r[R_PC] = entry_vrs->core.r[R_LR];
+
+  /* Save the core registers.  */
+  saved_vrs.core = entry_vrs->core;
+  /* Set demand-save flags.  */
+  saved_vrs.demand_save_flags = ~(_uw) 0;
+  
+  do
+    {
+      /* Find the entry for this routine.  */
+      if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK)
+	{
+	  code = _URC_FAILURE;
+	  break;
+	}
+
+      /* The dwarf unwinder assumes the context structure holds things
+	 like the function and LSDA pointers.  The ARM implementation
+	 caches these in the exception header (UCB).  To avoid
+	 rewriting everything we make the virtual IP register point at
+	 the UCB.  */
+      _Unwind_SetGR((_Unwind_Context *)&saved_vrs, 12, (_Unwind_Ptr) ucbp);
+
+      /* Call trace function.  */
+      if ((*trace) ((_Unwind_Context *) &saved_vrs, trace_argument) 
+	  != _URC_NO_REASON)
+	{
+	  code = _URC_FAILURE;
+	  break;
+	}
+
+      /* Call the pr to decide what to do.  */
+      code = ((personality_routine) UCB_PR_ADDR (ucbp))
+	(_US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND, 
+	 ucbp, (void *) &saved_vrs);
+    }
+  while (code != _URC_END_OF_STACK
+	 && code != _URC_FAILURE);
+
+ finish:
+  restore_non_core_regs (&saved_vrs);
+  return code;
+}
+
+
 /* Common implementation for ARM ABI defined personality routines.
    ID is the index of the personality routine, other arguments are as defined
    by __aeabi_unwind_cpp_pr{0,1,2}.  */
@@ -1014,3 +1074,19 @@ _Unwind_GetTextRelBase (_Unwind_Context 
 {
   abort ();
 }
+
+#ifdef __FreeBSD__
+/* FreeBSD expects these to be functions */
+_Unwind_Ptr
+_Unwind_GetIP (struct _Unwind_Context *context)
+{
+  return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1;
+}
+
+_Unwind_Ptr
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
+{
+  *ip_before_insn = 0;
+  return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1;
+}
+#endif

Modified: projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.h
==============================================================================
--- projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.h	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcc/config/arm/unwind-arm.h	Sun Sep  1 13:33:05 2013	(r255121)
@@ -205,6 +205,13 @@ extern "C" {
 	_Unwind_Control_Block *, struct _Unwind_Context *, void *);
   _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *,
 					    _Unwind_Stop_Fn, void *);
+  /* @@@ Use unwind data to perform a stack backtrace.  The trace callback
+     is called for every stack frame in the call chain, but no cleanup
+     actions are performed.  */
+  typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (_Unwind_Context *, void *);
+  _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn,
+					void*);
+
   _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
   void _Unwind_Complete(_Unwind_Control_Block *ucbp);
   void _Unwind_DeleteException (_Unwind_Exception *);
@@ -246,12 +253,17 @@ extern "C" {
       return val;
     }
 
+#ifndef __FreeBSD__
   /* Return the address of the instruction, not the actual IP value.  */
 #define _Unwind_GetIP(context) \
   (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
 
 #define _Unwind_GetIPInfo(context, ip_before_insn) \
   (*ip_before_insn = 0, _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
+#else
+  _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
+  _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
+#endif
 
   static inline void
   _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)

Modified: projects/random_number_generator/contrib/gcc/doc/extend.texi
==============================================================================
--- projects/random_number_generator/contrib/gcc/doc/extend.texi	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcc/doc/extend.texi	Sun Sep  1 13:33:05 2013	(r255121)
@@ -81,6 +81,7 @@ extensions, accepted by GCC in C89 mode 
 * Pragmas::             Pragmas accepted by GCC.
 * Unnamed Fields::      Unnamed struct/union fields within structs/unions.
 * Thread-Local::        Per-thread variables.
+* Binary constants::    Binary constants using the @samp{0b} prefix.
 @end menu
 
 @node Statement Exprs
@@ -10424,6 +10425,28 @@ Non-@code{static} members shall not be @
 @end quotation
 @end itemize
 
+@node Binary constants
+@section Binary constants using the @samp{0b} prefix
+@cindex Binary constants using the @samp{0b} prefix
+
+Integer constants can be written as binary constants, consisting of a
+sequence of @samp{0} and @samp{1} digits, prefixed by @samp{0b} or
+@samp{0B}.  This is particularly useful in environments that operate a
+lot on the bit-level (like microcontrollers).
+
+The following statements are identical:
+
+@smallexample
+i =       42;
+i =     0x2a;
+i =      052;
+i = 0b101010;
+@end smallexample
+
+The type of these constants follows the same rules as for octal or
+hexadecimal integer constants, so suffixes like @samp{L} or @samp{UL}
+can be applied.
+
 @node C++ Extensions
 @chapter Extensions to the C++ Language
 @cindex extensions, C++ language

Modified: projects/random_number_generator/contrib/gcclibs/libcpp/expr.c
==============================================================================
--- projects/random_number_generator/contrib/gcclibs/libcpp/expr.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcclibs/libcpp/expr.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -188,6 +188,11 @@ cpp_classify_number (cpp_reader *pfile, 
 	  radix = 16;
 	  str++;
 	}
+      else if ((*str == 'b' || *str == 'B') && (str[1] == '0' || str[1] == '1'))
+	{
+	  radix = 2;
+	  str++;
+	}
     }
 
   /* Now scan for a well-formed integer or float.  */
@@ -226,10 +231,22 @@ cpp_classify_number (cpp_reader *pfile, 
     radix = 10;
 
   if (max_digit >= radix)
-    SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
+    {
+      if (radix == 2)
+	SYNTAX_ERROR2 ("invalid digit \"%c\" in binary constant", '0' + max_digit);
+      else
+	SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
+    }
 
   if (float_flag != NOT_FLOAT)
     {
+      if (radix == 2)
+	{
+	  cpp_error (pfile, CPP_DL_ERROR,
+		     "invalid prefix \"0b\" for floating constant");
+	  return CPP_N_INVALID;
+	}
+
       if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99))
 	cpp_error (pfile, CPP_DL_PEDWARN,
 		   "use of C99 hexadecimal floating constant");
@@ -321,11 +338,16 @@ cpp_classify_number (cpp_reader *pfile, 
   if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
     cpp_error (pfile, CPP_DL_PEDWARN,
 	       "imaginary constants are a GCC extension");
+  if (radix == 2 && CPP_PEDANTIC (pfile))
+    cpp_error (pfile, CPP_DL_PEDWARN,
+	       "binary constants are a GCC extension");
 
   if (radix == 10)
     result |= CPP_N_DECIMAL;
   else if (radix == 16)
     result |= CPP_N_HEX;
+  else if (radix == 2)
+    result |= CPP_N_BINARY;
   else
     result |= CPP_N_OCTAL;
 
@@ -376,6 +398,11 @@ cpp_interpret_integer (cpp_reader *pfile
 	  base = 16;
 	  p += 2;
 	}
+      else if ((type & CPP_N_RADIX) == CPP_N_BINARY)
+	{
+	  base = 2;
+	  p += 2;
+	}
 
       /* We can add a digit to numbers strictly less than this without
 	 needing the precision and slowness of double integers.  */
@@ -431,12 +458,25 @@ static cpp_num
 append_digit (cpp_num num, int digit, int base, size_t precision)
 {
   cpp_num result;
-  unsigned int shift = 3 + (base == 16);
+  unsigned int shift;
   bool overflow;
   cpp_num_part add_high, add_low;
 
-  /* Multiply by 8 or 16.  Catching this overflow here means we don't
+  /* Multiply by 2, 8 or 16.  Catching this overflow here means we don't
      need to worry about add_high overflowing.  */
+  switch (base)
+    {
+    case 2:
+      shift = 1;
+      break;
+
+    case 16:
+      shift = 4;
+      break;
+
+    default:
+      shift = 3;
+    }
   overflow = !!(num.high >> (PART_PRECISION - shift));
   result.high = num.high << shift;
   result.low = num.low << shift;

Modified: projects/random_number_generator/contrib/gcclibs/libcpp/include/cpplib.h
==============================================================================
--- projects/random_number_generator/contrib/gcclibs/libcpp/include/cpplib.h	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/contrib/gcclibs/libcpp/include/cpplib.h	Sun Sep  1 13:33:05 2013	(r255121)
@@ -745,6 +745,7 @@ struct cpp_num
 #define CPP_N_DECIMAL	0x0100
 #define CPP_N_HEX	0x0200
 #define CPP_N_OCTAL	0x0400
+#define CPP_N_BINARY	0x0800
 
 #define CPP_N_UNSIGNED	0x1000	/* Properties.  */
 #define CPP_N_IMAGINARY	0x2000

Modified: projects/random_number_generator/lib/libc/gen/errlst.c
==============================================================================
--- projects/random_number_generator/lib/libc/gen/errlst.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/lib/libc/gen/errlst.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -34,6 +34,7 @@ static char sccsid[] = "@(#)errlst.c	8.2
 __FBSDID("$FreeBSD$");
 
 #include <stdio.h>
+#include "errlst.h"
 
 const char *const sys_errlist[] = {
 	"No error: 0",				/*  0 - ENOERROR */
@@ -156,3 +157,8 @@ const char *const sys_errlist[] = {
 	"Previous owner died",			/* 96 - EOWNERDEAD */
 };
 const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);
+
+#ifdef PIC
+__strong_reference(sys_errlist, __hidden_sys_errlist);
+__strong_reference(sys_nerr, __hidden_sys_nerr);
+#endif

Copied: projects/random_number_generator/lib/libc/include/errlst.h (from r255120, head/lib/libc/include/errlst.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/random_number_generator/lib/libc/include/errlst.h	Sun Sep  1 13:33:05 2013	(r255121, copy of r255120, head/lib/libc/include/errlst.h)
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2013 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __ERRLST_H__
+#define __ERRLST_H__
+
+#include <sys/cdefs.h>
+
+#ifdef PIC
+/* If the main executable imports these, do not use its copy from libc.so. */
+extern const char *const __hidden_sys_errlist[] __hidden;
+extern const int __hidden_sys_nerr __hidden;
+#else
+#define __hidden_sys_errlist sys_errlist
+#define __hidden_sys_nerr sys_nerr
+#endif
+
+#endif /* __ERRLST_H__ */

Modified: projects/random_number_generator/lib/libc/stdio/xprintf_errno.c
==============================================================================
--- projects/random_number_generator/lib/libc/stdio/xprintf_errno.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/lib/libc/stdio/xprintf_errno.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -34,6 +34,7 @@
 #include <vis.h>
 #include <assert.h>
 #include <sys/time.h>
+#include "errlst.h"
 #include "printf.h"
 
 int
@@ -54,7 +55,7 @@ __printf_render_errno(struct __printf_io
 
 	ret = 0;
 	error = *((const int *)arg[0]);
-	if (error >= 0 && error < sys_nerr) {
+	if (error >= 0 && error < __hidden_sys_nerr) {
 		p = strerror(error);
 		return (__printf_out(io, pi, p, strlen(p)));
 	}

Modified: projects/random_number_generator/lib/libc/string/strerror.c
==============================================================================
--- projects/random_number_generator/lib/libc/string/strerror.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/lib/libc/string/strerror.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <stdio.h>
 
+#include "errlst.h"
+
 #define	UPREFIX		"Unknown error"
 
 /*
@@ -87,7 +89,7 @@ strerror_r(int errnum, char *strerrbuf, 
 	catd = catopen("libc", NL_CAT_LOCALE);
 #endif
 
-	if (errnum < 0 || errnum >= sys_nerr) {
+	if (errnum < 0 || errnum >= __hidden_sys_nerr) {
 		errstr(errnum,
 #if defined(NLS)
 			catgets(catd, 1, 0xffff, UPREFIX),
@@ -99,9 +101,9 @@ strerror_r(int errnum, char *strerrbuf, 
 	} else {
 		if (strlcpy(strerrbuf,
 #if defined(NLS)
-			catgets(catd, 1, errnum, sys_errlist[errnum]),
+			catgets(catd, 1, errnum, __hidden_sys_errlist[errnum]),
 #else
-			sys_errlist[errnum],
+			__hidden_sys_errlist[errnum],
 #endif
 			buflen) >= buflen)
 		retval = ERANGE;

Modified: projects/random_number_generator/lib/libelf/libelf_data.c
==============================================================================
--- projects/random_number_generator/lib/libelf/libelf_data.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/lib/libelf/libelf_data.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -84,13 +84,21 @@ _libelf_xlate_shtype(uint32_t sht)
 	case SHT_SUNW_dof:
 		return (ELF_T_BYTE);
 #endif
+	case SHT_ARM_PREEMPTMAP:
+		/* FALLTHROUGH */
+	case SHT_ARM_ATTRIBUTES:
+		/* FALLTHROUGH */
+	case SHT_ARM_DEBUGOVERLAY:
+		/* FALLTHROUGH */
+	case SHT_ARM_OVERLAYSECTION:
+		/* FALLTHROUGH */
 	case SHT_MIPS_DWARF:
 		/* FALLTHROUGH */
 	case SHT_MIPS_REGINFO:
 		/* FALLTHROUGH */
 	case SHT_MIPS_OPTIONS:
 		/* FALLTHROUGH */
-	case SHT_AMD64_UNWIND:	/* == SHT_IA_64_UNWIND */
+	case SHT_AMD64_UNWIND:	/* == SHT_IA_64_UNWIND == SHT_ARM_EXIDX */
 		return (ELF_T_BYTE);
 	default:
 		return (-1);

Modified: projects/random_number_generator/share/examples/scsi_target/scsi_target.c
==============================================================================
--- projects/random_number_generator/share/examples/scsi_target/scsi_target.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/share/examples/scsi_target/scsi_target.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -365,7 +365,7 @@ init_ccbs()
 	for (i = 0; i < MAX_INITIATORS; i++) {
 		struct ccb_accept_tio *atio;
 		struct atio_descr *a_descr;
-		struct ccb_immed_notify *inot;
+		struct ccb_immediate_notify *inot;
 
 		atio = (struct ccb_accept_tio *)malloc(sizeof(*atio));
 		if (atio == NULL) {
@@ -382,7 +382,7 @@ init_ccbs()
 		atio->ccb_h.targ_descr = a_descr;
 		send_ccb((union ccb *)atio, /*priority*/1);
 
-		inot = (struct ccb_immed_notify *)malloc(sizeof(*inot));
+		inot = (struct ccb_immediate_notify *)malloc(sizeof(*inot));
 		if (inot == NULL) {
 			warn("malloc INOT");
 			return (-1);
@@ -593,7 +593,7 @@ handle_read()
 			oo += run_queue(c_descr->atio);
 			break;
 		}
-		case XPT_IMMED_NOTIFY:
+		case XPT_IMMEDIATE_NOTIFY:
 			/* INOTs are handled with priority */
 			TAILQ_INSERT_HEAD(&work_queue, &ccb->ccb_h,
 					  periph_links.tqe);
@@ -903,7 +903,7 @@ free_ccb(union ccb *ccb)
 	case XPT_ACCEPT_TARGET_IO:
 		free(ccb->ccb_h.targ_descr);
 		/* FALLTHROUGH */
-	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	default:
 		free(ccb);
 		break;

Modified: projects/random_number_generator/share/man/man4/vtnet.4
==============================================================================
--- projects/random_number_generator/share/man/man4/vtnet.4	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/share/man/man4/vtnet.4	Sun Sep  1 13:33:05 2013	(r255121)
@@ -69,14 +69,30 @@ prompt before booting the kernel or stor
 .Xr loader.conf 5 .
 .Bl -tag -width "xxxxxx"
 .It Va hw.vtnet.csum_disable
+.It Va hw.vtnet. Ns Ar X Ns Va .csum_disable
 This tunable disables receive and send checksum offload.
 The default value is 0.
 .It Va hw.vtnet.tso_disable
+.It Va hw.vtnet. Ns Ar X Ns Va .tso_disable
 This tunable disables TSO.
 The default value is 0.
 .It Va hw.vtnet.lro_disable
+.It Va hw.vtnet. Ns Ar X Ns Va .lro_disable
 This tunable disables LRO.
 The default value is 0.
+.It Va hw.vtnet.mq_disable
+.It Va hw.vtnet. Ns Ar X Ns Va .mq_disable
+This tunable disables multiqueue.
+The default value is 0.
+.It Va hw.vtnet.mq_max_pairs
+.It Va hw.vtnet. Ns Ar X Ns Va .mq_max_pairs
+This tunable sets the maximum number of transmit and receive queue pairs.
+Multiple queues are only supported when the Multiqueue feature is negotiated.
+This driver supports a maximum of 8 queue pairs.
+The number of queue pairs used is the lesser of the maximum supported by the
+driver and the hypervisor, the number of CPUs present in the guest, and this
+tunable if not zero.
+The default value is 0.
 .El
 .Sh SEE ALSO
 .Xr arp 4 ,

Modified: projects/random_number_generator/sys/amd64/amd64/apic_vector.S
==============================================================================
--- projects/random_number_generator/sys/amd64/amd64/apic_vector.S	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/amd64/amd64/apic_vector.S	Sun Sep  1 13:33:05 2013	(r255121)
@@ -160,11 +160,11 @@ IDTVEC(xen_intr_upcall)
 
 	SUPERALIGN_TEXT
 global_invltlb:
-	movl	%cr4,%eax
-	andl	$~0x80,%eax
-	movl	%eax,%cr4
-	orl	$0x80,%eax
-	movl	%eax,%cr4
+	movq	%cr4,%rax
+	andq	$~0x80,%rax	/* PGE */
+	movq	%rax,%cr4
+	orq	$0x80,%rax
+	movq	%rax,%cr4
 invltlb_ret_clear_pm_save:
 	movq	smp_tlb_pmap,%rdx
 	testq	%rdx,%rdx

Modified: projects/random_number_generator/sys/amd64/amd64/pmap.c
==============================================================================
--- projects/random_number_generator/sys/amd64/amd64/pmap.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/amd64/amd64/pmap.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -762,7 +762,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 	/* Initialize the PAT MSR. */
 	pmap_init_pat();
 
-#ifdef SMP
 	/* Initialize TLB Context Id. */
 	TUNABLE_INT_FETCH("vm.pmap.pcid_enabled", &pmap_pcid_enabled);
 	if ((cpu_feature2 & CPUID2_PCID) != 0 && pmap_pcid_enabled) {
@@ -773,8 +772,10 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 		invpcid_works = (cpu_stdext_feature & CPUID_STDEXT_INVPCID)
 		    != 0;
 		kernel_pmap->pm_pcid = 0;
-	} else
+#ifndef SMP
+		pmap_pcid_enabled = 0;
 #endif
+	} else
 		pmap_pcid_enabled = 0;
 }
 

Modified: projects/random_number_generator/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- projects/random_number_generator/sys/cam/ctl/scsi_ctl.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cam/ctl/scsi_ctl.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -961,23 +961,23 @@ ctlfestart(struct cam_periph *periph, un
 
 		/*
 		 * Valid combinations:
-		 *  - CAM_SEND_STATUS, SCATTER_VALID = 0, dxfer_len = 0,
+		 *  - CAM_SEND_STATUS, CAM_DATA_SG = 0, dxfer_len = 0,
 		 *    sglist_cnt = 0
-		 *  - CAM_SEND_STATUS = 0, SCATTER_VALID = 0, dxfer_len != 0,
+		 *  - CAM_SEND_STATUS = 0, CAM_DATA_SG = 0, dxfer_len != 0,
 		 *    sglist_cnt = 0 
-		 *  - CAM_SEND_STATUS = 0, SCATTER_VALID, dxfer_len != 0,
+		 *  - CAM_SEND_STATUS = 0, CAM_DATA_SG, dxfer_len != 0,
 		 *    sglist_cnt != 0
 		 */
 #ifdef CTLFEDEBUG
 		if (((flags & CAM_SEND_STATUS)
-		  && (((flags & CAM_SCATTER_VALID) != 0)
+		  && (((flags & CAM_DATA_SG) != 0)
 		   || (dxfer_len != 0)
 		   || (csio->sglist_cnt != 0)))
 		 || (((flags & CAM_SEND_STATUS) == 0)
 		  && (dxfer_len == 0))
-		 || ((flags & CAM_SCATTER_VALID)
+		 || ((flags & CAM_DATA_SG)
 		  && (csio->sglist_cnt == 0))
-		 || (((flags & CAM_SCATTER_VALID) == 0)
+		 || (((flags & CAM_DATA_SG) == 0)
 		  && (csio->sglist_cnt != 0))) {
 			printf("%s: tag %04x cdb %02x flags %#x dxfer_len "
 			       "%d sg %u\n", __func__, atio->tag_id,

Modified: projects/random_number_generator/sys/cam/scsi/scsi_enc.c
==============================================================================
--- projects/random_number_generator/sys/cam/scsi/scsi_enc.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cam/scsi/scsi_enc.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include <cam/scsi/scsi_enc.h>
 #include <cam/scsi/scsi_enc_internal.h>
 
+#include <opt_ses.h>
+
 MALLOC_DEFINE(M_SCSIENC, "SCSI ENC", "SCSI ENC buffers");
 
 /* Enclosure type independent driver */
@@ -719,12 +721,12 @@ enc_type(struct ccb_getdev *cgd)
 		return (ENC_NONE);
 	}
 
-#ifdef	ENC_ENABLE_PASSTHROUGH
+#ifdef	SES_ENABLE_PASSTHROUGH
 	if ((iqd[6] & 0x40) && (iqd[2] & 0x7) >= 2) {
 		/*
 		 * PassThrough Device.
 		 */
-		return (ENC_ENC_PASSTHROUGH);
+		return (ENC_SES_PASSTHROUGH);
 	}
 #endif
 

Modified: projects/random_number_generator/sys/cam/scsi/scsi_targ_bh.c
==============================================================================
--- projects/random_number_generator/sys/cam/scsi/scsi_targ_bh.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cam/scsi/scsi_targ_bh.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -283,16 +283,13 @@ targbhenlun(struct cam_periph *periph)
 		xpt_setup_ccb(&atio->ccb_h, periph->path, CAM_PRIORITY_NORMAL);
 		atio->ccb_h.func_code = XPT_ACCEPT_TARGET_IO;
 		atio->ccb_h.cbfcnp = targbhdone;
-		xpt_action((union ccb *)atio);
-		status = atio->ccb_h.status;
-		if (status != CAM_REQ_INPROG) {
-			targbhfreedescr(atio->ccb_h.ccb_descr);
-			free(atio, M_SCSIBH);
-			break;
-		}
 		((struct targbh_cmd_desc*)atio->ccb_h.ccb_descr)->atio_link =
 		    softc->accept_tio_list;
 		softc->accept_tio_list = atio;
+		xpt_action((union ccb *)atio);
+		status = atio->ccb_h.status;
+		if (status != CAM_REQ_INPROG)
+			break;
 	}
 
 	if (i == 0) {
@@ -308,10 +305,10 @@ targbhenlun(struct cam_periph *periph)
 	 * so the SIM can tell us of asynchronous target mode events.
 	 */
 	for (i = 0; i < MAX_ACCEPT; i++) {
-		struct ccb_immed_notify *inot;
+		struct ccb_immediate_notify *inot;
 
-		inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_SCSIBH,
-						        M_NOWAIT);
+		inot = (struct ccb_immediate_notify*)malloc(sizeof(*inot),
+			    M_SCSIBH, M_NOWAIT);
 
 		if (inot == NULL) {
 			status = CAM_RESRC_UNAVAIL;
@@ -319,16 +316,14 @@ targbhenlun(struct cam_periph *periph)
 		}
 
 		xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-		inot->ccb_h.func_code = XPT_IMMED_NOTIFY;
+		inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
 		inot->ccb_h.cbfcnp = targbhdone;
+		SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h,
+				  periph_links.sle);
 		xpt_action((union ccb *)inot);
 		status = inot->ccb_h.status;
-		if (status != CAM_REQ_INPROG) {
-			free(inot, M_SCSIBH);
+		if (status != CAM_REQ_INPROG)
 			break;
-		}
-		SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h,
-				  periph_links.sle);
 	}
 
 	if (i == 0) {
@@ -413,7 +408,9 @@ targbhctor(struct cam_periph *periph, vo
 	periph->softc = softc;
 	softc->init_level++;
 
-	return (targbhenlun(periph));
+	if (targbhenlun(periph) != CAM_REQ_CMP)
+		cam_periph_invalidate(periph);
+	return (CAM_REQ_CMP);
 }
 
 static void
@@ -715,7 +712,7 @@ targbhdone(struct cam_periph *periph, un
 		}
 		break;
 	}
-	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	{
 		int frozen;
 

Modified: projects/random_number_generator/sys/cam/scsi/scsi_target.c
==============================================================================
--- projects/random_number_generator/sys/cam/scsi/scsi_target.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cam/scsi/scsi_target.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -551,6 +551,7 @@ targwrite(struct cdev *dev, struct uio *
 		switch (func_code) {
 		case XPT_ACCEPT_TARGET_IO:
 		case XPT_IMMED_NOTIFY:
+		case XPT_IMMEDIATE_NOTIFY:
 			cam_periph_lock(softc->periph);
 			ccb = targgetccb(softc, func_code, priority);
 			descr = (struct targ_cmd_descr *)ccb->ccb_h.targ_descr;
@@ -781,6 +782,7 @@ targdone(struct cam_periph *periph, unio
 	switch (done_ccb->ccb_h.func_code) {
 	/* All FC_*_QUEUED CCBs go back to userland */
 	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	case XPT_ACCEPT_TARGET_IO:
 	case XPT_CONT_TARGET_IO:
 		TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h,
@@ -961,6 +963,7 @@ targfreeccb(struct targ_softc *softc, un
 	switch (ccb->ccb_h.func_code) {
 	case XPT_ACCEPT_TARGET_IO:
 	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 		CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb));
 		free(ccb, M_TARG);
 		break;
@@ -1131,6 +1134,9 @@ targccblen(xpt_opcode func_code)
 	case XPT_IMMED_NOTIFY:
 		len = sizeof(struct ccb_immed_notify);
 		break;
+	case XPT_IMMEDIATE_NOTIFY:
+		len = sizeof(struct ccb_immediate_notify);
+		break;
 	case XPT_REL_SIMQ:
 		len = sizeof(struct ccb_relsim);
 		break;

Modified: projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
==============================================================================
--- projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -349,50 +349,84 @@ zero:
 uint64_t
 dtrace_getarg(int arg, int aframes)
 {
-	return (0);
-}
-
-#ifdef notyet
-{
-	int depth = 0;
-	register_t sp;
-	vm_offset_t callpc;
-	pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller;
-
-	if (intrpc != 0)
-		pcstack[depth++] = (pc_t) intrpc;
-
-	aframes++;
-
-	sp = dtrace_getfp();
-
-	while (depth < pcstack_limit) {
-		if (!INKERNEL((long) frame))
-			break;
-
-		callpc = *(void **)(sp + RETURN_OFFSET);
-
-		if (!INKERNEL(callpc))
-			break;
+	uintptr_t val;
+	uintptr_t *fp = (uintptr_t *)dtrace_getfp();
+	uintptr_t *stack;
+	int i;
+
+	/*
+	 * A total of 8 arguments are passed via registers; any argument with
+	 * index of 7 or lower is therefore in a register.
+	 */
+	int inreg = 7;
+
+	for (i = 1; i <= aframes; i++) {
+		fp = (uintptr_t *)*fp;
+
+		/*
+		 * On ppc32 AIM, and booke, trapexit() is the immediately following
+		 * label.  On ppc64 AIM trapexit() follows a nop.
+		 */
+		if (((long)(fp[1]) == (long)trapexit) ||
+				(((long)(fp[1]) + 4 == (long)trapexit))) {
+			/*
+			 * In the case of powerpc, we will use the pointer to the regs
+			 * structure that was pushed when we took the trap.  To get this
+			 * structure, we must increment beyond the frame structure.  If the
+			 * argument that we're seeking is passed on the stack, we'll pull
+			 * the true stack pointer out of the saved registers and decrement
+			 * our argument by the number of arguments passed in registers; if
+			 * the argument we're seeking is passed in regsiters, we can just
+			 * load it directly.
+			 */
+#ifdef __powerpc64__
+			struct reg *rp = (struct reg *)((uintptr_t)fp[0] + 48);
+#else
+			struct reg *rp = (struct reg *)((uintptr_t)fp[0] + 8);
+#endif
 
-		if (aframes > 0) {
-			aframes--;
-			if ((aframes == 0) && (caller != 0)) {
-				pcstack[depth++] = caller;
+			if (arg <= inreg) {
+				stack = &rp->fixreg[3];
+			} else {
+				stack = (uintptr_t *)(rp->fixreg[1]);
+				arg -= inreg;
 			}
-		}
-		else {
-			pcstack[depth++] = callpc;
+			goto load;
 		}
 
-		sp = *(void **)sp;
 	}
 
-	for (; depth < pcstack_limit; depth++) {
-		pcstack[depth] = 0;
+	/*
+	 * We know that we did not come through a trap to get into
+	 * dtrace_probe() -- the provider simply called dtrace_probe()
+	 * directly.  As this is the case, we need to shift the argument
+	 * that we're looking for:  the probe ID is the first argument to
+	 * dtrace_probe(), so the argument n will actually be found where
+	 * one would expect to find argument (n + 1).
+	 */
+	arg++;
+
+	if (arg <= inreg) {
+		/*
+		 * This shouldn't happen.  If the argument is passed in a
+		 * register then it should have been, well, passed in a
+		 * register...
+		 */
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
 	}
+
+	arg -= (inreg + 1);
+	stack = fp + 2;
+
+load:
+	DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+	val = stack[arg];
+	DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+	return (val);
+	return (0);
 }
-#endif
 
 int
 dtrace_getstackdepth(int aframes)

Modified: projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c
==============================================================================
--- projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c	Sun Sep  1 13:01:59 2013	(r255120)
+++ projects/random_number_generator/sys/cddl/dev/dtrace/powerpc/dtrace_subr.c	Sun Sep  1 13:33:05 2013	(r255121)
@@ -51,6 +51,8 @@ extern int		dtrace_in_probe;
 extern dtrace_id_t	dtrace_probeid_error;
 extern int (*dtrace_invop_jump_addr)(struct trapframe *);
 
+extern void dtrace_getnanotime(struct timespec *tsp);
+
 int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t);
 void dtrace_invop_init(void);
 void dtrace_invop_uninit(void);
@@ -63,13 +65,13 @@ typedef struct dtrace_invop_hdlr {
 dtrace_invop_hdlr_t *dtrace_invop_hdlr;
 
 int
-dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax)
+dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t arg0)
 {
 	dtrace_invop_hdlr_t *hdlr;
 	int rval;
 
 	for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next)
-		if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0)
+		if ((rval = hdlr->dtih_func(addr, stack, arg0)) != 0)
 			return (rval);
 
 	return (0);
@@ -134,7 +136,7 @@ dtrace_xcall(processorid_t cpu, dtrace_x
 		CPU_SETOF(cpu, &cpus);
 
 	smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func,
-	    smp_no_rendevous_barrier, arg);
+			smp_no_rendevous_barrier, arg);
 }
 
 static void
@@ -145,9 +147,82 @@ dtrace_sync_func(void)
 void
 dtrace_sync(void)
 {
-        dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL);
+	dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL);
+}
+
+static int64_t	tgt_cpu_tsc;
+static int64_t	hst_cpu_tsc;
+static int64_t	timebase_skew[MAXCPU];
+static uint64_t	nsec_scale;
+
+/* See below for the explanation of this macro. */
+/* This is taken from the amd64 dtrace_subr, to provide a synchronized timer
+ * between multiple processors in dtrace.  Since PowerPC Timebases can be much
+ * lower than x86, the scale shift is 26 instead of 28, allowing for a 15.63MHz
+ * timebase.
+ */
+#define SCALE_SHIFT	26
+
+static void
+dtrace_gethrtime_init_cpu(void *arg)
+{
+	uintptr_t cpu = (uintptr_t) arg;
+
+	if (cpu == curcpu)
+		tgt_cpu_tsc = mftb();
+	else
+		hst_cpu_tsc = mftb();
+}
+
+static void
+dtrace_gethrtime_init(void *arg)
+{
+	struct pcpu *pc;
+	uint64_t tb_f;
+	cpuset_t map;
+	int i;
+
+	tb_f = cpu_tickrate();
+
+	/*
+	 * The following line checks that nsec_scale calculated below
+	 * doesn't overflow 32-bit unsigned integer, so that it can multiply
+	 * another 32-bit integer without overflowing 64-bit.
+	 * Thus minimum supported Timebase frequency is 15.63MHz.
+	 */
+	KASSERT(tb_f > (NANOSEC >> (32 - SCALE_SHIFT)), ("Timebase frequency is too low"));
+
+	/*
+	 * We scale up NANOSEC/tb_f ratio to preserve as much precision
+	 * as possible.
+	 * 2^26 factor was chosen quite arbitrarily from practical
+	 * considerations:
+	 * - it supports TSC frequencies as low as 15.63MHz (see above);
+	 */
+	nsec_scale = ((uint64_t)NANOSEC << SCALE_SHIFT) / tb_f;
+
+	/* The current CPU is the reference one. */
+	sched_pin();
+	timebase_skew[curcpu] = 0;
+	CPU_FOREACH(i) {
+		if (i == curcpu)
+			continue;
+
+		pc = pcpu_find(i);
+		CPU_SETOF(PCPU_GET(cpuid), &map);
+		CPU_SET(pc->pc_cpuid, &map);
+
+		smp_rendezvous_cpus(map, NULL,
+				dtrace_gethrtime_init_cpu,
+				smp_no_rendevous_barrier, (void *)(uintptr_t) i);
+
+		timebase_skew[i] = tgt_cpu_tsc - hst_cpu_tsc;
+	}
+	sched_unpin();
 }
 
+SYSINIT(dtrace_gethrtime_init, SI_SUB_SMP, SI_ORDER_ANY, dtrace_gethrtime_init, NULL);
+
 /*
  * DTrace needs a high resolution time function which can
  * be called from a probe context and guaranteed not to have
@@ -158,12 +233,21 @@ dtrace_sync(void)
 uint64_t
 dtrace_gethrtime()
 {
-	struct      timespec curtime;
-
-	nanouptime(&curtime);
-
-	return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);
+	uint64_t timebase;
+	uint32_t lo;
+	uint32_t hi;
 
+	/*
+	 * We split timebase value into lower and higher 32-bit halves and separately
+	 * scale them with nsec_scale, then we scale them down by 2^28
+	 * (see nsec_scale calculations) taking into account 32-bit shift of
+	 * the higher half and finally add.
+	 */
+	timebase = mftb() - timebase_skew[curcpu];
+	lo = timebase;
+	hi = timebase >> 32;
+	return (((lo * nsec_scale) >> SCALE_SHIFT) +
+		((hi * nsec_scale) << (32 - SCALE_SHIFT)));
 }
 
 uint64_t
@@ -171,12 +255,12 @@ dtrace_gethrestime(void)
 {
 	struct      timespec curtime;
 
-	getnanotime(&curtime);
+	dtrace_getnanotime(&curtime);
 
 	return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);
 }
 
-/* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */
+/* Function to handle DTrace traps during probes. See powerpc/powerpc/trap.c */
 int
 dtrace_trap(struct trapframe *frame, u_int type)
 {
@@ -196,34 +280,34 @@ dtrace_trap(struct trapframe *frame, u_i

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309011333.r81DX5tt019618>