ia64/xen-unstable

changeset 12977:749c399d73df

[POWERPC] Merge with xen-unstable.hg.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Tue Dec 12 09:58:42 2006 -0600 (2006-12-12)
parents a510c94ceaa3 37141c3a3d39
children 6a8b56ccdb09
files .hgignore patches/linux-2.6.16.32/blktap-aio-16_03_06.patch patches/linux-2.6.16.32/device_bind.patch patches/linux-2.6.16.32/fix-hz-suspend.patch patches/linux-2.6.16.32/fix-ide-cd-pio-mode.patch patches/linux-2.6.16.32/i386-mach-io-check-nmi.patch patches/linux-2.6.16.32/ipv6-no-autoconf.patch patches/linux-2.6.16.32/kasprintf.patch patches/linux-2.6.16.32/net-csum.patch patches/linux-2.6.16.32/net-gso-0-base.patch patches/linux-2.6.16.32/net-gso-1-check-dodgy.patch patches/linux-2.6.16.32/net-gso-2-checksum-fix.patch patches/linux-2.6.16.32/net-gso-3-fix-errorcheck.patch patches/linux-2.6.16.32/net-gso-4-kill-warnon.patch patches/linux-2.6.16.32/net-gso-5-rcv-mss.patch patches/linux-2.6.16.32/pci-mmconfig-fix-from-2.6.17.patch patches/linux-2.6.16.32/pmd-shared.patch patches/linux-2.6.16.32/rcu_needs_cpu.patch patches/linux-2.6.16.32/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch patches/linux-2.6.16.32/series patches/linux-2.6.16.32/smp-alts.patch patches/linux-2.6.16.32/tpm_plugin_2.6.17.patch patches/linux-2.6.16.32/vsnprintf.patch patches/linux-2.6.16.32/x86-elfnote-as-preprocessor-macro.patch patches/linux-2.6.16.32/x86-increase-interrupt-vector-range.patch patches/linux-2.6.16.32/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch patches/linux-2.6.16.32/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch patches/linux-2.6.16.32/xen-hotplug.patch patches/linux-2.6.16.32/xenoprof-generic.patch tools/firmware/hvmloader/acpi_ssdt_tpm.asl tools/firmware/hvmloader/acpi_ssdt_tpm.h tools/firmware/hvmloader/acpi_utils.c tools/firmware/hvmloader/acpi_utils.h tools/libxc/xenctrl.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py xen/arch/powerpc/Makefile xen/arch/x86/hvm/vmx/io.c xen/common/Makefile xen/include/asm-ia64/linux/asm-generic/pgtable-nopud.h xen/include/asm-powerpc/config.h
line diff
     1.1 --- a/.hgignore	Tue Dec 12 09:56:06 2006 -0600
     1.2 +++ b/.hgignore	Tue Dec 12 09:58:42 2006 -0600
     1.3 @@ -158,6 +158,8 @@
     1.4  ^tools/xcutils/xc_restore$
     1.5  ^tools/xcutils/xc_save$
     1.6  ^tools/xcutils/readnotes$
     1.7 +^tools/xenfb/sdlfb$
     1.8 +^tools/xenfb/vncfb$
     1.9  ^tools/xenmon/xentrace_setmask$
    1.10  ^tools/xenmon/xenbaked$
    1.11  ^tools/xenstat/xentop/xentop$
     2.1 --- a/Config.mk	Tue Dec 12 09:56:06 2006 -0600
     2.2 +++ b/Config.mk	Tue Dec 12 09:58:42 2006 -0600
     2.3 @@ -69,7 +69,8 @@ ACM_DEFAULT_SECURITY_POLICY ?= ACM_NULL_
     2.4  
     2.5  # Optional components
     2.6  XENSTAT_XENTOP ?= y
     2.7 -
     2.8  VTPM_TOOLS ?= n
     2.9 +LIBXENAPI_BINDINGS ?= n
    2.10 +XENFB_TOOLS ?= n
    2.11  
    2.12  -include $(XEN_ROOT)/.config
     3.1 --- a/buildconfigs/linux-defconfig_xen0_x86_32	Tue Dec 12 09:56:06 2006 -0600
     3.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_32	Tue Dec 12 09:58:42 2006 -0600
     3.3 @@ -179,6 +179,7 @@ CONFIG_HZ_100=y
     3.4  # CONFIG_HZ_250 is not set
     3.5  # CONFIG_HZ_1000 is not set
     3.6  CONFIG_HZ=100
     3.7 +CONFIG_KEXEC=y
     3.8  # CONFIG_CRASH_DUMP is not set
     3.9  CONFIG_PHYSICAL_START=0x100000
    3.10  
     4.1 --- a/buildconfigs/linux-defconfig_xen0_x86_64	Tue Dec 12 09:56:06 2006 -0600
     4.2 +++ b/buildconfigs/linux-defconfig_xen0_x86_64	Tue Dec 12 09:58:42 2006 -0600
     4.3 @@ -126,6 +126,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
     4.4  # CONFIG_SPARSEMEM_STATIC is not set
     4.5  CONFIG_SPLIT_PTLOCK_CPUS=4096
     4.6  CONFIG_SWIOTLB=y
     4.7 +CONFIG_KEXEC=y
     4.8  # CONFIG_CRASH_DUMP is not set
     4.9  CONFIG_PHYSICAL_START=0x100000
    4.10  CONFIG_SECCOMP=y
     5.1 --- a/buildconfigs/linux-defconfig_xen_ia64	Tue Dec 12 09:56:06 2006 -0600
     5.2 +++ b/buildconfigs/linux-defconfig_xen_ia64	Tue Dec 12 09:58:42 2006 -0600
     5.3 @@ -1548,6 +1548,8 @@ CONFIG_XEN_PCIDEV_BACKEND_SLOT=y
     5.4  # CONFIG_XEN_TPMDEV_BACKEND is not set
     5.5  CONFIG_XEN_BLKDEV_FRONTEND=y
     5.6  CONFIG_XEN_NETDEV_FRONTEND=y
     5.7 +CONFIG_XEN_FRAMEBUFFER=y
     5.8 +CONFIG_XEN_KEYBOARD=y
     5.9  # CONFIG_XEN_SCRUB_PAGES is not set
    5.10  CONFIG_XEN_DISABLE_SERIAL=y
    5.11  CONFIG_XEN_SYSFS=y
     6.1 --- a/buildconfigs/linux-defconfig_xen_x86_32	Tue Dec 12 09:56:06 2006 -0600
     6.2 +++ b/buildconfigs/linux-defconfig_xen_x86_32	Tue Dec 12 09:58:42 2006 -0600
     6.3 @@ -184,6 +184,7 @@ CONFIG_MTRR=y
     6.4  CONFIG_REGPARM=y
     6.5  CONFIG_SECCOMP=y
     6.6  CONFIG_HZ_100=y
     6.7 +CONFIG_KEXEC=y
     6.8  # CONFIG_HZ_250 is not set
     6.9  # CONFIG_HZ_1000 is not set
    6.10  CONFIG_HZ=100
    6.11 @@ -2776,6 +2777,7 @@ CONFIG_NTFS_FS=m
    6.12  #
    6.13  CONFIG_PROC_FS=y
    6.14  CONFIG_PROC_KCORE=y
    6.15 +# CONFIG_PROC_VMCORE is not set
    6.16  CONFIG_SYSFS=y
    6.17  CONFIG_TMPFS=y
    6.18  # CONFIG_HUGETLB_PAGE is not set
    6.19 @@ -3032,6 +3034,8 @@ CONFIG_XEN_NETDEV_LOOPBACK=y
    6.20  # CONFIG_XEN_TPMDEV_BACKEND is not set
    6.21  CONFIG_XEN_BLKDEV_FRONTEND=y
    6.22  CONFIG_XEN_NETDEV_FRONTEND=y
    6.23 +CONFIG_XEN_FRAMEBUFFER=y
    6.24 +CONFIG_XEN_KEYBOARD=y
    6.25  CONFIG_XEN_SCRUB_PAGES=y
    6.26  CONFIG_XEN_DISABLE_SERIAL=y
    6.27  CONFIG_XEN_SYSFS=y
     7.1 --- a/buildconfigs/linux-defconfig_xen_x86_64	Tue Dec 12 09:56:06 2006 -0600
     7.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64	Tue Dec 12 09:58:42 2006 -0600
     7.3 @@ -139,6 +139,7 @@ CONFIG_SWIOTLB=y
     7.4  CONFIG_PHYSICAL_START=0x100000
     7.5  CONFIG_SECCOMP=y
     7.6  CONFIG_HZ_100=y
     7.7 +CONFIG_KEXEC=y
     7.8  # CONFIG_HZ_250 is not set
     7.9  # CONFIG_HZ_1000 is not set
    7.10  CONFIG_HZ=100
    7.11 @@ -2865,6 +2866,8 @@ CONFIG_XEN_TPMDEV_BACKEND=m
    7.12  # CONFIG_XEN_TPMDEV_CLOSE_IF_VTPM_FAILS is not set
    7.13  CONFIG_XEN_BLKDEV_FRONTEND=y
    7.14  CONFIG_XEN_NETDEV_FRONTEND=y
    7.15 +CONFIG_XEN_FRAMEBUFFER=y
    7.16 +CONFIG_XEN_KEYBOARD=y
    7.17  CONFIG_XEN_SCRUB_PAGES=y
    7.18  CONFIG_XEN_DISABLE_SERIAL=y
    7.19  CONFIG_XEN_SYSFS=y
     8.1 --- a/buildconfigs/mk.linux-2.6-xen	Tue Dec 12 09:56:06 2006 -0600
     8.2 +++ b/buildconfigs/mk.linux-2.6-xen	Tue Dec 12 09:58:42 2006 -0600
     8.3 @@ -1,5 +1,5 @@
     8.4  LINUX_SERIES = 2.6
     8.5 -LINUX_VER    = 2.6.16.32
     8.6 +LINUX_VER    = 2.6.16.33
     8.7  
     8.8  EXTRAVERSION ?= xen
     8.9  
     9.1 --- a/docs/src/user.tex	Tue Dec 12 09:56:06 2006 -0600
     9.2 +++ b/docs/src/user.tex	Tue Dec 12 09:58:42 2006 -0600
     9.3 @@ -3240,6 +3240,11 @@ editing \path{grub.conf}.
     9.4    enabled by the BIOS.
     9.5  \item [ apic=bigsmp,default,es7000,summit ] Specify NUMA platform.
     9.6    This can usually be probed automatically.
     9.7 +\item [ dma\_bits=xxx ] Specify width of DMA
     9.8 +  addresses in bits. Default is 30 bits (addresses up to 1GB are DMAable).
     9.9 +\item [ dma\_emergency\_pool=xxx ] Specify lower bound on size of DMA
    9.10 +  pool below which ordinary allocations will fail rather than fall
    9.11 +  back to allocating from the DMA pool.
    9.12  \end{description}
    9.13  
    9.14  In addition, the following options may be specified on the Xen command
    10.1 --- a/docs/xen-api/presentation.tex	Tue Dec 12 09:56:06 2006 -0600
    10.2 +++ b/docs/xen-api/presentation.tex	Tue Dec 12 09:58:42 2006 -0600
    10.3 @@ -131,9 +131,6 @@ of that class that has the specified {\t
    10.4  ``{\tt get\_by\_name\_label(name)}'' RPC that returns a set of objects of that
    10.5  class that have the specified {\tt label}.
    10.6  
    10.7 -\item Each class has a ``{\tt to\_XML()}'' RPC that serialises the
    10.8 -state of all fields as an XML string.
    10.9 -
   10.10  \item Each class has a ``{\tt destroy(Ref x)}'' RPC that explicitly deletes
   10.11  the persistent object specified by {\tt x} from the system.  This is a
   10.12  non-cascading delete -- if the object being removed is referenced by another
   10.13 @@ -144,6 +141,6 @@ object then the {\tt destroy} call will 
   10.14  \subsection{Additional RPCs}
   10.15  
   10.16  As well as the RPCs enumerated above, some classes have additional RPCs
   10.17 -associated with them. For example, the {\tt VM} class have RPCs for cloning,
   10.18 +associated with them. For example, the {\tt VM} class has RPCs for cloning,
   10.19  suspending, starting etc. Such additional RPCs are described explicitly
   10.20  in the API reference.
    11.1 --- a/docs/xen-api/todo.tex	Tue Dec 12 09:56:06 2006 -0600
    11.2 +++ b/docs/xen-api/todo.tex	Tue Dec 12 09:58:42 2006 -0600
    11.3 @@ -35,6 +35,8 @@ code, potential error description, but o
    11.4  \item Clarify behaviour of progress field on asyncrhonous request polling when
    11.5  that request fails.
    11.6  
    11.7 +\item Clarify which calls have asynchronous counterparts by marking them as such in the reference. (Individual getters and setters are too small and quick to justify having async versions)
    11.8 +
    11.9  \end{itemize}
   11.10  
   11.11  \subsection{Content}
    12.1 --- a/docs/xen-api/wire-protocol.tex	Tue Dec 12 09:56:06 2006 -0600
    12.2 +++ b/docs/xen-api/wire-protocol.tex	Tue Dec 12 09:58:42 2006 -0600
    12.3 @@ -21,9 +21,9 @@ primitive XML-RPC types.
    12.4  In our API Reference we specify the signatures of API functions in the following
    12.5  style:
    12.6  \begin{verbatim}
    12.7 -    (ref_vm Set)   Host.ListAllVMs()
    12.8 +    (ref_vm Set)   VM.get_all()
    12.9  \end{verbatim}
   12.10 -This specifies that the function with name {\tt Host.ListAllVMs} takes
   12.11 +This specifies that the function with name {\tt VM.get\_all} takes
   12.12  no parameters and returns a Set of {\tt ref\_vm}s.
   12.13  These types are mapped onto XML-RPC types in a straight-forward manner:
   12.14  \begin{itemize}
   12.15 @@ -105,8 +105,8 @@ In the case where {\tt Status} is set to
   12.16  the struct contains a second element named {\tt ErrorDescription}:
   12.17  \begin{itemize}
   12.18  \item The element of the struct named {\tt ErrorDescription} contains
   12.19 -an array of string values. The first element of the array represents an error code;
   12.20 -the remainder of the array represents error parameters relating to that code.
   12.21 +an array of string values. The first element of the array is an XML-RPC 32-bit {\tt i4} and represents an error code;
   12.22 +the remainder of the array are strings representing error parameters relating to that code.
   12.23  \end{itemize}
   12.24  
   12.25  For example, an XML-RPC return value from the {\tt Host.ListAllVMs} function above
   12.26 @@ -161,19 +161,19 @@ A session can be terminated with the {\t
   12.27  
   12.28  \subsection{Synchronous and Asynchronous invocation}
   12.29  
   12.30 -Each method call (apart from those on ``Session'' and ``Task'' objects)
   12.31 +Each method call (apart from methods on ``Session'' and ``Task'' objects 
   12.32 +and ``getters'' and ``setters'' derived from fields)
   12.33  can be made either synchronously or asynchronously.
   12.34  A synchronous RPC call blocks until the
   12.35  return value is received; the return value of a synchronous RPC call is
   12.36  exactly as specified in Section~\ref{synchronous-result}.
   12.37  
   12.38 -Each of the methods specified in the API Reference is synchronous.
   12.39 -However, although not listed explicitly in this document, each
   12.40 -method call has an asynchronous analogue in the {\tt Async}
   12.41 -namespace. For example, synchronous call {\tt VM.Install(...)}
   12.42 +Only synchronous API calls are listed explicitly in this document. 
   12.43 +All asynchronous versions are in the special {\tt Async} namespace.
   12.44 +For example, synchronous call {\tt VM.clone(...)}
   12.45  (described in Chapter~\ref{api-reference})
   12.46  has an asynchronous counterpart, {\tt
   12.47 -Async.VM.Install(...)}, that is non-blocking.
   12.48 +Async.VM.clone(...)}, that is non-blocking.
   12.49  
   12.50  Instead of returning its result directly, an asynchronous RPC call
   12.51  returns a {\tt task-id}; this identifier is subsequently used
   12.52 @@ -186,39 +186,14 @@ is wrapped in an XML-RPC struct with a {
   12.53  The {\tt task-id} is provided in the {\tt Value} field if {\tt Status} is set to
   12.54  {\tt Success}.
   12.55  
   12.56 -Two special RPC calls are provided to poll the status of
   12.57 -asynchronous calls:
   12.58 +The RPC call
   12.59  \begin{verbatim}
   12.60 -    Array<task_id>  Async.Task.GetAllTasks (session_id s)
   12.61 -    task_status     Async.Task.GetStatus   (session_id s, task_id t)
   12.62 -\end{verbatim}
   12.63 -
   12.64 -{\tt Async.Task.GetAllTasks} returns a set of the currently
   12.65 -executing asynchronous tasks belong to the current user\footnote{
   12.66 -%
   12.67 -The current user is determined by the username that was provided
   12.68 -to {\tt Session.Login}.
   12.69 -%
   12.70 -}.
   12.71 -
   12.72 -{\tt Async.Task.GetStatus} returns a {\tt task\_status} result.
   12.73 -This is an XML-RPC struct with three elements:
   12.74 -\begin{itemize}
   12.75 -  \item The first element is named {\tt Progress} and contains
   12.76 -an {\tt Integer} between 0 and 100 representing the estimated percentage of
   12.77 -the task currently completed.
   12.78 -  \item The second element is named {\tt ETA} and contains a {\tt DateTime} 
   12.79 -representing the estimated time the task will be complete.
   12.80 -  \item The third element is named {\tt Result}. If {\tt Progress}
   12.81 -is not 100 then {\tt Result} contains the empty string. If {\tt Progress}
   12.82 -{\em is\/} set to 100, then {\tt Result} contains the function's return
   12.83 -result (as specified in Section~\ref{synchronous-result})\footnote{
   12.84 -%
   12.85 -Recall that this itself is a struct potentially containing status, errorcode,
   12.86 -value fields etc.
   12.87 -%
   12.88 -}.
   12.89 -\end{itemize}
   12.90 +    (ref_task Set)   Task.get_all(session_id s)
   12.91 +\end{verbatim} 
   12.92 +returns a set of all task IDs known to the system. The status (including any
   12.93 +returned result and error codes) of these tasks
   12.94 +can then be queried by accessing the fields of the Task object in the usual way. 
   12.95 +Note that, in order to get a consistent snapshot of a task's state, it is advisable to call the ``get\_record'' function.
   12.96  
   12.97  \section{Example interactive session}
   12.98  
   12.99 @@ -267,7 +242,8 @@ Next, the user may acquire a list of all
  12.100  \begin{verbatim}
  12.101  >>> all_vms = xen.VM.do_list(session)['Value']
  12.102  >>> all_vms
  12.103 -['b7b92d9e-d442-4710-92a5-ab039fd7d89b', '23e1e837-abbf-4675-b077-d4007989b0cc', '2045dbc0-0734-4eea-9cb2-b8218c6b5bf2', '3202ae18-a046-4c32-9fda-e32e9631866e']
  12.104 +['b7b92d9e-d442-4710-92a5-ab039fd7d89b', '23e1e837-abbf-4675-b077-d4007989b0cc',
  12.105 +  '2045dbc0-0734-4eea-9cb2-b8218c6b5bf2', '3202ae18-a046-4c32-9fda-e32e9631866e']
  12.106  \end{verbatim}
  12.107  
  12.108  Note the VM references are internally UUIDs. Once a reference to a VM has been acquired a lifecycle operation may be invoked:
    13.1 --- a/docs/xen-api/xenapi-datamodel-graph.dot	Tue Dec 12 09:56:06 2006 -0600
    13.2 +++ b/docs/xen-api/xenapi-datamodel-graph.dot	Tue Dec 12 09:58:42 2006 -0600
    13.3 @@ -1,5 +1,5 @@
    13.4  digraph g{
    13.5 -node [ shape=box ]; session [ URL="session.html" ] task [ URL="task.html" ] VM [ URL="VM.html" ] host [ URL="host.html" ] host_cpu [ URL="host_cpu.html" ] network [ URL="network.html" ] VIF [ URL="VIF.html" ] PIF [ URL="PIF.html" ] SR [ URL="SR.html" ] VDI [ URL="VDI.html" ] VBD [ URL="VBD.html" ] VTPM [ URL="VTPM.html" ] user [ URL="user.html" ] debug [ URL="debug.html" ];
    13.6 +node [ shape=box ]; session [ URL="session.html" ] task [ URL="task.html" ] VM [ URL="VM.html" ] host [ URL="host.html" ] host_cpu [ URL="host_cpu.html" ] network [ URL="network.html" ] VIF [ URL="VIF.html" ] PIF [ URL="PIF.html" ] SR [ URL="SR.html" ] VDI [ URL="VDI.html" ] VBD [ URL="VBD.html" ] VTPM [ URL="VTPM.html" ] console [ URL="console.html" ] user [ URL="user.html" ] debug [ URL="debug.html" ];
    13.7  session -> host [ label="this_host(1)" ]
    13.8  session -> user [ label="this_user(1)" ]
    13.9  host -> VM [ color="blue", arrowhead="crow", arrowtail="none" ]
   13.10 @@ -14,4 +14,5 @@ VDI -> VDI [ color="blue", arrowhead="no
   13.11  VBD -> VM [ color="blue", arrowhead="none", arrowtail="crow" ]
   13.12  VTPM -> VM [ label="backend(1)" ]
   13.13  VTPM -> VM [ color="blue", arrowhead="none", arrowtail="crow" ]
   13.14 +console -> VM [ color="blue", arrowhead="none", arrowtail="crow" ]
   13.15  }
    14.1 --- a/docs/xen-api/xenapi-datamodel.tex	Tue Dec 12 09:56:06 2006 -0600
    14.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Tue Dec 12 09:58:42 2006 -0600
    14.3 @@ -23,7 +23,7 @@ The following classes are defined:
    14.4  Name & Description \\
    14.5  \hline
    14.6  {\tt session} & A session \\
    14.7 -{\tt task} & A longrunning asynchronous task \\
    14.8 +{\tt task} & A long-running asynchronous task \\
    14.9  {\tt VM} & A virtual machine (or 'guest') \\
   14.10  {\tt host} & A physical host \\
   14.11  {\tt host\_cpu} & A physical CPU \\
   14.12 @@ -34,6 +34,7 @@ Name & Description \\
   14.13  {\tt VDI} & A virtual disk image \\
   14.14  {\tt VBD} & A virtual block device \\
   14.15  {\tt VTPM} & A virtual TPM device \\
   14.16 +{\tt console} & A console \\
   14.17  {\tt user} & A user of the system \\
   14.18  {\tt debug} & A basic class for testing \\
   14.19  \hline
   14.20 @@ -54,6 +55,7 @@ PIF.host & host.PIFs & one-to-many\\
   14.21  PIF.network & network.PIFs & one-to-many\\
   14.22  SR.VDIs & VDI.SR & many-to-one\\
   14.23  VTPM.VM & VM.VTPMs & one-to-many\\
   14.24 +console.VM & VM.consoles & one-to-many\\
   14.25  host.resident\_VMs & VM.resident\_on & many-to-one\\
   14.26  host.host\_CPUs & host\_cpu.host & many-to-one\\
   14.27  \hline
   14.28 @@ -99,6 +101,17 @@ The following enumeration types are used
   14.29  
   14.30  \begin{longtable}{|ll|}
   14.31  \hline
   14.32 +{\tt enum console\_protocol} & \\
   14.33 +\hline
   14.34 +\hspace{0.5cm}{\tt vt100} & VT100 terminal \\
   14.35 +\hspace{0.5cm}{\tt rfb} & Remote FrameBuffer protocol (as used in VNC) \\
   14.36 +\hspace{0.5cm}{\tt rdp} & Remote Desktop Protocol \\
   14.37 +\hline
   14.38 +\end{longtable}
   14.39 +
   14.40 +\vspace{1cm}
   14.41 +\begin{longtable}{|ll|}
   14.42 +\hline
   14.43  {\tt enum vdi\_type} & \\
   14.44  \hline
   14.45  \hspace{0.5cm}{\tt system} & a disk that may be replaced on upgrade \\
   14.46 @@ -124,6 +137,17 @@ The following enumeration types are used
   14.47  \vspace{1cm}
   14.48  \begin{longtable}{|ll|}
   14.49  \hline
   14.50 +{\tt enum task\_status\_type} & \\
   14.51 +\hline
   14.52 +\hspace{0.5cm}{\tt pending} & task is in progress \\
   14.53 +\hspace{0.5cm}{\tt success} & task was completed successfully \\
   14.54 +\hspace{0.5cm}{\tt failure} & task has failed \\
   14.55 +\hline
   14.56 +\end{longtable}
   14.57 +
   14.58 +\vspace{1cm}
   14.59 +\begin{longtable}{|ll|}
   14.60 +\hline
   14.61  {\tt enum cpu\_feature} & \\
   14.62  \hline
   14.63  \hspace{0.5cm}{\tt FPU} &  Onboard FPU  \\
   14.64 @@ -242,6 +266,16 @@ The following enumeration types are used
   14.65  \vspace{1cm}
   14.66  \begin{longtable}{|ll|}
   14.67  \hline
   14.68 +{\tt enum vbd\_type} & \\
   14.69 +\hline
   14.70 +\hspace{0.5cm}{\tt CD} & VBD will appear to guest as CD \\
   14.71 +\hspace{0.5cm}{\tt Disk} & VBD will appear to guest as disk \\
   14.72 +\hline
   14.73 +\end{longtable}
   14.74 +
   14.75 +\vspace{1cm}
   14.76 +\begin{longtable}{|ll|}
   14.77 +\hline
   14.78  {\tt enum driver\_type} & \\
   14.79  \hline
   14.80  \hspace{0.5cm}{\tt ioemu} & use hardware emulation \\
   14.81 @@ -261,6 +295,7 @@ The following enumeration types are used
   14.82  \hline
   14.83  Quals & Field & Type & Description \\
   14.84  \hline
   14.85 +$\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object reference \\
   14.86  $\mathit{RO}_\mathit{ins}$ &  {\tt this\_host} & host ref & Currently connected host \\
   14.87  $\mathit{RO}_\mathit{ins}$ &  {\tt this\_user} & user ref & Currently connected user \\
   14.88  \hline
   14.89 @@ -321,10 +356,42 @@ void
   14.90  \vspace{0.3cm}
   14.91  \vspace{0.3cm}
   14.92  \vspace{0.3cm}
   14.93 +\subsubsection{RPC name:~get\_uuid}
   14.94 +
   14.95 +{\bf Overview:} 
   14.96 +Get the uuid field of the given session.
   14.97 +
   14.98 + \noindent {\bf Signature:} 
   14.99 +\begin{verbatim} string get_uuid (session_id s, session ref self)\end{verbatim}
  14.100 +
  14.101 +
  14.102 +\noindent{\bf Arguments:}
  14.103 +
  14.104 + 
  14.105 +\vspace{0.3cm}
  14.106 +\begin{tabular}{|c|c|p{7cm}|}
  14.107 + \hline
  14.108 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.109 +{\tt session ref } & self & reference to the object \\ \hline 
  14.110 +
  14.111 +\end{tabular}
  14.112 +
  14.113 +\vspace{0.3cm}
  14.114 +
  14.115 + \noindent {\bf Return Type:} 
  14.116 +{\tt 
  14.117 +string
  14.118 +}
  14.119 +
  14.120 +
  14.121 +value of the field
  14.122 +\vspace{0.3cm}
  14.123 +\vspace{0.3cm}
  14.124 +\vspace{0.3cm}
  14.125  \subsubsection{RPC name:~get\_this\_host}
  14.126  
  14.127  {\bf Overview:} 
  14.128 -get accessor message derived from field this\_host of object session
  14.129 +Get the this\_host field of the given session.
  14.130  
  14.131   \noindent {\bf Signature:} 
  14.132  \begin{verbatim} (host ref) get_this_host (session_id s, session ref self)\end{verbatim}
  14.133 @@ -337,7 +404,7 @@ get accessor message derived from field 
  14.134  \begin{tabular}{|c|c|p{7cm}|}
  14.135   \hline
  14.136  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.137 -{\tt session ref } & self & object instance \\ \hline 
  14.138 +{\tt session ref } & self & reference to the object \\ \hline 
  14.139  
  14.140  \end{tabular}
  14.141  
  14.142 @@ -356,7 +423,7 @@ value of the field
  14.143  \subsubsection{RPC name:~get\_this\_user}
  14.144  
  14.145  {\bf Overview:} 
  14.146 -get accessor message derived from field this\_user of object session
  14.147 +Get the this\_user field of the given session.
  14.148  
  14.149   \noindent {\bf Signature:} 
  14.150  \begin{verbatim} (user ref) get_this_user (session_id s, session ref self)\end{verbatim}
  14.151 @@ -369,7 +436,7 @@ get accessor message derived from field 
  14.152  \begin{tabular}{|c|c|p{7cm}|}
  14.153   \hline
  14.154  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.155 -{\tt session ref } & self & object instance \\ \hline 
  14.156 +{\tt session ref } & self & reference to the object \\ \hline 
  14.157  
  14.158  \end{tabular}
  14.159  
  14.160 @@ -388,7 +455,7 @@ value of the field
  14.161  \subsubsection{RPC name:~create}
  14.162  
  14.163  {\bf Overview:} 
  14.164 -constructor for class session
  14.165 +Create a new session instance, and return its handle.
  14.166  
  14.167   \noindent {\bf Signature:} 
  14.168  \begin{verbatim} (session ref) create (session_id s, session record args)\end{verbatim}
  14.169 @@ -420,7 +487,7 @@ reference to the newly created object
  14.170  \subsubsection{RPC name:~destroy}
  14.171  
  14.172  {\bf Overview:} 
  14.173 -destructor for class session
  14.174 +Destroy the specified session instance.
  14.175  
  14.176   \noindent {\bf Signature:} 
  14.177  \begin{verbatim} void destroy (session_id s, session ref self)\end{verbatim}
  14.178 @@ -433,7 +500,7 @@ destructor for class session
  14.179  \begin{tabular}{|c|c|p{7cm}|}
  14.180   \hline
  14.181  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.182 -{\tt session ref } & self & object instance \\ \hline 
  14.183 +{\tt session ref } & self & reference to the object \\ \hline 
  14.184  
  14.185  \end{tabular}
  14.186  
  14.187 @@ -452,7 +519,7 @@ void
  14.188  \subsubsection{RPC name:~get\_by\_uuid}
  14.189  
  14.190  {\bf Overview:} 
  14.191 -returns the session instance with a particular uuid
  14.192 +Get a reference to the session instance with the specified UUID.
  14.193  
  14.194   \noindent {\bf Signature:} 
  14.195  \begin{verbatim} (session ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
  14.196 @@ -484,7 +551,7 @@ reference to the object
  14.197  \subsubsection{RPC name:~get\_record}
  14.198  
  14.199  {\bf Overview:} 
  14.200 -returns a record containing the state of an instance of class session
  14.201 +Get a record containing the current state of the given session.
  14.202  
  14.203   \noindent {\bf Signature:} 
  14.204  \begin{verbatim} (session record) get_record (session_id s, session ref self)\end{verbatim}
  14.205 @@ -521,55 +588,30 @@ all fields from the object
  14.206  \begin{longtable}{|lllp{0.38\textwidth}|}
  14.207  \hline
  14.208  \multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf task} \\
  14.209 -\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A longrunning asynchronous task}} \\
  14.210 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A long-running asynchronous task}} \\
  14.211  \hline
  14.212  Quals & Field & Type & Description \\
  14.213  \hline
  14.214  $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object reference \\
  14.215  $\mathit{RW}$ &  {\tt name/label} & string & a human-readable name \\
  14.216  $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-readable description \\
  14.217 +$\mathit{RO}_\mathit{run}$ &  {\tt status} & task\_status\_type & current status of the task \\
  14.218 +$\mathit{RO}_\mathit{run}$ &  {\tt progress} & int & if the task is still pending, this field contains the estimated percentage complete (0-100). If task has completed (successfully or unsuccessfully) this should be 100. \\
  14.219 +$\mathit{RO}_\mathit{run}$ &  {\tt eta} & datetime & if the task is still pending, this field contains the estimated completion time. If the task has finished (successfully or not) it contains the time the task finished. \\
  14.220 +$\mathit{RO}_\mathit{run}$ &  {\tt type} & string & if the task has completed successfully, this field contains the type of the encoded result (i.e. name of the class whose reference is in the result field). Undefined otherwise. \\
  14.221 +$\mathit{RO}_\mathit{run}$ &  {\tt result} & string & if the task has completed successfully, this field contains the result value (either Void or an object reference). Undefined otherwise. \\
  14.222 +$\mathit{RO}_\mathit{run}$ &  {\tt error\_code} & int & if the task has failed, this field contains the error code. Undefined otherwise. \\
  14.223 +$\mathit{RO}_\mathit{run}$ &  {\tt error\_info} & string Set & if the task has failed, this field contains the set of associated error strings. Undefined otherwise. \\
  14.224  \hline
  14.225  \end{longtable}
  14.226  \subsection{Additional RPCs associated with class: task}
  14.227 -\subsubsection{RPC name:~get\_status}
  14.228 -
  14.229 -{\bf Overview:} 
  14.230 -Poll a running asynchronous RPC invocation and query its status
  14.231 -
  14.232 - \noindent {\bf Signature:} 
  14.233 -\begin{verbatim} (uuid ref) get_status (session_id s, task ref task)\end{verbatim}
  14.234 -
  14.235 -
  14.236 -\noindent{\bf Arguments:}
  14.237 -
  14.238 - 
  14.239 -\vspace{0.3cm}
  14.240 -\begin{tabular}{|c|c|p{7cm}|}
  14.241 - \hline
  14.242 -{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.243 -{\tt task ref } & task & The ID of the RPC call to poll \\ \hline 
  14.244 -
  14.245 -\end{tabular}
  14.246 -
  14.247 -\vspace{0.3cm}
  14.248 -
  14.249 - \noindent {\bf Return Type:} 
  14.250 -{\tt 
  14.251 -uuid ref
  14.252 -}
  14.253 -
  14.254 -
  14.255 -String describing status of specified asynchronous RPC invocation, including estimated completion time
  14.256 -\vspace{0.3cm}
  14.257 -\vspace{0.3cm}
  14.258 -\vspace{0.3cm}
  14.259 -\subsubsection{RPC name:~get\_all\_tasks}
  14.260 -
  14.261 -{\bf Overview:} 
  14.262 -List all asynchronous RPC calls currently executing
  14.263 -
  14.264 - \noindent {\bf Signature:} 
  14.265 -\begin{verbatim} ((task ref) Set) get_all_tasks (session_id s)\end{verbatim}
  14.266 +\subsubsection{RPC name:~get\_all}
  14.267 +
  14.268 +{\bf Overview:} 
  14.269 +Return a list of all the tasks known to the system
  14.270 +
  14.271 + \noindent {\bf Signature:} 
  14.272 +\begin{verbatim} ((task ref) Set) get_all (session_id s)\end{verbatim}
  14.273  
  14.274  
  14.275  \vspace{0.3cm}
  14.276 @@ -580,17 +622,14 @@ List all asynchronous RPC calls currentl
  14.277  }
  14.278  
  14.279  
  14.280 -A list of tasks currently executing. Note that
  14.281 -tasks are associated with users rather than sessions. Thus, if you logout and
  14.282 -login again with a different session but the same user, this function will still
  14.283 -return the user's running tasks.
  14.284 +references to all objects
  14.285  \vspace{0.3cm}
  14.286  \vspace{0.3cm}
  14.287  \vspace{0.3cm}
  14.288  \subsubsection{RPC name:~get\_uuid}
  14.289  
  14.290  {\bf Overview:} 
  14.291 -get accessor message derived from field uuid of object task
  14.292 +Get the uuid field of the given task.
  14.293  
  14.294   \noindent {\bf Signature:} 
  14.295  \begin{verbatim} string get_uuid (session_id s, task ref self)\end{verbatim}
  14.296 @@ -603,7 +642,7 @@ get accessor message derived from field 
  14.297  \begin{tabular}{|c|c|p{7cm}|}
  14.298   \hline
  14.299  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.300 -{\tt task ref } & self & object instance \\ \hline 
  14.301 +{\tt task ref } & self & reference to the object \\ \hline 
  14.302  
  14.303  \end{tabular}
  14.304  
  14.305 @@ -622,7 +661,7 @@ value of the field
  14.306  \subsubsection{RPC name:~get\_name\_label}
  14.307  
  14.308  {\bf Overview:} 
  14.309 -get accessor message derived from field name/label of object task
  14.310 +Get the name/label field of the given task.
  14.311  
  14.312   \noindent {\bf Signature:} 
  14.313  \begin{verbatim} string get_name_label (session_id s, task ref self)\end{verbatim}
  14.314 @@ -635,7 +674,7 @@ get accessor message derived from field 
  14.315  \begin{tabular}{|c|c|p{7cm}|}
  14.316   \hline
  14.317  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.318 -{\tt task ref } & self & object instance \\ \hline 
  14.319 +{\tt task ref } & self & reference to the object \\ \hline 
  14.320  
  14.321  \end{tabular}
  14.322  
  14.323 @@ -654,7 +693,7 @@ value of the field
  14.324  \subsubsection{RPC name:~set\_name\_label}
  14.325  
  14.326  {\bf Overview:} 
  14.327 -set accessor message derived from field name/label of object task
  14.328 +Set the name/label field of the given task.
  14.329  
  14.330   \noindent {\bf Signature:} 
  14.331  \begin{verbatim} void set_name_label (session_id s, task ref self, string value)\end{verbatim}
  14.332 @@ -667,7 +706,7 @@ set accessor message derived from field 
  14.333  \begin{tabular}{|c|c|p{7cm}|}
  14.334   \hline
  14.335  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.336 -{\tt task ref } & self & object instance \\ \hline 
  14.337 +{\tt task ref } & self & reference to the object \\ \hline 
  14.338  
  14.339  {\tt string } & value & New value to set \\ \hline 
  14.340  
  14.341 @@ -688,7 +727,7 @@ void
  14.342  \subsubsection{RPC name:~get\_name\_description}
  14.343  
  14.344  {\bf Overview:} 
  14.345 -get accessor message derived from field name/description of object task
  14.346 +Get the name/description field of the given task.
  14.347  
  14.348   \noindent {\bf Signature:} 
  14.349  \begin{verbatim} string get_name_description (session_id s, task ref self)\end{verbatim}
  14.350 @@ -701,7 +740,7 @@ get accessor message derived from field 
  14.351  \begin{tabular}{|c|c|p{7cm}|}
  14.352   \hline
  14.353  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.354 -{\tt task ref } & self & object instance \\ \hline 
  14.355 +{\tt task ref } & self & reference to the object \\ \hline 
  14.356  
  14.357  \end{tabular}
  14.358  
  14.359 @@ -720,7 +759,7 @@ value of the field
  14.360  \subsubsection{RPC name:~set\_name\_description}
  14.361  
  14.362  {\bf Overview:} 
  14.363 -set accessor message derived from field name/description of object task
  14.364 +Set the name/description field of the given task.
  14.365  
  14.366   \noindent {\bf Signature:} 
  14.367  \begin{verbatim} void set_name_description (session_id s, task ref self, string value)\end{verbatim}
  14.368 @@ -733,7 +772,7 @@ set accessor message derived from field 
  14.369  \begin{tabular}{|c|c|p{7cm}|}
  14.370   \hline
  14.371  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.372 -{\tt task ref } & self & object instance \\ \hline 
  14.373 +{\tt task ref } & self & reference to the object \\ \hline 
  14.374  
  14.375  {\tt string } & value & New value to set \\ \hline 
  14.376  
  14.377 @@ -751,10 +790,234 @@ void
  14.378  \vspace{0.3cm}
  14.379  \vspace{0.3cm}
  14.380  \vspace{0.3cm}
  14.381 +\subsubsection{RPC name:~get\_status}
  14.382 +
  14.383 +{\bf Overview:} 
  14.384 +Get the status field of the given task.
  14.385 +
  14.386 + \noindent {\bf Signature:} 
  14.387 +\begin{verbatim} (task_status_type) get_status (session_id s, task ref self)\end{verbatim}
  14.388 +
  14.389 +
  14.390 +\noindent{\bf Arguments:}
  14.391 +
  14.392 + 
  14.393 +\vspace{0.3cm}
  14.394 +\begin{tabular}{|c|c|p{7cm}|}
  14.395 + \hline
  14.396 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.397 +{\tt task ref } & self & reference to the object \\ \hline 
  14.398 +
  14.399 +\end{tabular}
  14.400 +
  14.401 +\vspace{0.3cm}
  14.402 +
  14.403 + \noindent {\bf Return Type:} 
  14.404 +{\tt 
  14.405 +task\_status\_type
  14.406 +}
  14.407 +
  14.408 +
  14.409 +value of the field
  14.410 +\vspace{0.3cm}
  14.411 +\vspace{0.3cm}
  14.412 +\vspace{0.3cm}
  14.413 +\subsubsection{RPC name:~get\_progress}
  14.414 +
  14.415 +{\bf Overview:} 
  14.416 +Get the progress field of the given task.
  14.417 +
  14.418 + \noindent {\bf Signature:} 
  14.419 +\begin{verbatim} int get_progress (session_id s, task ref self)\end{verbatim}
  14.420 +
  14.421 +
  14.422 +\noindent{\bf Arguments:}
  14.423 +
  14.424 + 
  14.425 +\vspace{0.3cm}
  14.426 +\begin{tabular}{|c|c|p{7cm}|}
  14.427 + \hline
  14.428 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.429 +{\tt task ref } & self & reference to the object \\ \hline 
  14.430 +
  14.431 +\end{tabular}
  14.432 +
  14.433 +\vspace{0.3cm}
  14.434 +
  14.435 + \noindent {\bf Return Type:} 
  14.436 +{\tt 
  14.437 +int
  14.438 +}
  14.439 +
  14.440 +
  14.441 +value of the field
  14.442 +\vspace{0.3cm}
  14.443 +\vspace{0.3cm}
  14.444 +\vspace{0.3cm}
  14.445 +\subsubsection{RPC name:~get\_eta}
  14.446 +
  14.447 +{\bf Overview:} 
  14.448 +Get the eta field of the given task.
  14.449 +
  14.450 + \noindent {\bf Signature:} 
  14.451 +\begin{verbatim} datetime get_eta (session_id s, task ref self)\end{verbatim}
  14.452 +
  14.453 +
  14.454 +\noindent{\bf Arguments:}
  14.455 +
  14.456 + 
  14.457 +\vspace{0.3cm}
  14.458 +\begin{tabular}{|c|c|p{7cm}|}
  14.459 + \hline
  14.460 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.461 +{\tt task ref } & self & reference to the object \\ \hline 
  14.462 +
  14.463 +\end{tabular}
  14.464 +
  14.465 +\vspace{0.3cm}
  14.466 +
  14.467 + \noindent {\bf Return Type:} 
  14.468 +{\tt 
  14.469 +datetime
  14.470 +}
  14.471 +
  14.472 +
  14.473 +value of the field
  14.474 +\vspace{0.3cm}
  14.475 +\vspace{0.3cm}
  14.476 +\vspace{0.3cm}
  14.477 +\subsubsection{RPC name:~get\_type}
  14.478 +
  14.479 +{\bf Overview:} 
  14.480 +Get the type field of the given task.
  14.481 +
  14.482 + \noindent {\bf Signature:} 
  14.483 +\begin{verbatim} string get_type (session_id s, task ref self)\end{verbatim}
  14.484 +
  14.485 +
  14.486 +\noindent{\bf Arguments:}
  14.487 +
  14.488 + 
  14.489 +\vspace{0.3cm}
  14.490 +\begin{tabular}{|c|c|p{7cm}|}
  14.491 + \hline
  14.492 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.493 +{\tt task ref } & self & reference to the object \\ \hline 
  14.494 +
  14.495 +\end{tabular}
  14.496 +
  14.497 +\vspace{0.3cm}
  14.498 +
  14.499 + \noindent {\bf Return Type:} 
  14.500 +{\tt 
  14.501 +string
  14.502 +}
  14.503 +
  14.504 +
  14.505 +value of the field
  14.506 +\vspace{0.3cm}
  14.507 +\vspace{0.3cm}
  14.508 +\vspace{0.3cm}
  14.509 +\subsubsection{RPC name:~get\_result}
  14.510 +
  14.511 +{\bf Overview:} 
  14.512 +Get the result field of the given task.
  14.513 +
  14.514 + \noindent {\bf Signature:} 
  14.515 +\begin{verbatim} string get_result (session_id s, task ref self)\end{verbatim}
  14.516 +
  14.517 +
  14.518 +\noindent{\bf Arguments:}
  14.519 +
  14.520 + 
  14.521 +\vspace{0.3cm}
  14.522 +\begin{tabular}{|c|c|p{7cm}|}
  14.523 + \hline
  14.524 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.525 +{\tt task ref } & self & reference to the object \\ \hline 
  14.526 +
  14.527 +\end{tabular}
  14.528 +
  14.529 +\vspace{0.3cm}
  14.530 +
  14.531 + \noindent {\bf Return Type:} 
  14.532 +{\tt 
  14.533 +string
  14.534 +}
  14.535 +
  14.536 +
  14.537 +value of the field
  14.538 +\vspace{0.3cm}
  14.539 +\vspace{0.3cm}
  14.540 +\vspace{0.3cm}
  14.541 +\subsubsection{RPC name:~get\_error\_code}
  14.542 +
  14.543 +{\bf Overview:} 
  14.544 +Get the error\_code field of the given task.
  14.545 +
  14.546 + \noindent {\bf Signature:} 
  14.547 +\begin{verbatim} int get_error_code (session_id s, task ref self)\end{verbatim}
  14.548 +
  14.549 +
  14.550 +\noindent{\bf Arguments:}
  14.551 +
  14.552 + 
  14.553 +\vspace{0.3cm}
  14.554 +\begin{tabular}{|c|c|p{7cm}|}
  14.555 + \hline
  14.556 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.557 +{\tt task ref } & self & reference to the object \\ \hline 
  14.558 +
  14.559 +\end{tabular}
  14.560 +
  14.561 +\vspace{0.3cm}
  14.562 +
  14.563 + \noindent {\bf Return Type:} 
  14.564 +{\tt 
  14.565 +int
  14.566 +}
  14.567 +
  14.568 +
  14.569 +value of the field
  14.570 +\vspace{0.3cm}
  14.571 +\vspace{0.3cm}
  14.572 +\vspace{0.3cm}
  14.573 +\subsubsection{RPC name:~get\_error\_info}
  14.574 +
  14.575 +{\bf Overview:} 
  14.576 +Get the error\_info field of the given task.
  14.577 +
  14.578 + \noindent {\bf Signature:} 
  14.579 +\begin{verbatim} (string Set) get_error_info (session_id s, task ref self)\end{verbatim}
  14.580 +
  14.581 +
  14.582 +\noindent{\bf Arguments:}
  14.583 +
  14.584 + 
  14.585 +\vspace{0.3cm}
  14.586 +\begin{tabular}{|c|c|p{7cm}|}
  14.587 + \hline
  14.588 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.589 +{\tt task ref } & self & reference to the object \\ \hline 
  14.590 +
  14.591 +\end{tabular}
  14.592 +
  14.593 +\vspace{0.3cm}
  14.594 +
  14.595 + \noindent {\bf Return Type:} 
  14.596 +{\tt 
  14.597 +string Set
  14.598 +}
  14.599 +
  14.600 +
  14.601 +value of the field
  14.602 +\vspace{0.3cm}
  14.603 +\vspace{0.3cm}
  14.604 +\vspace{0.3cm}
  14.605  \subsubsection{RPC name:~create}
  14.606  
  14.607  {\bf Overview:} 
  14.608 -constructor for class task
  14.609 +Create a new task instance, and return its handle.
  14.610  
  14.611   \noindent {\bf Signature:} 
  14.612  \begin{verbatim} (task ref) create (session_id s, task record args)\end{verbatim}
  14.613 @@ -786,7 +1049,7 @@ reference to the newly created object
  14.614  \subsubsection{RPC name:~destroy}
  14.615  
  14.616  {\bf Overview:} 
  14.617 -destructor for class task
  14.618 +Destroy the specified task instance.
  14.619  
  14.620   \noindent {\bf Signature:} 
  14.621  \begin{verbatim} void destroy (session_id s, task ref self)\end{verbatim}
  14.622 @@ -799,7 +1062,7 @@ destructor for class task
  14.623  \begin{tabular}{|c|c|p{7cm}|}
  14.624   \hline
  14.625  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.626 -{\tt task ref } & self & object instance \\ \hline 
  14.627 +{\tt task ref } & self & reference to the object \\ \hline 
  14.628  
  14.629  \end{tabular}
  14.630  
  14.631 @@ -818,7 +1081,7 @@ void
  14.632  \subsubsection{RPC name:~get\_by\_uuid}
  14.633  
  14.634  {\bf Overview:} 
  14.635 -returns the task instance with a particular uuid
  14.636 +Get a reference to the task instance with the specified UUID.
  14.637  
  14.638   \noindent {\bf Signature:} 
  14.639  \begin{verbatim} (task ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
  14.640 @@ -850,7 +1113,7 @@ reference to the object
  14.641  \subsubsection{RPC name:~get\_record}
  14.642  
  14.643  {\bf Overview:} 
  14.644 -returns a record containing the state of an instance of class task
  14.645 +Get a record containing the current state of the given task.
  14.646  
  14.647   \noindent {\bf Signature:} 
  14.648  \begin{verbatim} (task record) get_record (session_id s, task ref self)\end{verbatim}
  14.649 @@ -882,7 +1145,7 @@ all fields from the object
  14.650  \subsubsection{RPC name:~get\_by\_name\_label}
  14.651  
  14.652  {\bf Overview:} 
  14.653 -returns the task instance with a particular name label
  14.654 +Get all the task instances with the given label.
  14.655  
  14.656   \noindent {\bf Signature:} 
  14.657  \begin{verbatim} ((task ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
  14.658 @@ -929,15 +1192,16 @@ Quals & Field & Type & Description \\
  14.659  $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-readable description \\
  14.660  $\mathit{RW}$ &  {\tt user\_version} & int & a user version number for this machine \\
  14.661  $\mathit{RW}$ &  {\tt is\_a\_template} & bool & true if this is a template. Template VMs can never be started, they are used only for cloning other VMs \\
  14.662 +$\mathit{RW}$ &  {\tt auto\_power\_on} & bool & true if this VM should be started automatically after host boot \\
  14.663  $\mathit{RO}_\mathit{run}$ &  {\tt resident\_on} & host ref & the host the VM is currently resident on \\
  14.664 -$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum \\
  14.665 -$\mathit{RW}$ &  {\tt memory/dynamic\_max} & int & Dynamic maximum \\
  14.666 -$\mathit{RO}_\mathit{run}$ &  {\tt memory/actual} & int & Guest's actual usage \\
  14.667 -$\mathit{RW}$ &  {\tt memory/dynamic\_min} & int & Dynamic minimum \\
  14.668 -$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum \\
  14.669 +$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\
  14.670 +$\mathit{RW}$ &  {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\
  14.671 +$\mathit{RO}_\mathit{run}$ &  {\tt memory/actual} & int & Guest's actual usage (bytes) \\
  14.672 +$\mathit{RW}$ &  {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\
  14.673 +$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\
  14.674  $\mathit{RW}$ &  {\tt VCPUs/policy} & string & the name of the VCPU scheduling policy to be applied \\
  14.675  $\mathit{RW}$ &  {\tt VCPUs/params} & string & string-encoded parameters passed to selected VCPU policy \\
  14.676 -$\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/number} & int & Current number of VCPUs \\
  14.677 +$\mathit{RW}$ &  {\tt VCPUs/number} & int & Current number of VCPUs \\
  14.678  $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\
  14.679  $\mathit{RO}_\mathit{ins}$ &  {\tt VCPUs/features/required} & (cpu\_feature) Set & CPU features the guest demands the host supports \\
  14.680  $\mathit{RO}_\mathit{ins}$ &  {\tt VCPUs/features/can\_use} & (cpu\_feature) Set & CPU features the guest can use if available \\
  14.681 @@ -947,6 +1211,7 @@ Quals & Field & Type & Description \\
  14.682  $\mathit{RW}$ &  {\tt actions/after\_reboot} & on\_normal\_exit & action to take after the guest has rebooted itself \\
  14.683  $\mathit{RW}$ &  {\tt actions/after\_suspend} & on\_normal\_exit & action to take after the guest has suspended itself \\
  14.684  $\mathit{RW}$ &  {\tt actions/after\_crash} & on\_crash\_behaviour & action to take if the guest crashes \\
  14.685 +$\mathit{RO}_\mathit{run}$ &  {\tt consoles} & (console ref) Set & virtual console devices \\
  14.686  $\mathit{RO}_\mathit{run}$ &  {\tt VIFs} & (VIF ref) Set & virtual network interfaces \\
  14.687  $\mathit{RO}_\mathit{run}$ &  {\tt VBDs} & (VBD ref) Set & virtual block devices \\
  14.688  $\mathit{RO}_\mathit{run}$ &  {\tt VTPMs} & (VTPM ref) Set & virtual TPMs \\
  14.689 @@ -1322,7 +1587,7 @@ A list of all the IDs of all the VMs
  14.690  \subsubsection{RPC name:~get\_uuid}
  14.691  
  14.692  {\bf Overview:} 
  14.693 -get accessor message derived from field uuid of object VM
  14.694 +Get the uuid field of the given VM.
  14.695  
  14.696   \noindent {\bf Signature:} 
  14.697  \begin{verbatim} string get_uuid (session_id s, VM ref self)\end{verbatim}
  14.698 @@ -1335,7 +1600,7 @@ get accessor message derived from field 
  14.699  \begin{tabular}{|c|c|p{7cm}|}
  14.700   \hline
  14.701  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.702 -{\tt VM ref } & self & object instance \\ \hline 
  14.703 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.704  
  14.705  \end{tabular}
  14.706  
  14.707 @@ -1354,7 +1619,7 @@ value of the field
  14.708  \subsubsection{RPC name:~get\_power\_state}
  14.709  
  14.710  {\bf Overview:} 
  14.711 -get accessor message derived from field power\_state of object VM
  14.712 +Get the power\_state field of the given VM.
  14.713  
  14.714   \noindent {\bf Signature:} 
  14.715  \begin{verbatim} (vm_power_state) get_power_state (session_id s, VM ref self)\end{verbatim}
  14.716 @@ -1367,7 +1632,7 @@ get accessor message derived from field 
  14.717  \begin{tabular}{|c|c|p{7cm}|}
  14.718   \hline
  14.719  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.720 -{\tt VM ref } & self & object instance \\ \hline 
  14.721 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.722  
  14.723  \end{tabular}
  14.724  
  14.725 @@ -1386,7 +1651,7 @@ value of the field
  14.726  \subsubsection{RPC name:~get\_name\_label}
  14.727  
  14.728  {\bf Overview:} 
  14.729 -get accessor message derived from field name/label of object VM
  14.730 +Get the name/label field of the given VM.
  14.731  
  14.732   \noindent {\bf Signature:} 
  14.733  \begin{verbatim} string get_name_label (session_id s, VM ref self)\end{verbatim}
  14.734 @@ -1399,7 +1664,7 @@ get accessor message derived from field 
  14.735  \begin{tabular}{|c|c|p{7cm}|}
  14.736   \hline
  14.737  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.738 -{\tt VM ref } & self & object instance \\ \hline 
  14.739 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.740  
  14.741  \end{tabular}
  14.742  
  14.743 @@ -1418,7 +1683,7 @@ value of the field
  14.744  \subsubsection{RPC name:~set\_name\_label}
  14.745  
  14.746  {\bf Overview:} 
  14.747 -set accessor message derived from field name/label of object VM
  14.748 +Set the name/label field of the given VM.
  14.749  
  14.750   \noindent {\bf Signature:} 
  14.751  \begin{verbatim} void set_name_label (session_id s, VM ref self, string value)\end{verbatim}
  14.752 @@ -1431,7 +1696,7 @@ set accessor message derived from field 
  14.753  \begin{tabular}{|c|c|p{7cm}|}
  14.754   \hline
  14.755  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.756 -{\tt VM ref } & self & object instance \\ \hline 
  14.757 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.758  
  14.759  {\tt string } & value & New value to set \\ \hline 
  14.760  
  14.761 @@ -1452,7 +1717,7 @@ void
  14.762  \subsubsection{RPC name:~get\_name\_description}
  14.763  
  14.764  {\bf Overview:} 
  14.765 -get accessor message derived from field name/description of object VM
  14.766 +Get the name/description field of the given VM.
  14.767  
  14.768   \noindent {\bf Signature:} 
  14.769  \begin{verbatim} string get_name_description (session_id s, VM ref self)\end{verbatim}
  14.770 @@ -1465,7 +1730,7 @@ get accessor message derived from field 
  14.771  \begin{tabular}{|c|c|p{7cm}|}
  14.772   \hline
  14.773  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.774 -{\tt VM ref } & self & object instance \\ \hline 
  14.775 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.776  
  14.777  \end{tabular}
  14.778  
  14.779 @@ -1484,7 +1749,7 @@ value of the field
  14.780  \subsubsection{RPC name:~set\_name\_description}
  14.781  
  14.782  {\bf Overview:} 
  14.783 -set accessor message derived from field name/description of object VM
  14.784 +Set the name/description field of the given VM.
  14.785  
  14.786   \noindent {\bf Signature:} 
  14.787  \begin{verbatim} void set_name_description (session_id s, VM ref self, string value)\end{verbatim}
  14.788 @@ -1497,7 +1762,7 @@ set accessor message derived from field 
  14.789  \begin{tabular}{|c|c|p{7cm}|}
  14.790   \hline
  14.791  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.792 -{\tt VM ref } & self & object instance \\ \hline 
  14.793 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.794  
  14.795  {\tt string } & value & New value to set \\ \hline 
  14.796  
  14.797 @@ -1518,7 +1783,7 @@ void
  14.798  \subsubsection{RPC name:~get\_user\_version}
  14.799  
  14.800  {\bf Overview:} 
  14.801 -get accessor message derived from field user\_version of object VM
  14.802 +Get the user\_version field of the given VM.
  14.803  
  14.804   \noindent {\bf Signature:} 
  14.805  \begin{verbatim} int get_user_version (session_id s, VM ref self)\end{verbatim}
  14.806 @@ -1531,7 +1796,7 @@ get accessor message derived from field 
  14.807  \begin{tabular}{|c|c|p{7cm}|}
  14.808   \hline
  14.809  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.810 -{\tt VM ref } & self & object instance \\ \hline 
  14.811 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.812  
  14.813  \end{tabular}
  14.814  
  14.815 @@ -1550,7 +1815,7 @@ value of the field
  14.816  \subsubsection{RPC name:~set\_user\_version}
  14.817  
  14.818  {\bf Overview:} 
  14.819 -set accessor message derived from field user\_version of object VM
  14.820 +Set the user\_version field of the given VM.
  14.821  
  14.822   \noindent {\bf Signature:} 
  14.823  \begin{verbatim} void set_user_version (session_id s, VM ref self, int value)\end{verbatim}
  14.824 @@ -1563,7 +1828,7 @@ set accessor message derived from field 
  14.825  \begin{tabular}{|c|c|p{7cm}|}
  14.826   \hline
  14.827  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.828 -{\tt VM ref } & self & object instance \\ \hline 
  14.829 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.830  
  14.831  {\tt int } & value & New value to set \\ \hline 
  14.832  
  14.833 @@ -1584,7 +1849,7 @@ void
  14.834  \subsubsection{RPC name:~get\_is\_a\_template}
  14.835  
  14.836  {\bf Overview:} 
  14.837 -get accessor message derived from field is\_a\_template of object VM
  14.838 +Get the is\_a\_template field of the given VM.
  14.839  
  14.840   \noindent {\bf Signature:} 
  14.841  \begin{verbatim} bool get_is_a_template (session_id s, VM ref self)\end{verbatim}
  14.842 @@ -1597,7 +1862,7 @@ get accessor message derived from field 
  14.843  \begin{tabular}{|c|c|p{7cm}|}
  14.844   \hline
  14.845  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.846 -{\tt VM ref } & self & object instance \\ \hline 
  14.847 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.848  
  14.849  \end{tabular}
  14.850  
  14.851 @@ -1616,7 +1881,7 @@ value of the field
  14.852  \subsubsection{RPC name:~set\_is\_a\_template}
  14.853  
  14.854  {\bf Overview:} 
  14.855 -set accessor message derived from field is\_a\_template of object VM
  14.856 +Set the is\_a\_template field of the given VM.
  14.857  
  14.858   \noindent {\bf Signature:} 
  14.859  \begin{verbatim} void set_is_a_template (session_id s, VM ref self, bool value)\end{verbatim}
  14.860 @@ -1629,7 +1894,73 @@ set accessor message derived from field 
  14.861  \begin{tabular}{|c|c|p{7cm}|}
  14.862   \hline
  14.863  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.864 -{\tt VM ref } & self & object instance \\ \hline 
  14.865 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.866 +
  14.867 +{\tt bool } & value & New value to set \\ \hline 
  14.868 +
  14.869 +\end{tabular}
  14.870 +
  14.871 +\vspace{0.3cm}
  14.872 +
  14.873 + \noindent {\bf Return Type:} 
  14.874 +{\tt 
  14.875 +void
  14.876 +}
  14.877 +
  14.878 +
  14.879 +
  14.880 +\vspace{0.3cm}
  14.881 +\vspace{0.3cm}
  14.882 +\vspace{0.3cm}
  14.883 +\subsubsection{RPC name:~get\_auto\_power\_on}
  14.884 +
  14.885 +{\bf Overview:} 
  14.886 +Get the auto\_power\_on field of the given VM.
  14.887 +
  14.888 + \noindent {\bf Signature:} 
  14.889 +\begin{verbatim} bool get_auto_power_on (session_id s, VM ref self)\end{verbatim}
  14.890 +
  14.891 +
  14.892 +\noindent{\bf Arguments:}
  14.893 +
  14.894 + 
  14.895 +\vspace{0.3cm}
  14.896 +\begin{tabular}{|c|c|p{7cm}|}
  14.897 + \hline
  14.898 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.899 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.900 +
  14.901 +\end{tabular}
  14.902 +
  14.903 +\vspace{0.3cm}
  14.904 +
  14.905 + \noindent {\bf Return Type:} 
  14.906 +{\tt 
  14.907 +bool
  14.908 +}
  14.909 +
  14.910 +
  14.911 +value of the field
  14.912 +\vspace{0.3cm}
  14.913 +\vspace{0.3cm}
  14.914 +\vspace{0.3cm}
  14.915 +\subsubsection{RPC name:~set\_auto\_power\_on}
  14.916 +
  14.917 +{\bf Overview:} 
  14.918 +Set the auto\_power\_on field of the given VM.
  14.919 +
  14.920 + \noindent {\bf Signature:} 
  14.921 +\begin{verbatim} void set_auto_power_on (session_id s, VM ref self, bool value)\end{verbatim}
  14.922 +
  14.923 +
  14.924 +\noindent{\bf Arguments:}
  14.925 +
  14.926 + 
  14.927 +\vspace{0.3cm}
  14.928 +\begin{tabular}{|c|c|p{7cm}|}
  14.929 + \hline
  14.930 +{\bf type} & {\bf name} & {\bf description} \\ \hline
  14.931 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.932  
  14.933  {\tt bool } & value & New value to set \\ \hline 
  14.934  
  14.935 @@ -1650,7 +1981,7 @@ void
  14.936  \subsubsection{RPC name:~get\_resident\_on}
  14.937  
  14.938  {\bf Overview:} 
  14.939 -get accessor message derived from field resident\_on of object VM
  14.940 +Get the resident\_on field of the given VM.
  14.941  
  14.942   \noindent {\bf Signature:} 
  14.943  \begin{verbatim} (host ref) get_resident_on (session_id s, VM ref self)\end{verbatim}
  14.944 @@ -1663,7 +1994,7 @@ get accessor message derived from field 
  14.945  \begin{tabular}{|c|c|p{7cm}|}
  14.946   \hline
  14.947  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.948 -{\tt VM ref } & self & object instance \\ \hline 
  14.949 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.950  
  14.951  \end{tabular}
  14.952  
  14.953 @@ -1682,7 +2013,7 @@ value of the field
  14.954  \subsubsection{RPC name:~get\_memory\_static\_max}
  14.955  
  14.956  {\bf Overview:} 
  14.957 -get accessor message derived from field memory/static\_max of object VM
  14.958 +Get the memory/static\_max field of the given VM.
  14.959  
  14.960   \noindent {\bf Signature:} 
  14.961  \begin{verbatim} int get_memory_static_max (session_id s, VM ref self)\end{verbatim}
  14.962 @@ -1695,7 +2026,7 @@ get accessor message derived from field 
  14.963  \begin{tabular}{|c|c|p{7cm}|}
  14.964   \hline
  14.965  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.966 -{\tt VM ref } & self & object instance \\ \hline 
  14.967 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.968  
  14.969  \end{tabular}
  14.970  
  14.971 @@ -1714,7 +2045,7 @@ value of the field
  14.972  \subsubsection{RPC name:~get\_memory\_dynamic\_max}
  14.973  
  14.974  {\bf Overview:} 
  14.975 -get accessor message derived from field memory/dynamic\_max of object VM
  14.976 +Get the memory/dynamic\_max field of the given VM.
  14.977  
  14.978   \noindent {\bf Signature:} 
  14.979  \begin{verbatim} int get_memory_dynamic_max (session_id s, VM ref self)\end{verbatim}
  14.980 @@ -1727,7 +2058,7 @@ get accessor message derived from field 
  14.981  \begin{tabular}{|c|c|p{7cm}|}
  14.982   \hline
  14.983  {\bf type} & {\bf name} & {\bf description} \\ \hline
  14.984 -{\tt VM ref } & self & object instance \\ \hline 
  14.985 +{\tt VM ref } & self & reference to the object \\ \hline 
  14.986  
  14.987  \end{tabular}
  14.988  
  14.989 @@ -1746,7 +2077,7 @@ value of the field
  14.990  \subsubsection{RPC name:~set\_memory\_dynamic\_max}
  14.991  
  14.992  {\bf Overview:} 
  14.993 -set accessor message derived from field memory/dynamic\_max of object VM
  14.994 +Set the memory/dynamic\_max field of the given VM.
  14.995  
  14.996   \noindent {\bf Signature:} 
  14.997  \begin{verbatim} void set_memory_dynamic_max (session_id s, VM ref self, int value)\end{verbatim}
  14.998 @@ -1759,7 +2090,7 @@ set accessor message derived from field 
  14.999  \begin{tabular}{|c|c|p{7cm}|}
 14.1000   \hline
 14.1001  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1002 -{\tt VM ref } & self & object instance \\ \hline 
 14.1003 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1004  
 14.1005  {\tt int } & value & New value to set \\ \hline 
 14.1006  
 14.1007 @@ -1780,7 +2111,7 @@ void
 14.1008  \subsubsection{RPC name:~get\_memory\_actual}
 14.1009  
 14.1010  {\bf Overview:} 
 14.1011 -get accessor message derived from field memory/actual of object VM
 14.1012 +Get the memory/actual field of the given VM.
 14.1013  
 14.1014   \noindent {\bf Signature:} 
 14.1015  \begin{verbatim} int get_memory_actual (session_id s, VM ref self)\end{verbatim}
 14.1016 @@ -1793,7 +2124,7 @@ get accessor message derived from field 
 14.1017  \begin{tabular}{|c|c|p{7cm}|}
 14.1018   \hline
 14.1019  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1020 -{\tt VM ref } & self & object instance \\ \hline 
 14.1021 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1022  
 14.1023  \end{tabular}
 14.1024  
 14.1025 @@ -1812,7 +2143,7 @@ value of the field
 14.1026  \subsubsection{RPC name:~get\_memory\_dynamic\_min}
 14.1027  
 14.1028  {\bf Overview:} 
 14.1029 -get accessor message derived from field memory/dynamic\_min of object VM
 14.1030 +Get the memory/dynamic\_min field of the given VM.
 14.1031  
 14.1032   \noindent {\bf Signature:} 
 14.1033  \begin{verbatim} int get_memory_dynamic_min (session_id s, VM ref self)\end{verbatim}
 14.1034 @@ -1825,7 +2156,7 @@ get accessor message derived from field 
 14.1035  \begin{tabular}{|c|c|p{7cm}|}
 14.1036   \hline
 14.1037  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1038 -{\tt VM ref } & self & object instance \\ \hline 
 14.1039 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1040  
 14.1041  \end{tabular}
 14.1042  
 14.1043 @@ -1844,7 +2175,7 @@ value of the field
 14.1044  \subsubsection{RPC name:~set\_memory\_dynamic\_min}
 14.1045  
 14.1046  {\bf Overview:} 
 14.1047 -set accessor message derived from field memory/dynamic\_min of object VM
 14.1048 +Set the memory/dynamic\_min field of the given VM.
 14.1049  
 14.1050   \noindent {\bf Signature:} 
 14.1051  \begin{verbatim} void set_memory_dynamic_min (session_id s, VM ref self, int value)\end{verbatim}
 14.1052 @@ -1857,7 +2188,7 @@ set accessor message derived from field 
 14.1053  \begin{tabular}{|c|c|p{7cm}|}
 14.1054   \hline
 14.1055  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1056 -{\tt VM ref } & self & object instance \\ \hline 
 14.1057 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1058  
 14.1059  {\tt int } & value & New value to set \\ \hline 
 14.1060  
 14.1061 @@ -1878,7 +2209,7 @@ void
 14.1062  \subsubsection{RPC name:~get\_memory\_static\_min}
 14.1063  
 14.1064  {\bf Overview:} 
 14.1065 -get accessor message derived from field memory/static\_min of object VM
 14.1066 +Get the memory/static\_min field of the given VM.
 14.1067  
 14.1068   \noindent {\bf Signature:} 
 14.1069  \begin{verbatim} int get_memory_static_min (session_id s, VM ref self)\end{verbatim}
 14.1070 @@ -1891,7 +2222,7 @@ get accessor message derived from field 
 14.1071  \begin{tabular}{|c|c|p{7cm}|}
 14.1072   \hline
 14.1073  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1074 -{\tt VM ref } & self & object instance \\ \hline 
 14.1075 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1076  
 14.1077  \end{tabular}
 14.1078  
 14.1079 @@ -1910,7 +2241,7 @@ value of the field
 14.1080  \subsubsection{RPC name:~get\_VCPUs\_policy}
 14.1081  
 14.1082  {\bf Overview:} 
 14.1083 -get accessor message derived from field VCPUs/policy of object VM
 14.1084 +Get the VCPUs/policy field of the given VM.
 14.1085  
 14.1086   \noindent {\bf Signature:} 
 14.1087  \begin{verbatim} string get_VCPUs_policy (session_id s, VM ref self)\end{verbatim}
 14.1088 @@ -1923,7 +2254,7 @@ get accessor message derived from field 
 14.1089  \begin{tabular}{|c|c|p{7cm}|}
 14.1090   \hline
 14.1091  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1092 -{\tt VM ref } & self & object instance \\ \hline 
 14.1093 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1094  
 14.1095  \end{tabular}
 14.1096  
 14.1097 @@ -1942,7 +2273,7 @@ value of the field
 14.1098  \subsubsection{RPC name:~set\_VCPUs\_policy}
 14.1099  
 14.1100  {\bf Overview:} 
 14.1101 -set accessor message derived from field VCPUs/policy of object VM
 14.1102 +Set the VCPUs/policy field of the given VM.
 14.1103  
 14.1104   \noindent {\bf Signature:} 
 14.1105  \begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string value)\end{verbatim}
 14.1106 @@ -1955,7 +2286,7 @@ set accessor message derived from field 
 14.1107  \begin{tabular}{|c|c|p{7cm}|}
 14.1108   \hline
 14.1109  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1110 -{\tt VM ref } & self & object instance \\ \hline 
 14.1111 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1112  
 14.1113  {\tt string } & value & New value to set \\ \hline 
 14.1114  
 14.1115 @@ -1976,7 +2307,7 @@ void
 14.1116  \subsubsection{RPC name:~get\_VCPUs\_params}
 14.1117  
 14.1118  {\bf Overview:} 
 14.1119 -get accessor message derived from field VCPUs/params of object VM
 14.1120 +Get the VCPUs/params field of the given VM.
 14.1121  
 14.1122   \noindent {\bf Signature:} 
 14.1123  \begin{verbatim} string get_VCPUs_params (session_id s, VM ref self)\end{verbatim}
 14.1124 @@ -1989,7 +2320,7 @@ get accessor message derived from field 
 14.1125  \begin{tabular}{|c|c|p{7cm}|}
 14.1126   \hline
 14.1127  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1128 -{\tt VM ref } & self & object instance \\ \hline 
 14.1129 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1130  
 14.1131  \end{tabular}
 14.1132  
 14.1133 @@ -2008,7 +2339,7 @@ value of the field
 14.1134  \subsubsection{RPC name:~set\_VCPUs\_params}
 14.1135  
 14.1136  {\bf Overview:} 
 14.1137 -set accessor message derived from field VCPUs/params of object VM
 14.1138 +Set the VCPUs/params field of the given VM.
 14.1139  
 14.1140   \noindent {\bf Signature:} 
 14.1141  \begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, string value)\end{verbatim}
 14.1142 @@ -2021,7 +2352,7 @@ set accessor message derived from field 
 14.1143  \begin{tabular}{|c|c|p{7cm}|}
 14.1144   \hline
 14.1145  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1146 -{\tt VM ref } & self & object instance \\ \hline 
 14.1147 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1148  
 14.1149  {\tt string } & value & New value to set \\ \hline 
 14.1150  
 14.1151 @@ -2042,7 +2373,7 @@ void
 14.1152  \subsubsection{RPC name:~get\_VCPUs\_number}
 14.1153  
 14.1154  {\bf Overview:} 
 14.1155 -get accessor message derived from field VCPUs/number of object VM
 14.1156 +Get the VCPUs/number field of the given VM.
 14.1157  
 14.1158   \noindent {\bf Signature:} 
 14.1159  \begin{verbatim} int get_VCPUs_number (session_id s, VM ref self)\end{verbatim}
 14.1160 @@ -2055,7 +2386,7 @@ get accessor message derived from field 
 14.1161  \begin{tabular}{|c|c|p{7cm}|}
 14.1162   \hline
 14.1163  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1164 -{\tt VM ref } & self & object instance \\ \hline 
 14.1165 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1166  
 14.1167  \end{tabular}
 14.1168  
 14.1169 @@ -2071,10 +2402,44 @@ value of the field
 14.1170  \vspace{0.3cm}
 14.1171  \vspace{0.3cm}
 14.1172  \vspace{0.3cm}
 14.1173 +\subsubsection{RPC name:~set\_VCPUs\_number}
 14.1174 +
 14.1175 +{\bf Overview:} 
 14.1176 +Set the VCPUs/number field of the given VM.
 14.1177 +
 14.1178 + \noindent {\bf Signature:} 
 14.1179 +\begin{verbatim} void set_VCPUs_number (session_id s, VM ref self, int value)\end{verbatim}
 14.1180 +
 14.1181 +
 14.1182 +\noindent{\bf Arguments:}
 14.1183 +
 14.1184 + 
 14.1185 +\vspace{0.3cm}
 14.1186 +\begin{tabular}{|c|c|p{7cm}|}
 14.1187 + \hline
 14.1188 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1189 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1190 +
 14.1191 +{\tt int } & value & New value to set \\ \hline 
 14.1192 +
 14.1193 +\end{tabular}
 14.1194 +
 14.1195 +\vspace{0.3cm}
 14.1196 +
 14.1197 + \noindent {\bf Return Type:} 
 14.1198 +{\tt 
 14.1199 +void
 14.1200 +}
 14.1201 +
 14.1202 +
 14.1203 +
 14.1204 +\vspace{0.3cm}
 14.1205 +\vspace{0.3cm}
 14.1206 +\vspace{0.3cm}
 14.1207  \subsubsection{RPC name:~get\_VCPUs\_utilisation}
 14.1208  
 14.1209  {\bf Overview:} 
 14.1210 -get accessor message derived from field VCPUs/utilisation of object VM
 14.1211 +Get the VCPUs/utilisation field of the given VM.
 14.1212  
 14.1213   \noindent {\bf Signature:} 
 14.1214  \begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM ref self)\end{verbatim}
 14.1215 @@ -2087,7 +2452,7 @@ get accessor message derived from field 
 14.1216  \begin{tabular}{|c|c|p{7cm}|}
 14.1217   \hline
 14.1218  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1219 -{\tt VM ref } & self & object instance \\ \hline 
 14.1220 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1221  
 14.1222  \end{tabular}
 14.1223  
 14.1224 @@ -2106,7 +2471,7 @@ value of the field
 14.1225  \subsubsection{RPC name:~get\_VCPUs\_features\_required}
 14.1226  
 14.1227  {\bf Overview:} 
 14.1228 -get accessor message derived from field VCPUs/features/required of object VM
 14.1229 +Get the VCPUs/features/required field of the given VM.
 14.1230  
 14.1231   \noindent {\bf Signature:} 
 14.1232  \begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_required (session_id s, VM ref self)\end{verbatim}
 14.1233 @@ -2119,7 +2484,7 @@ get accessor message derived from field 
 14.1234  \begin{tabular}{|c|c|p{7cm}|}
 14.1235   \hline
 14.1236  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1237 -{\tt VM ref } & self & object instance \\ \hline 
 14.1238 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1239  
 14.1240  \end{tabular}
 14.1241  
 14.1242 @@ -2138,7 +2503,7 @@ value of the field
 14.1243  \subsubsection{RPC name:~get\_VCPUs\_features\_can\_use}
 14.1244  
 14.1245  {\bf Overview:} 
 14.1246 -get accessor message derived from field VCPUs/features/can\_use of object VM
 14.1247 +Get the VCPUs/features/can\_use field of the given VM.
 14.1248  
 14.1249   \noindent {\bf Signature:} 
 14.1250  \begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_can_use (session_id s, VM ref self)\end{verbatim}
 14.1251 @@ -2151,7 +2516,7 @@ get accessor message derived from field 
 14.1252  \begin{tabular}{|c|c|p{7cm}|}
 14.1253   \hline
 14.1254  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1255 -{\tt VM ref } & self & object instance \\ \hline 
 14.1256 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1257  
 14.1258  \end{tabular}
 14.1259  
 14.1260 @@ -2170,7 +2535,7 @@ value of the field
 14.1261  \subsubsection{RPC name:~get\_VCPUs\_features\_force\_on}
 14.1262  
 14.1263  {\bf Overview:} 
 14.1264 -get accessor message derived from field VCPUs/features/force\_on of object VM
 14.1265 +Get the VCPUs/features/force\_on field of the given VM.
 14.1266  
 14.1267   \noindent {\bf Signature:} 
 14.1268  \begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_force_on (session_id s, VM ref self)\end{verbatim}
 14.1269 @@ -2183,7 +2548,7 @@ get accessor message derived from field 
 14.1270  \begin{tabular}{|c|c|p{7cm}|}
 14.1271   \hline
 14.1272  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1273 -{\tt VM ref } & self & object instance \\ \hline 
 14.1274 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1275  
 14.1276  \end{tabular}
 14.1277  
 14.1278 @@ -2199,6 +2564,40 @@ value of the field
 14.1279  \vspace{0.3cm}
 14.1280  \vspace{0.3cm}
 14.1281  \vspace{0.3cm}
 14.1282 +\subsubsection{RPC name:~set\_VCPUs\_features\_force\_on}
 14.1283 +
 14.1284 +{\bf Overview:} 
 14.1285 +Set the VCPUs/features/force\_on field of the given VM.
 14.1286 +
 14.1287 + \noindent {\bf Signature:} 
 14.1288 +\begin{verbatim} void set_VCPUs_features_force_on (session_id s, VM ref self, (cpu_feature) Set value)\end{verbatim}
 14.1289 +
 14.1290 +
 14.1291 +\noindent{\bf Arguments:}
 14.1292 +
 14.1293 + 
 14.1294 +\vspace{0.3cm}
 14.1295 +\begin{tabular}{|c|c|p{7cm}|}
 14.1296 + \hline
 14.1297 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1298 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1299 +
 14.1300 +{\tt (cpu\_feature) Set } & value & New value to set \\ \hline 
 14.1301 +
 14.1302 +\end{tabular}
 14.1303 +
 14.1304 +\vspace{0.3cm}
 14.1305 +
 14.1306 + \noindent {\bf Return Type:} 
 14.1307 +{\tt 
 14.1308 +void
 14.1309 +}
 14.1310 +
 14.1311 +
 14.1312 +
 14.1313 +\vspace{0.3cm}
 14.1314 +\vspace{0.3cm}
 14.1315 +\vspace{0.3cm}
 14.1316  \subsubsection{RPC name:~add\_VCPUs\_features\_force\_on}
 14.1317  
 14.1318  {\bf Overview:} 
 14.1319 @@ -2215,7 +2614,7 @@ set add message derived from field VCPUs
 14.1320  \begin{tabular}{|c|c|p{7cm}|}
 14.1321   \hline
 14.1322  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1323 -{\tt VM ref } & self & object instance \\ \hline 
 14.1324 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1325  
 14.1326  {\tt cpu\_feature } & value & New value to add \\ \hline 
 14.1327  
 14.1328 @@ -2249,7 +2648,7 @@ set remove message derived from field VC
 14.1329  \begin{tabular}{|c|c|p{7cm}|}
 14.1330   \hline
 14.1331  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1332 -{\tt VM ref } & self & object instance \\ \hline 
 14.1333 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1334  
 14.1335  {\tt cpu\_feature } & value & Value to remove \\ \hline 
 14.1336  
 14.1337 @@ -2270,7 +2669,7 @@ void
 14.1338  \subsubsection{RPC name:~get\_VCPUs\_features\_force\_off}
 14.1339  
 14.1340  {\bf Overview:} 
 14.1341 -get accessor message derived from field VCPUs/features/force\_off of object VM
 14.1342 +Get the VCPUs/features/force\_off field of the given VM.
 14.1343  
 14.1344   \noindent {\bf Signature:} 
 14.1345  \begin{verbatim} ((cpu_feature) Set) get_VCPUs_features_force_off (session_id s, VM ref self)\end{verbatim}
 14.1346 @@ -2283,7 +2682,7 @@ get accessor message derived from field 
 14.1347  \begin{tabular}{|c|c|p{7cm}|}
 14.1348   \hline
 14.1349  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1350 -{\tt VM ref } & self & object instance \\ \hline 
 14.1351 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1352  
 14.1353  \end{tabular}
 14.1354  
 14.1355 @@ -2299,6 +2698,40 @@ value of the field
 14.1356  \vspace{0.3cm}
 14.1357  \vspace{0.3cm}
 14.1358  \vspace{0.3cm}
 14.1359 +\subsubsection{RPC name:~set\_VCPUs\_features\_force\_off}
 14.1360 +
 14.1361 +{\bf Overview:} 
 14.1362 +Set the VCPUs/features/force\_off field of the given VM.
 14.1363 +
 14.1364 + \noindent {\bf Signature:} 
 14.1365 +\begin{verbatim} void set_VCPUs_features_force_off (session_id s, VM ref self, (cpu_feature) Set value)\end{verbatim}
 14.1366 +
 14.1367 +
 14.1368 +\noindent{\bf Arguments:}
 14.1369 +
 14.1370 + 
 14.1371 +\vspace{0.3cm}
 14.1372 +\begin{tabular}{|c|c|p{7cm}|}
 14.1373 + \hline
 14.1374 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1375 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1376 +
 14.1377 +{\tt (cpu\_feature) Set } & value & New value to set \\ \hline 
 14.1378 +
 14.1379 +\end{tabular}
 14.1380 +
 14.1381 +\vspace{0.3cm}
 14.1382 +
 14.1383 + \noindent {\bf Return Type:} 
 14.1384 +{\tt 
 14.1385 +void
 14.1386 +}
 14.1387 +
 14.1388 +
 14.1389 +
 14.1390 +\vspace{0.3cm}
 14.1391 +\vspace{0.3cm}
 14.1392 +\vspace{0.3cm}
 14.1393  \subsubsection{RPC name:~add\_VCPUs\_features\_force\_off}
 14.1394  
 14.1395  {\bf Overview:} 
 14.1396 @@ -2315,7 +2748,7 @@ set add message derived from field VCPUs
 14.1397  \begin{tabular}{|c|c|p{7cm}|}
 14.1398   \hline
 14.1399  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1400 -{\tt VM ref } & self & object instance \\ \hline 
 14.1401 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1402  
 14.1403  {\tt cpu\_feature } & value & New value to add \\ \hline 
 14.1404  
 14.1405 @@ -2349,7 +2782,7 @@ set remove message derived from field VC
 14.1406  \begin{tabular}{|c|c|p{7cm}|}
 14.1407   \hline
 14.1408  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1409 -{\tt VM ref } & self & object instance \\ \hline 
 14.1410 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1411  
 14.1412  {\tt cpu\_feature } & value & Value to remove \\ \hline 
 14.1413  
 14.1414 @@ -2370,7 +2803,7 @@ void
 14.1415  \subsubsection{RPC name:~get\_actions\_after\_shutdown}
 14.1416  
 14.1417  {\bf Overview:} 
 14.1418 -get accessor message derived from field actions/after\_shutdown of object VM
 14.1419 +Get the actions/after\_shutdown field of the given VM.
 14.1420  
 14.1421   \noindent {\bf Signature:} 
 14.1422  \begin{verbatim} (on_normal_exit) get_actions_after_shutdown (session_id s, VM ref self)\end{verbatim}
 14.1423 @@ -2383,7 +2816,7 @@ get accessor message derived from field 
 14.1424  \begin{tabular}{|c|c|p{7cm}|}
 14.1425   \hline
 14.1426  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1427 -{\tt VM ref } & self & object instance \\ \hline 
 14.1428 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1429  
 14.1430  \end{tabular}
 14.1431  
 14.1432 @@ -2402,7 +2835,7 @@ value of the field
 14.1433  \subsubsection{RPC name:~set\_actions\_after\_shutdown}
 14.1434  
 14.1435  {\bf Overview:} 
 14.1436 -set accessor message derived from field actions/after\_shutdown of object VM
 14.1437 +Set the actions/after\_shutdown field of the given VM.
 14.1438  
 14.1439   \noindent {\bf Signature:} 
 14.1440  \begin{verbatim} void set_actions_after_shutdown (session_id s, VM ref self, on_normal_exit value)\end{verbatim}
 14.1441 @@ -2415,7 +2848,7 @@ set accessor message derived from field 
 14.1442  \begin{tabular}{|c|c|p{7cm}|}
 14.1443   \hline
 14.1444  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1445 -{\tt VM ref } & self & object instance \\ \hline 
 14.1446 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1447  
 14.1448  {\tt on\_normal\_exit } & value & New value to set \\ \hline 
 14.1449  
 14.1450 @@ -2436,7 +2869,7 @@ void
 14.1451  \subsubsection{RPC name:~get\_actions\_after\_reboot}
 14.1452  
 14.1453  {\bf Overview:} 
 14.1454 -get accessor message derived from field actions/after\_reboot of object VM
 14.1455 +Get the actions/after\_reboot field of the given VM.
 14.1456  
 14.1457   \noindent {\bf Signature:} 
 14.1458  \begin{verbatim} (on_normal_exit) get_actions_after_reboot (session_id s, VM ref self)\end{verbatim}
 14.1459 @@ -2449,7 +2882,7 @@ get accessor message derived from field 
 14.1460  \begin{tabular}{|c|c|p{7cm}|}
 14.1461   \hline
 14.1462  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1463 -{\tt VM ref } & self & object instance \\ \hline 
 14.1464 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1465  
 14.1466  \end{tabular}
 14.1467  
 14.1468 @@ -2468,7 +2901,7 @@ value of the field
 14.1469  \subsubsection{RPC name:~set\_actions\_after\_reboot}
 14.1470  
 14.1471  {\bf Overview:} 
 14.1472 -set accessor message derived from field actions/after\_reboot of object VM
 14.1473 +Set the actions/after\_reboot field of the given VM.
 14.1474  
 14.1475   \noindent {\bf Signature:} 
 14.1476  \begin{verbatim} void set_actions_after_reboot (session_id s, VM ref self, on_normal_exit value)\end{verbatim}
 14.1477 @@ -2481,7 +2914,7 @@ set accessor message derived from field 
 14.1478  \begin{tabular}{|c|c|p{7cm}|}
 14.1479   \hline
 14.1480  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1481 -{\tt VM ref } & self & object instance \\ \hline 
 14.1482 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1483  
 14.1484  {\tt on\_normal\_exit } & value & New value to set \\ \hline 
 14.1485  
 14.1486 @@ -2502,7 +2935,7 @@ void
 14.1487  \subsubsection{RPC name:~get\_actions\_after\_suspend}
 14.1488  
 14.1489  {\bf Overview:} 
 14.1490 -get accessor message derived from field actions/after\_suspend of object VM
 14.1491 +Get the actions/after\_suspend field of the given VM.
 14.1492  
 14.1493   \noindent {\bf Signature:} 
 14.1494  \begin{verbatim} (on_normal_exit) get_actions_after_suspend (session_id s, VM ref self)\end{verbatim}
 14.1495 @@ -2515,7 +2948,7 @@ get accessor message derived from field 
 14.1496  \begin{tabular}{|c|c|p{7cm}|}
 14.1497   \hline
 14.1498  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1499 -{\tt VM ref } & self & object instance \\ \hline 
 14.1500 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1501  
 14.1502  \end{tabular}
 14.1503  
 14.1504 @@ -2534,7 +2967,7 @@ value of the field
 14.1505  \subsubsection{RPC name:~set\_actions\_after\_suspend}
 14.1506  
 14.1507  {\bf Overview:} 
 14.1508 -set accessor message derived from field actions/after\_suspend of object VM
 14.1509 +Set the actions/after\_suspend field of the given VM.
 14.1510  
 14.1511   \noindent {\bf Signature:} 
 14.1512  \begin{verbatim} void set_actions_after_suspend (session_id s, VM ref self, on_normal_exit value)\end{verbatim}
 14.1513 @@ -2547,7 +2980,7 @@ set accessor message derived from field 
 14.1514  \begin{tabular}{|c|c|p{7cm}|}
 14.1515   \hline
 14.1516  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1517 -{\tt VM ref } & self & object instance \\ \hline 
 14.1518 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1519  
 14.1520  {\tt on\_normal\_exit } & value & New value to set \\ \hline 
 14.1521  
 14.1522 @@ -2568,7 +3001,7 @@ void
 14.1523  \subsubsection{RPC name:~get\_actions\_after\_crash}
 14.1524  
 14.1525  {\bf Overview:} 
 14.1526 -get accessor message derived from field actions/after\_crash of object VM
 14.1527 +Get the actions/after\_crash field of the given VM.
 14.1528  
 14.1529   \noindent {\bf Signature:} 
 14.1530  \begin{verbatim} (on_crash_behaviour) get_actions_after_crash (session_id s, VM ref self)\end{verbatim}
 14.1531 @@ -2581,7 +3014,7 @@ get accessor message derived from field 
 14.1532  \begin{tabular}{|c|c|p{7cm}|}
 14.1533   \hline
 14.1534  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1535 -{\tt VM ref } & self & object instance \\ \hline 
 14.1536 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1537  
 14.1538  \end{tabular}
 14.1539  
 14.1540 @@ -2600,7 +3033,7 @@ value of the field
 14.1541  \subsubsection{RPC name:~set\_actions\_after\_crash}
 14.1542  
 14.1543  {\bf Overview:} 
 14.1544 -set accessor message derived from field actions/after\_crash of object VM
 14.1545 +Set the actions/after\_crash field of the given VM.
 14.1546  
 14.1547   \noindent {\bf Signature:} 
 14.1548  \begin{verbatim} void set_actions_after_crash (session_id s, VM ref self, on_crash_behaviour value)\end{verbatim}
 14.1549 @@ -2613,7 +3046,7 @@ set accessor message derived from field 
 14.1550  \begin{tabular}{|c|c|p{7cm}|}
 14.1551   \hline
 14.1552  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1553 -{\tt VM ref } & self & object instance \\ \hline 
 14.1554 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1555  
 14.1556  {\tt on\_crash\_behaviour } & value & New value to set \\ \hline 
 14.1557  
 14.1558 @@ -2631,10 +3064,42 @@ void
 14.1559  \vspace{0.3cm}
 14.1560  \vspace{0.3cm}
 14.1561  \vspace{0.3cm}
 14.1562 +\subsubsection{RPC name:~get\_consoles}
 14.1563 +
 14.1564 +{\bf Overview:} 
 14.1565 +Get the consoles field of the given VM.
 14.1566 +
 14.1567 + \noindent {\bf Signature:} 
 14.1568 +\begin{verbatim} ((console ref) Set) get_consoles (session_id s, VM ref self)\end{verbatim}
 14.1569 +
 14.1570 +
 14.1571 +\noindent{\bf Arguments:}
 14.1572 +
 14.1573 + 
 14.1574 +\vspace{0.3cm}
 14.1575 +\begin{tabular}{|c|c|p{7cm}|}
 14.1576 + \hline
 14.1577 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1578 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1579 +
 14.1580 +\end{tabular}
 14.1581 +
 14.1582 +\vspace{0.3cm}
 14.1583 +
 14.1584 + \noindent {\bf Return Type:} 
 14.1585 +{\tt 
 14.1586 +(console ref) Set
 14.1587 +}
 14.1588 +
 14.1589 +
 14.1590 +value of the field
 14.1591 +\vspace{0.3cm}
 14.1592 +\vspace{0.3cm}
 14.1593 +\vspace{0.3cm}
 14.1594  \subsubsection{RPC name:~get\_VIFs}
 14.1595  
 14.1596  {\bf Overview:} 
 14.1597 -get accessor message derived from field VIFs of object VM
 14.1598 +Get the VIFs field of the given VM.
 14.1599  
 14.1600   \noindent {\bf Signature:} 
 14.1601  \begin{verbatim} ((VIF ref) Set) get_VIFs (session_id s, VM ref self)\end{verbatim}
 14.1602 @@ -2647,7 +3112,7 @@ get accessor message derived from field 
 14.1603  \begin{tabular}{|c|c|p{7cm}|}
 14.1604   \hline
 14.1605  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1606 -{\tt VM ref } & self & object instance \\ \hline 
 14.1607 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1608  
 14.1609  \end{tabular}
 14.1610  
 14.1611 @@ -2666,7 +3131,7 @@ value of the field
 14.1612  \subsubsection{RPC name:~get\_VBDs}
 14.1613  
 14.1614  {\bf Overview:} 
 14.1615 -get accessor message derived from field VBDs of object VM
 14.1616 +Get the VBDs field of the given VM.
 14.1617  
 14.1618   \noindent {\bf Signature:} 
 14.1619  \begin{verbatim} ((VBD ref) Set) get_VBDs (session_id s, VM ref self)\end{verbatim}
 14.1620 @@ -2679,7 +3144,7 @@ get accessor message derived from field 
 14.1621  \begin{tabular}{|c|c|p{7cm}|}
 14.1622   \hline
 14.1623  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1624 -{\tt VM ref } & self & object instance \\ \hline 
 14.1625 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1626  
 14.1627  \end{tabular}
 14.1628  
 14.1629 @@ -2698,7 +3163,7 @@ value of the field
 14.1630  \subsubsection{RPC name:~get\_VTPMs}
 14.1631  
 14.1632  {\bf Overview:} 
 14.1633 -get accessor message derived from field VTPMs of object VM
 14.1634 +Get the VTPMs field of the given VM.
 14.1635  
 14.1636   \noindent {\bf Signature:} 
 14.1637  \begin{verbatim} ((VTPM ref) Set) get_VTPMs (session_id s, VM ref self)\end{verbatim}
 14.1638 @@ -2711,7 +3176,7 @@ get accessor message derived from field 
 14.1639  \begin{tabular}{|c|c|p{7cm}|}
 14.1640   \hline
 14.1641  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1642 -{\tt VM ref } & self & object instance \\ \hline 
 14.1643 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1644  
 14.1645  \end{tabular}
 14.1646  
 14.1647 @@ -2730,7 +3195,7 @@ value of the field
 14.1648  \subsubsection{RPC name:~get\_bios\_boot}
 14.1649  
 14.1650  {\bf Overview:} 
 14.1651 -get accessor message derived from field bios/boot of object VM
 14.1652 +Get the bios/boot field of the given VM.
 14.1653  
 14.1654   \noindent {\bf Signature:} 
 14.1655  \begin{verbatim} string get_bios_boot (session_id s, VM ref self)\end{verbatim}
 14.1656 @@ -2743,7 +3208,7 @@ get accessor message derived from field 
 14.1657  \begin{tabular}{|c|c|p{7cm}|}
 14.1658   \hline
 14.1659  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1660 -{\tt VM ref } & self & object instance \\ \hline 
 14.1661 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1662  
 14.1663  \end{tabular}
 14.1664  
 14.1665 @@ -2762,7 +3227,7 @@ value of the field
 14.1666  \subsubsection{RPC name:~set\_bios\_boot}
 14.1667  
 14.1668  {\bf Overview:} 
 14.1669 -set accessor message derived from field bios/boot of object VM
 14.1670 +Set the bios/boot field of the given VM.
 14.1671  
 14.1672   \noindent {\bf Signature:} 
 14.1673  \begin{verbatim} void set_bios_boot (session_id s, VM ref self, string value)\end{verbatim}
 14.1674 @@ -2775,7 +3240,7 @@ set accessor message derived from field 
 14.1675  \begin{tabular}{|c|c|p{7cm}|}
 14.1676   \hline
 14.1677  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1678 -{\tt VM ref } & self & object instance \\ \hline 
 14.1679 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1680  
 14.1681  {\tt string } & value & New value to set \\ \hline 
 14.1682  
 14.1683 @@ -2796,7 +3261,7 @@ void
 14.1684  \subsubsection{RPC name:~get\_platform\_std\_VGA}
 14.1685  
 14.1686  {\bf Overview:} 
 14.1687 -get accessor message derived from field platform/std\_VGA of object VM
 14.1688 +Get the platform/std\_VGA field of the given VM.
 14.1689  
 14.1690   \noindent {\bf Signature:} 
 14.1691  \begin{verbatim} bool get_platform_std_VGA (session_id s, VM ref self)\end{verbatim}
 14.1692 @@ -2809,7 +3274,7 @@ get accessor message derived from field 
 14.1693  \begin{tabular}{|c|c|p{7cm}|}
 14.1694   \hline
 14.1695  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1696 -{\tt VM ref } & self & object instance \\ \hline 
 14.1697 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1698  
 14.1699  \end{tabular}
 14.1700  
 14.1701 @@ -2828,7 +3293,7 @@ value of the field
 14.1702  \subsubsection{RPC name:~set\_platform\_std\_VGA}
 14.1703  
 14.1704  {\bf Overview:} 
 14.1705 -set accessor message derived from field platform/std\_VGA of object VM
 14.1706 +Set the platform/std\_VGA field of the given VM.
 14.1707  
 14.1708   \noindent {\bf Signature:} 
 14.1709  \begin{verbatim} void set_platform_std_VGA (session_id s, VM ref self, bool value)\end{verbatim}
 14.1710 @@ -2841,7 +3306,7 @@ set accessor message derived from field 
 14.1711  \begin{tabular}{|c|c|p{7cm}|}
 14.1712   \hline
 14.1713  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1714 -{\tt VM ref } & self & object instance \\ \hline 
 14.1715 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1716  
 14.1717  {\tt bool } & value & New value to set \\ \hline 
 14.1718  
 14.1719 @@ -2862,7 +3327,7 @@ void
 14.1720  \subsubsection{RPC name:~get\_platform\_serial}
 14.1721  
 14.1722  {\bf Overview:} 
 14.1723 -get accessor message derived from field platform/serial of object VM
 14.1724 +Get the platform/serial field of the given VM.
 14.1725  
 14.1726   \noindent {\bf Signature:} 
 14.1727  \begin{verbatim} string get_platform_serial (session_id s, VM ref self)\end{verbatim}
 14.1728 @@ -2875,7 +3340,7 @@ get accessor message derived from field 
 14.1729  \begin{tabular}{|c|c|p{7cm}|}
 14.1730   \hline
 14.1731  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1732 -{\tt VM ref } & self & object instance \\ \hline 
 14.1733 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1734  
 14.1735  \end{tabular}
 14.1736  
 14.1737 @@ -2894,7 +3359,7 @@ value of the field
 14.1738  \subsubsection{RPC name:~set\_platform\_serial}
 14.1739  
 14.1740  {\bf Overview:} 
 14.1741 -set accessor message derived from field platform/serial of object VM
 14.1742 +Set the platform/serial field of the given VM.
 14.1743  
 14.1744   \noindent {\bf Signature:} 
 14.1745  \begin{verbatim} void set_platform_serial (session_id s, VM ref self, string value)\end{verbatim}
 14.1746 @@ -2907,7 +3372,7 @@ set accessor message derived from field 
 14.1747  \begin{tabular}{|c|c|p{7cm}|}
 14.1748   \hline
 14.1749  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1750 -{\tt VM ref } & self & object instance \\ \hline 
 14.1751 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1752  
 14.1753  {\tt string } & value & New value to set \\ \hline 
 14.1754  
 14.1755 @@ -2928,7 +3393,7 @@ void
 14.1756  \subsubsection{RPC name:~get\_platform\_localtime}
 14.1757  
 14.1758  {\bf Overview:} 
 14.1759 -get accessor message derived from field platform/localtime of object VM
 14.1760 +Get the platform/localtime field of the given VM.
 14.1761  
 14.1762   \noindent {\bf Signature:} 
 14.1763  \begin{verbatim} bool get_platform_localtime (session_id s, VM ref self)\end{verbatim}
 14.1764 @@ -2941,7 +3406,7 @@ get accessor message derived from field 
 14.1765  \begin{tabular}{|c|c|p{7cm}|}
 14.1766   \hline
 14.1767  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1768 -{\tt VM ref } & self & object instance \\ \hline 
 14.1769 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1770  
 14.1771  \end{tabular}
 14.1772  
 14.1773 @@ -2960,7 +3425,7 @@ value of the field
 14.1774  \subsubsection{RPC name:~set\_platform\_localtime}
 14.1775  
 14.1776  {\bf Overview:} 
 14.1777 -set accessor message derived from field platform/localtime of object VM
 14.1778 +Set the platform/localtime field of the given VM.
 14.1779  
 14.1780   \noindent {\bf Signature:} 
 14.1781  \begin{verbatim} void set_platform_localtime (session_id s, VM ref self, bool value)\end{verbatim}
 14.1782 @@ -2973,7 +3438,7 @@ set accessor message derived from field 
 14.1783  \begin{tabular}{|c|c|p{7cm}|}
 14.1784   \hline
 14.1785  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1786 -{\tt VM ref } & self & object instance \\ \hline 
 14.1787 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1788  
 14.1789  {\tt bool } & value & New value to set \\ \hline 
 14.1790  
 14.1791 @@ -2994,7 +3459,7 @@ void
 14.1792  \subsubsection{RPC name:~get\_platform\_clock\_offset}
 14.1793  
 14.1794  {\bf Overview:} 
 14.1795 -get accessor message derived from field platform/clock\_offset of object VM
 14.1796 +Get the platform/clock\_offset field of the given VM.
 14.1797  
 14.1798   \noindent {\bf Signature:} 
 14.1799  \begin{verbatim} bool get_platform_clock_offset (session_id s, VM ref self)\end{verbatim}
 14.1800 @@ -3007,7 +3472,7 @@ get accessor message derived from field 
 14.1801  \begin{tabular}{|c|c|p{7cm}|}
 14.1802   \hline
 14.1803  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1804 -{\tt VM ref } & self & object instance \\ \hline 
 14.1805 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1806  
 14.1807  \end{tabular}
 14.1808  
 14.1809 @@ -3026,7 +3491,7 @@ value of the field
 14.1810  \subsubsection{RPC name:~set\_platform\_clock\_offset}
 14.1811  
 14.1812  {\bf Overview:} 
 14.1813 -set accessor message derived from field platform/clock\_offset of object VM
 14.1814 +Set the platform/clock\_offset field of the given VM.
 14.1815  
 14.1816   \noindent {\bf Signature:} 
 14.1817  \begin{verbatim} void set_platform_clock_offset (session_id s, VM ref self, bool value)\end{verbatim}
 14.1818 @@ -3039,7 +3504,7 @@ set accessor message derived from field 
 14.1819  \begin{tabular}{|c|c|p{7cm}|}
 14.1820   \hline
 14.1821  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1822 -{\tt VM ref } & self & object instance \\ \hline 
 14.1823 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1824  
 14.1825  {\tt bool } & value & New value to set \\ \hline 
 14.1826  
 14.1827 @@ -3060,7 +3525,7 @@ void
 14.1828  \subsubsection{RPC name:~get\_platform\_enable\_audio}
 14.1829  
 14.1830  {\bf Overview:} 
 14.1831 -get accessor message derived from field platform/enable\_audio of object VM
 14.1832 +Get the platform/enable\_audio field of the given VM.
 14.1833  
 14.1834   \noindent {\bf Signature:} 
 14.1835  \begin{verbatim} bool get_platform_enable_audio (session_id s, VM ref self)\end{verbatim}
 14.1836 @@ -3073,7 +3538,7 @@ get accessor message derived from field 
 14.1837  \begin{tabular}{|c|c|p{7cm}|}
 14.1838   \hline
 14.1839  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1840 -{\tt VM ref } & self & object instance \\ \hline 
 14.1841 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1842  
 14.1843  \end{tabular}
 14.1844  
 14.1845 @@ -3092,7 +3557,7 @@ value of the field
 14.1846  \subsubsection{RPC name:~set\_platform\_enable\_audio}
 14.1847  
 14.1848  {\bf Overview:} 
 14.1849 -set accessor message derived from field platform/enable\_audio of object VM
 14.1850 +Set the platform/enable\_audio field of the given VM.
 14.1851  
 14.1852   \noindent {\bf Signature:} 
 14.1853  \begin{verbatim} void set_platform_enable_audio (session_id s, VM ref self, bool value)\end{verbatim}
 14.1854 @@ -3105,7 +3570,7 @@ set accessor message derived from field 
 14.1855  \begin{tabular}{|c|c|p{7cm}|}
 14.1856   \hline
 14.1857  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1858 -{\tt VM ref } & self & object instance \\ \hline 
 14.1859 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1860  
 14.1861  {\tt bool } & value & New value to set \\ \hline 
 14.1862  
 14.1863 @@ -3126,7 +3591,7 @@ void
 14.1864  \subsubsection{RPC name:~get\_builder}
 14.1865  
 14.1866  {\bf Overview:} 
 14.1867 -get accessor message derived from field builder of object VM
 14.1868 +Get the builder field of the given VM.
 14.1869  
 14.1870   \noindent {\bf Signature:} 
 14.1871  \begin{verbatim} string get_builder (session_id s, VM ref self)\end{verbatim}
 14.1872 @@ -3139,7 +3604,7 @@ get accessor message derived from field 
 14.1873  \begin{tabular}{|c|c|p{7cm}|}
 14.1874   \hline
 14.1875  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1876 -{\tt VM ref } & self & object instance \\ \hline 
 14.1877 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1878  
 14.1879  \end{tabular}
 14.1880  
 14.1881 @@ -3158,7 +3623,7 @@ value of the field
 14.1882  \subsubsection{RPC name:~set\_builder}
 14.1883  
 14.1884  {\bf Overview:} 
 14.1885 -set accessor message derived from field builder of object VM
 14.1886 +Set the builder field of the given VM.
 14.1887  
 14.1888   \noindent {\bf Signature:} 
 14.1889  \begin{verbatim} void set_builder (session_id s, VM ref self, string value)\end{verbatim}
 14.1890 @@ -3171,7 +3636,7 @@ set accessor message derived from field 
 14.1891  \begin{tabular}{|c|c|p{7cm}|}
 14.1892   \hline
 14.1893  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1894 -{\tt VM ref } & self & object instance \\ \hline 
 14.1895 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1896  
 14.1897  {\tt string } & value & New value to set \\ \hline 
 14.1898  
 14.1899 @@ -3192,7 +3657,7 @@ void
 14.1900  \subsubsection{RPC name:~get\_boot\_method}
 14.1901  
 14.1902  {\bf Overview:} 
 14.1903 -get accessor message derived from field boot\_method of object VM
 14.1904 +Get the boot\_method field of the given VM.
 14.1905  
 14.1906   \noindent {\bf Signature:} 
 14.1907  \begin{verbatim} (boot_type) get_boot_method (session_id s, VM ref self)\end{verbatim}
 14.1908 @@ -3205,7 +3670,7 @@ get accessor message derived from field 
 14.1909  \begin{tabular}{|c|c|p{7cm}|}
 14.1910   \hline
 14.1911  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1912 -{\tt VM ref } & self & object instance \\ \hline 
 14.1913 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1914  
 14.1915  \end{tabular}
 14.1916  
 14.1917 @@ -3224,7 +3689,7 @@ value of the field
 14.1918  \subsubsection{RPC name:~set\_boot\_method}
 14.1919  
 14.1920  {\bf Overview:} 
 14.1921 -set accessor message derived from field boot\_method of object VM
 14.1922 +Set the boot\_method field of the given VM.
 14.1923  
 14.1924   \noindent {\bf Signature:} 
 14.1925  \begin{verbatim} void set_boot_method (session_id s, VM ref self, boot_type value)\end{verbatim}
 14.1926 @@ -3237,7 +3702,7 @@ set accessor message derived from field 
 14.1927  \begin{tabular}{|c|c|p{7cm}|}
 14.1928   \hline
 14.1929  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1930 -{\tt VM ref } & self & object instance \\ \hline 
 14.1931 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1932  
 14.1933  {\tt boot\_type } & value & New value to set \\ \hline 
 14.1934  
 14.1935 @@ -3258,7 +3723,7 @@ void
 14.1936  \subsubsection{RPC name:~get\_kernel\_kernel}
 14.1937  
 14.1938  {\bf Overview:} 
 14.1939 -get accessor message derived from field kernel/kernel of object VM
 14.1940 +Get the kernel/kernel field of the given VM.
 14.1941  
 14.1942   \noindent {\bf Signature:} 
 14.1943  \begin{verbatim} string get_kernel_kernel (session_id s, VM ref self)\end{verbatim}
 14.1944 @@ -3271,7 +3736,7 @@ get accessor message derived from field 
 14.1945  \begin{tabular}{|c|c|p{7cm}|}
 14.1946   \hline
 14.1947  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1948 -{\tt VM ref } & self & object instance \\ \hline 
 14.1949 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1950  
 14.1951  \end{tabular}
 14.1952  
 14.1953 @@ -3290,7 +3755,7 @@ value of the field
 14.1954  \subsubsection{RPC name:~set\_kernel\_kernel}
 14.1955  
 14.1956  {\bf Overview:} 
 14.1957 -set accessor message derived from field kernel/kernel of object VM
 14.1958 +Set the kernel/kernel field of the given VM.
 14.1959  
 14.1960   \noindent {\bf Signature:} 
 14.1961  \begin{verbatim} void set_kernel_kernel (session_id s, VM ref self, string value)\end{verbatim}
 14.1962 @@ -3303,7 +3768,7 @@ set accessor message derived from field 
 14.1963  \begin{tabular}{|c|c|p{7cm}|}
 14.1964   \hline
 14.1965  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1966 -{\tt VM ref } & self & object instance \\ \hline 
 14.1967 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1968  
 14.1969  {\tt string } & value & New value to set \\ \hline 
 14.1970  
 14.1971 @@ -3324,7 +3789,7 @@ void
 14.1972  \subsubsection{RPC name:~get\_kernel\_initrd}
 14.1973  
 14.1974  {\bf Overview:} 
 14.1975 -get accessor message derived from field kernel/initrd of object VM
 14.1976 +Get the kernel/initrd field of the given VM.
 14.1977  
 14.1978   \noindent {\bf Signature:} 
 14.1979  \begin{verbatim} string get_kernel_initrd (session_id s, VM ref self)\end{verbatim}
 14.1980 @@ -3337,7 +3802,7 @@ get accessor message derived from field 
 14.1981  \begin{tabular}{|c|c|p{7cm}|}
 14.1982   \hline
 14.1983  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.1984 -{\tt VM ref } & self & object instance \\ \hline 
 14.1985 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.1986  
 14.1987  \end{tabular}
 14.1988  
 14.1989 @@ -3356,7 +3821,7 @@ value of the field
 14.1990  \subsubsection{RPC name:~set\_kernel\_initrd}
 14.1991  
 14.1992  {\bf Overview:} 
 14.1993 -set accessor message derived from field kernel/initrd of object VM
 14.1994 +Set the kernel/initrd field of the given VM.
 14.1995  
 14.1996   \noindent {\bf Signature:} 
 14.1997  \begin{verbatim} void set_kernel_initrd (session_id s, VM ref self, string value)\end{verbatim}
 14.1998 @@ -3369,7 +3834,7 @@ set accessor message derived from field 
 14.1999  \begin{tabular}{|c|c|p{7cm}|}
 14.2000   \hline
 14.2001  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2002 -{\tt VM ref } & self & object instance \\ \hline 
 14.2003 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2004  
 14.2005  {\tt string } & value & New value to set \\ \hline 
 14.2006  
 14.2007 @@ -3390,7 +3855,7 @@ void
 14.2008  \subsubsection{RPC name:~get\_kernel\_args}
 14.2009  
 14.2010  {\bf Overview:} 
 14.2011 -get accessor message derived from field kernel/args of object VM
 14.2012 +Get the kernel/args field of the given VM.
 14.2013  
 14.2014   \noindent {\bf Signature:} 
 14.2015  \begin{verbatim} string get_kernel_args (session_id s, VM ref self)\end{verbatim}
 14.2016 @@ -3403,7 +3868,7 @@ get accessor message derived from field 
 14.2017  \begin{tabular}{|c|c|p{7cm}|}
 14.2018   \hline
 14.2019  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2020 -{\tt VM ref } & self & object instance \\ \hline 
 14.2021 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2022  
 14.2023  \end{tabular}
 14.2024  
 14.2025 @@ -3422,7 +3887,7 @@ value of the field
 14.2026  \subsubsection{RPC name:~set\_kernel\_args}
 14.2027  
 14.2028  {\bf Overview:} 
 14.2029 -set accessor message derived from field kernel/args of object VM
 14.2030 +Set the kernel/args field of the given VM.
 14.2031  
 14.2032   \noindent {\bf Signature:} 
 14.2033  \begin{verbatim} void set_kernel_args (session_id s, VM ref self, string value)\end{verbatim}
 14.2034 @@ -3435,7 +3900,7 @@ set accessor message derived from field 
 14.2035  \begin{tabular}{|c|c|p{7cm}|}
 14.2036   \hline
 14.2037  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2038 -{\tt VM ref } & self & object instance \\ \hline 
 14.2039 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2040  
 14.2041  {\tt string } & value & New value to set \\ \hline 
 14.2042  
 14.2043 @@ -3456,7 +3921,7 @@ void
 14.2044  \subsubsection{RPC name:~get\_grub\_cmdline}
 14.2045  
 14.2046  {\bf Overview:} 
 14.2047 -get accessor message derived from field grub/cmdline of object VM
 14.2048 +Get the grub/cmdline field of the given VM.
 14.2049  
 14.2050   \noindent {\bf Signature:} 
 14.2051  \begin{verbatim} string get_grub_cmdline (session_id s, VM ref self)\end{verbatim}
 14.2052 @@ -3469,7 +3934,7 @@ get accessor message derived from field 
 14.2053  \begin{tabular}{|c|c|p{7cm}|}
 14.2054   \hline
 14.2055  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2056 -{\tt VM ref } & self & object instance \\ \hline 
 14.2057 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2058  
 14.2059  \end{tabular}
 14.2060  
 14.2061 @@ -3488,7 +3953,7 @@ value of the field
 14.2062  \subsubsection{RPC name:~set\_grub\_cmdline}
 14.2063  
 14.2064  {\bf Overview:} 
 14.2065 -set accessor message derived from field grub/cmdline of object VM
 14.2066 +Set the grub/cmdline field of the given VM.
 14.2067  
 14.2068   \noindent {\bf Signature:} 
 14.2069  \begin{verbatim} void set_grub_cmdline (session_id s, VM ref self, string value)\end{verbatim}
 14.2070 @@ -3501,7 +3966,7 @@ set accessor message derived from field 
 14.2071  \begin{tabular}{|c|c|p{7cm}|}
 14.2072   \hline
 14.2073  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2074 -{\tt VM ref } & self & object instance \\ \hline 
 14.2075 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2076  
 14.2077  {\tt string } & value & New value to set \\ \hline 
 14.2078  
 14.2079 @@ -3522,7 +3987,7 @@ void
 14.2080  \subsubsection{RPC name:~get\_PCI\_bus}
 14.2081  
 14.2082  {\bf Overview:} 
 14.2083 -get accessor message derived from field PCI\_bus of object VM
 14.2084 +Get the PCI\_bus field of the given VM.
 14.2085  
 14.2086   \noindent {\bf Signature:} 
 14.2087  \begin{verbatim} string get_PCI_bus (session_id s, VM ref self)\end{verbatim}
 14.2088 @@ -3535,7 +4000,7 @@ get accessor message derived from field 
 14.2089  \begin{tabular}{|c|c|p{7cm}|}
 14.2090   \hline
 14.2091  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2092 -{\tt VM ref } & self & object instance \\ \hline 
 14.2093 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2094  
 14.2095  \end{tabular}
 14.2096  
 14.2097 @@ -3554,7 +4019,7 @@ value of the field
 14.2098  \subsubsection{RPC name:~get\_tools\_version}
 14.2099  
 14.2100  {\bf Overview:} 
 14.2101 -get accessor message derived from field tools\_version of object VM
 14.2102 +Get the tools\_version field of the given VM.
 14.2103  
 14.2104   \noindent {\bf Signature:} 
 14.2105  \begin{verbatim} ((string -> string) Map) get_tools_version (session_id s, VM ref self)\end{verbatim}
 14.2106 @@ -3567,7 +4032,7 @@ get accessor message derived from field 
 14.2107  \begin{tabular}{|c|c|p{7cm}|}
 14.2108   \hline
 14.2109  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2110 -{\tt VM ref } & self & object instance \\ \hline 
 14.2111 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2112  
 14.2113  \end{tabular}
 14.2114  
 14.2115 @@ -3586,7 +4051,7 @@ value of the field
 14.2116  \subsubsection{RPC name:~get\_otherConfig}
 14.2117  
 14.2118  {\bf Overview:} 
 14.2119 -get accessor message derived from field otherConfig of object VM
 14.2120 +Get the otherConfig field of the given VM.
 14.2121  
 14.2122   \noindent {\bf Signature:} 
 14.2123  \begin{verbatim} ((string -> string) Map) get_otherConfig (session_id s, VM ref self)\end{verbatim}
 14.2124 @@ -3599,7 +4064,7 @@ get accessor message derived from field 
 14.2125  \begin{tabular}{|c|c|p{7cm}|}
 14.2126   \hline
 14.2127  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2128 -{\tt VM ref } & self & object instance \\ \hline 
 14.2129 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2130  
 14.2131  \end{tabular}
 14.2132  
 14.2133 @@ -3615,6 +4080,40 @@ value of the field
 14.2134  \vspace{0.3cm}
 14.2135  \vspace{0.3cm}
 14.2136  \vspace{0.3cm}
 14.2137 +\subsubsection{RPC name:~set\_otherConfig}
 14.2138 +
 14.2139 +{\bf Overview:} 
 14.2140 +Set the otherConfig field of the given VM.
 14.2141 +
 14.2142 + \noindent {\bf Signature:} 
 14.2143 +\begin{verbatim} void set_otherConfig (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
 14.2144 +
 14.2145 +
 14.2146 +\noindent{\bf Arguments:}
 14.2147 +
 14.2148 + 
 14.2149 +\vspace{0.3cm}
 14.2150 +\begin{tabular}{|c|c|p{7cm}|}
 14.2151 + \hline
 14.2152 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2153 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2154 +
 14.2155 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
 14.2156 +
 14.2157 +\end{tabular}
 14.2158 +
 14.2159 +\vspace{0.3cm}
 14.2160 +
 14.2161 + \noindent {\bf Return Type:} 
 14.2162 +{\tt 
 14.2163 +void
 14.2164 +}
 14.2165 +
 14.2166 +
 14.2167 +
 14.2168 +\vspace{0.3cm}
 14.2169 +\vspace{0.3cm}
 14.2170 +\vspace{0.3cm}
 14.2171  \subsubsection{RPC name:~add\_to\_otherConfig}
 14.2172  
 14.2173  {\bf Overview:} 
 14.2174 @@ -3631,7 +4130,7 @@ map add message derived from field other
 14.2175  \begin{tabular}{|c|c|p{7cm}|}
 14.2176   \hline
 14.2177  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2178 -{\tt VM ref } & self & object instance \\ \hline 
 14.2179 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2180  
 14.2181  {\tt string } & key & Key to add \\ \hline 
 14.2182  
 14.2183 @@ -3667,7 +4166,7 @@ map remove message derived from field ot
 14.2184  \begin{tabular}{|c|c|p{7cm}|}
 14.2185   \hline
 14.2186  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2187 -{\tt VM ref } & self & object instance \\ \hline 
 14.2188 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2189  
 14.2190  {\tt string } & key & Key to remove \\ \hline 
 14.2191  
 14.2192 @@ -3688,7 +4187,7 @@ void
 14.2193  \subsubsection{RPC name:~create}
 14.2194  
 14.2195  {\bf Overview:} 
 14.2196 -constructor for class VM
 14.2197 +Create a new VM instance, and return its handle.
 14.2198  
 14.2199   \noindent {\bf Signature:} 
 14.2200  \begin{verbatim} (VM ref) create (session_id s, VM record args)\end{verbatim}
 14.2201 @@ -3720,7 +4219,7 @@ reference to the newly created object
 14.2202  \subsubsection{RPC name:~destroy}
 14.2203  
 14.2204  {\bf Overview:} 
 14.2205 -destructor for class VM
 14.2206 +Destroy the specified VM.  The VM is completely removed from the system.  This function can only be called when the VM is in the Halted State.
 14.2207  
 14.2208   \noindent {\bf Signature:} 
 14.2209  \begin{verbatim} void destroy (session_id s, VM ref self)\end{verbatim}
 14.2210 @@ -3733,7 +4232,7 @@ destructor for class VM
 14.2211  \begin{tabular}{|c|c|p{7cm}|}
 14.2212   \hline
 14.2213  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2214 -{\tt VM ref } & self & object instance \\ \hline 
 14.2215 +{\tt VM ref } & self & reference to the object \\ \hline 
 14.2216  
 14.2217  \end{tabular}
 14.2218  
 14.2219 @@ -3752,7 +4251,7 @@ void
 14.2220  \subsubsection{RPC name:~get\_by\_uuid}
 14.2221  
 14.2222  {\bf Overview:} 
 14.2223 -returns the VM instance with a particular uuid
 14.2224 +Get a reference to the VM instance with the specified UUID.
 14.2225  
 14.2226   \noindent {\bf Signature:} 
 14.2227  \begin{verbatim} (VM ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.2228 @@ -3784,7 +4283,7 @@ reference to the object
 14.2229  \subsubsection{RPC name:~get\_record}
 14.2230  
 14.2231  {\bf Overview:} 
 14.2232 -returns a record containing the state of an instance of class VM
 14.2233 +Get a record containing the current state of the given VM.
 14.2234  
 14.2235   \noindent {\bf Signature:} 
 14.2236  \begin{verbatim} (VM record) get_record (session_id s, VM ref self)\end{verbatim}
 14.2237 @@ -3816,7 +4315,7 @@ all fields from the object
 14.2238  \subsubsection{RPC name:~get\_by\_name\_label}
 14.2239  
 14.2240  {\bf Overview:} 
 14.2241 -returns the VM instance with a particular name label
 14.2242 +Get all the VM instances with the given label.
 14.2243  
 14.2244   \noindent {\bf Signature:} 
 14.2245  \begin{verbatim} ((VM ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
 14.2246 @@ -4019,7 +4518,7 @@ A list of all the IDs of all the hosts
 14.2247  \subsubsection{RPC name:~get\_uuid}
 14.2248  
 14.2249  {\bf Overview:} 
 14.2250 -get accessor message derived from field uuid of object host
 14.2251 +Get the uuid field of the given host.
 14.2252  
 14.2253   \noindent {\bf Signature:} 
 14.2254  \begin{verbatim} string get_uuid (session_id s, host ref self)\end{verbatim}
 14.2255 @@ -4032,7 +4531,7 @@ get accessor message derived from field 
 14.2256  \begin{tabular}{|c|c|p{7cm}|}
 14.2257   \hline
 14.2258  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2259 -{\tt host ref } & self & object instance \\ \hline 
 14.2260 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2261  
 14.2262  \end{tabular}
 14.2263  
 14.2264 @@ -4051,7 +4550,7 @@ value of the field
 14.2265  \subsubsection{RPC name:~get\_name\_label}
 14.2266  
 14.2267  {\bf Overview:} 
 14.2268 -get accessor message derived from field name/label of object host
 14.2269 +Get the name/label field of the given host.
 14.2270  
 14.2271   \noindent {\bf Signature:} 
 14.2272  \begin{verbatim} string get_name_label (session_id s, host ref self)\end{verbatim}
 14.2273 @@ -4064,7 +4563,7 @@ get accessor message derived from field 
 14.2274  \begin{tabular}{|c|c|p{7cm}|}
 14.2275   \hline
 14.2276  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2277 -{\tt host ref } & self & object instance \\ \hline 
 14.2278 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2279  
 14.2280  \end{tabular}
 14.2281  
 14.2282 @@ -4083,7 +4582,7 @@ value of the field
 14.2283  \subsubsection{RPC name:~set\_name\_label}
 14.2284  
 14.2285  {\bf Overview:} 
 14.2286 -set accessor message derived from field name/label of object host
 14.2287 +Set the name/label field of the given host.
 14.2288  
 14.2289   \noindent {\bf Signature:} 
 14.2290  \begin{verbatim} void set_name_label (session_id s, host ref self, string value)\end{verbatim}
 14.2291 @@ -4096,7 +4595,7 @@ set accessor message derived from field 
 14.2292  \begin{tabular}{|c|c|p{7cm}|}
 14.2293   \hline
 14.2294  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2295 -{\tt host ref } & self & object instance \\ \hline 
 14.2296 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2297  
 14.2298  {\tt string } & value & New value to set \\ \hline 
 14.2299  
 14.2300 @@ -4117,7 +4616,7 @@ void
 14.2301  \subsubsection{RPC name:~get\_name\_description}
 14.2302  
 14.2303  {\bf Overview:} 
 14.2304 -get accessor message derived from field name/description of object host
 14.2305 +Get the name/description field of the given host.
 14.2306  
 14.2307   \noindent {\bf Signature:} 
 14.2308  \begin{verbatim} string get_name_description (session_id s, host ref self)\end{verbatim}
 14.2309 @@ -4130,7 +4629,7 @@ get accessor message derived from field 
 14.2310  \begin{tabular}{|c|c|p{7cm}|}
 14.2311   \hline
 14.2312  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2313 -{\tt host ref } & self & object instance \\ \hline 
 14.2314 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2315  
 14.2316  \end{tabular}
 14.2317  
 14.2318 @@ -4149,7 +4648,7 @@ value of the field
 14.2319  \subsubsection{RPC name:~set\_name\_description}
 14.2320  
 14.2321  {\bf Overview:} 
 14.2322 -set accessor message derived from field name/description of object host
 14.2323 +Set the name/description field of the given host.
 14.2324  
 14.2325   \noindent {\bf Signature:} 
 14.2326  \begin{verbatim} void set_name_description (session_id s, host ref self, string value)\end{verbatim}
 14.2327 @@ -4162,7 +4661,7 @@ set accessor message derived from field 
 14.2328  \begin{tabular}{|c|c|p{7cm}|}
 14.2329   \hline
 14.2330  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2331 -{\tt host ref } & self & object instance \\ \hline 
 14.2332 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2333  
 14.2334  {\tt string } & value & New value to set \\ \hline 
 14.2335  
 14.2336 @@ -4183,7 +4682,7 @@ void
 14.2337  \subsubsection{RPC name:~get\_software\_version}
 14.2338  
 14.2339  {\bf Overview:} 
 14.2340 -get accessor message derived from field software\_version of object host
 14.2341 +Get the software\_version field of the given host.
 14.2342  
 14.2343   \noindent {\bf Signature:} 
 14.2344  \begin{verbatim} ((string -> string) Map) get_software_version (session_id s, host ref self)\end{verbatim}
 14.2345 @@ -4196,7 +4695,7 @@ get accessor message derived from field 
 14.2346  \begin{tabular}{|c|c|p{7cm}|}
 14.2347   \hline
 14.2348  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2349 -{\tt host ref } & self & object instance \\ \hline 
 14.2350 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2351  
 14.2352  \end{tabular}
 14.2353  
 14.2354 @@ -4215,7 +4714,7 @@ value of the field
 14.2355  \subsubsection{RPC name:~get\_resident\_VMs}
 14.2356  
 14.2357  {\bf Overview:} 
 14.2358 -get accessor message derived from field resident\_VMs of object host
 14.2359 +Get the resident\_VMs field of the given host.
 14.2360  
 14.2361   \noindent {\bf Signature:} 
 14.2362  \begin{verbatim} ((VM ref) Set) get_resident_VMs (session_id s, host ref self)\end{verbatim}
 14.2363 @@ -4228,7 +4727,7 @@ get accessor message derived from field 
 14.2364  \begin{tabular}{|c|c|p{7cm}|}
 14.2365   \hline
 14.2366  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2367 -{\tt host ref } & self & object instance \\ \hline 
 14.2368 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2369  
 14.2370  \end{tabular}
 14.2371  
 14.2372 @@ -4247,7 +4746,7 @@ value of the field
 14.2373  \subsubsection{RPC name:~get\_PIFs}
 14.2374  
 14.2375  {\bf Overview:} 
 14.2376 -get accessor message derived from field PIFs of object host
 14.2377 +Get the PIFs field of the given host.
 14.2378  
 14.2379   \noindent {\bf Signature:} 
 14.2380  \begin{verbatim} ((PIF ref) Set) get_PIFs (session_id s, host ref self)\end{verbatim}
 14.2381 @@ -4260,7 +4759,7 @@ get accessor message derived from field 
 14.2382  \begin{tabular}{|c|c|p{7cm}|}
 14.2383   \hline
 14.2384  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2385 -{\tt host ref } & self & object instance \\ \hline 
 14.2386 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2387  
 14.2388  \end{tabular}
 14.2389  
 14.2390 @@ -4279,7 +4778,7 @@ value of the field
 14.2391  \subsubsection{RPC name:~get\_host\_CPUs}
 14.2392  
 14.2393  {\bf Overview:} 
 14.2394 -get accessor message derived from field host\_CPUs of object host
 14.2395 +Get the host\_CPUs field of the given host.
 14.2396  
 14.2397   \noindent {\bf Signature:} 
 14.2398  \begin{verbatim} ((host_cpu ref) Set) get_host_CPUs (session_id s, host ref self)\end{verbatim}
 14.2399 @@ -4292,7 +4791,7 @@ get accessor message derived from field 
 14.2400  \begin{tabular}{|c|c|p{7cm}|}
 14.2401   \hline
 14.2402  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2403 -{\tt host ref } & self & object instance \\ \hline 
 14.2404 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2405  
 14.2406  \end{tabular}
 14.2407  
 14.2408 @@ -4311,7 +4810,7 @@ value of the field
 14.2409  \subsubsection{RPC name:~create}
 14.2410  
 14.2411  {\bf Overview:} 
 14.2412 -constructor for class host
 14.2413 +Create a new host instance, and return its handle.
 14.2414  
 14.2415   \noindent {\bf Signature:} 
 14.2416  \begin{verbatim} (host ref) create (session_id s, host record args)\end{verbatim}
 14.2417 @@ -4343,7 +4842,7 @@ reference to the newly created object
 14.2418  \subsubsection{RPC name:~destroy}
 14.2419  
 14.2420  {\bf Overview:} 
 14.2421 -destructor for class host
 14.2422 +Destroy the specified host instance.
 14.2423  
 14.2424   \noindent {\bf Signature:} 
 14.2425  \begin{verbatim} void destroy (session_id s, host ref self)\end{verbatim}
 14.2426 @@ -4356,7 +4855,7 @@ destructor for class host
 14.2427  \begin{tabular}{|c|c|p{7cm}|}
 14.2428   \hline
 14.2429  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2430 -{\tt host ref } & self & object instance \\ \hline 
 14.2431 +{\tt host ref } & self & reference to the object \\ \hline 
 14.2432  
 14.2433  \end{tabular}
 14.2434  
 14.2435 @@ -4375,7 +4874,7 @@ void
 14.2436  \subsubsection{RPC name:~get\_by\_uuid}
 14.2437  
 14.2438  {\bf Overview:} 
 14.2439 -returns the host instance with a particular uuid
 14.2440 +Get a reference to the host instance with the specified UUID.
 14.2441  
 14.2442   \noindent {\bf Signature:} 
 14.2443  \begin{verbatim} (host ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.2444 @@ -4407,7 +4906,7 @@ reference to the object
 14.2445  \subsubsection{RPC name:~get\_record}
 14.2446  
 14.2447  {\bf Overview:} 
 14.2448 -returns a record containing the state of an instance of class host
 14.2449 +Get a record containing the current state of the given host.
 14.2450  
 14.2451   \noindent {\bf Signature:} 
 14.2452  \begin{verbatim} (host record) get_record (session_id s, host ref self)\end{verbatim}
 14.2453 @@ -4439,7 +4938,7 @@ all fields from the object
 14.2454  \subsubsection{RPC name:~get\_by\_name\_label}
 14.2455  
 14.2456  {\bf Overview:} 
 14.2457 -returns the host instance with a particular name label
 14.2458 +Get all the host instances with the given label.
 14.2459  
 14.2460   \noindent {\bf Signature:} 
 14.2461  \begin{verbatim} ((host ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
 14.2462 @@ -4494,7 +4993,7 @@ Quals & Field & Type & Description \\
 14.2463  \subsubsection{RPC name:~get\_uuid}
 14.2464  
 14.2465  {\bf Overview:} 
 14.2466 -get accessor message derived from field uuid of object host\_cpu
 14.2467 +Get the uuid field of the given host\_cpu.
 14.2468  
 14.2469   \noindent {\bf Signature:} 
 14.2470  \begin{verbatim} string get_uuid (session_id s, host_cpu ref self)\end{verbatim}
 14.2471 @@ -4507,7 +5006,7 @@ get accessor message derived from field 
 14.2472  \begin{tabular}{|c|c|p{7cm}|}
 14.2473   \hline
 14.2474  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2475 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2476 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2477  
 14.2478  \end{tabular}
 14.2479  
 14.2480 @@ -4526,7 +5025,7 @@ value of the field
 14.2481  \subsubsection{RPC name:~get\_host}
 14.2482  
 14.2483  {\bf Overview:} 
 14.2484 -get accessor message derived from field host of object host\_cpu
 14.2485 +Get the host field of the given host\_cpu.
 14.2486  
 14.2487   \noindent {\bf Signature:} 
 14.2488  \begin{verbatim} (host ref) get_host (session_id s, host_cpu ref self)\end{verbatim}
 14.2489 @@ -4539,7 +5038,7 @@ get accessor message derived from field 
 14.2490  \begin{tabular}{|c|c|p{7cm}|}
 14.2491   \hline
 14.2492  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2493 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2494 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2495  
 14.2496  \end{tabular}
 14.2497  
 14.2498 @@ -4558,7 +5057,7 @@ value of the field
 14.2499  \subsubsection{RPC name:~get\_number}
 14.2500  
 14.2501  {\bf Overview:} 
 14.2502 -get accessor message derived from field number of object host\_cpu
 14.2503 +Get the number field of the given host\_cpu.
 14.2504  
 14.2505   \noindent {\bf Signature:} 
 14.2506  \begin{verbatim} int get_number (session_id s, host_cpu ref self)\end{verbatim}
 14.2507 @@ -4571,7 +5070,7 @@ get accessor message derived from field 
 14.2508  \begin{tabular}{|c|c|p{7cm}|}
 14.2509   \hline
 14.2510  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2511 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2512 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2513  
 14.2514  \end{tabular}
 14.2515  
 14.2516 @@ -4590,7 +5089,7 @@ value of the field
 14.2517  \subsubsection{RPC name:~get\_vendor}
 14.2518  
 14.2519  {\bf Overview:} 
 14.2520 -get accessor message derived from field vendor of object host\_cpu
 14.2521 +Get the vendor field of the given host\_cpu.
 14.2522  
 14.2523   \noindent {\bf Signature:} 
 14.2524  \begin{verbatim} string get_vendor (session_id s, host_cpu ref self)\end{verbatim}
 14.2525 @@ -4603,7 +5102,7 @@ get accessor message derived from field 
 14.2526  \begin{tabular}{|c|c|p{7cm}|}
 14.2527   \hline
 14.2528  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2529 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2530 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2531  
 14.2532  \end{tabular}
 14.2533  
 14.2534 @@ -4622,7 +5121,7 @@ value of the field
 14.2535  \subsubsection{RPC name:~get\_speed}
 14.2536  
 14.2537  {\bf Overview:} 
 14.2538 -get accessor message derived from field speed of object host\_cpu
 14.2539 +Get the speed field of the given host\_cpu.
 14.2540  
 14.2541   \noindent {\bf Signature:} 
 14.2542  \begin{verbatim} int get_speed (session_id s, host_cpu ref self)\end{verbatim}
 14.2543 @@ -4635,7 +5134,7 @@ get accessor message derived from field 
 14.2544  \begin{tabular}{|c|c|p{7cm}|}
 14.2545   \hline
 14.2546  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2547 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2548 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2549  
 14.2550  \end{tabular}
 14.2551  
 14.2552 @@ -4654,7 +5153,7 @@ value of the field
 14.2553  \subsubsection{RPC name:~get\_modelname}
 14.2554  
 14.2555  {\bf Overview:} 
 14.2556 -get accessor message derived from field modelname of object host\_cpu
 14.2557 +Get the modelname field of the given host\_cpu.
 14.2558  
 14.2559   \noindent {\bf Signature:} 
 14.2560  \begin{verbatim} string get_modelname (session_id s, host_cpu ref self)\end{verbatim}
 14.2561 @@ -4667,7 +5166,7 @@ get accessor message derived from field 
 14.2562  \begin{tabular}{|c|c|p{7cm}|}
 14.2563   \hline
 14.2564  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2565 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2566 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2567  
 14.2568  \end{tabular}
 14.2569  
 14.2570 @@ -4686,7 +5185,7 @@ value of the field
 14.2571  \subsubsection{RPC name:~get\_features}
 14.2572  
 14.2573  {\bf Overview:} 
 14.2574 -get accessor message derived from field features of object host\_cpu
 14.2575 +Get the features field of the given host\_cpu.
 14.2576  
 14.2577   \noindent {\bf Signature:} 
 14.2578  \begin{verbatim} ((cpu_feature) Set) get_features (session_id s, host_cpu ref self)\end{verbatim}
 14.2579 @@ -4699,7 +5198,7 @@ get accessor message derived from field 
 14.2580  \begin{tabular}{|c|c|p{7cm}|}
 14.2581   \hline
 14.2582  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2583 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2584 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2585  
 14.2586  \end{tabular}
 14.2587  
 14.2588 @@ -4718,7 +5217,7 @@ value of the field
 14.2589  \subsubsection{RPC name:~get\_utilisation}
 14.2590  
 14.2591  {\bf Overview:} 
 14.2592 -get accessor message derived from field utilisation of object host\_cpu
 14.2593 +Get the utilisation field of the given host\_cpu.
 14.2594  
 14.2595   \noindent {\bf Signature:} 
 14.2596  \begin{verbatim} float get_utilisation (session_id s, host_cpu ref self)\end{verbatim}
 14.2597 @@ -4731,7 +5230,7 @@ get accessor message derived from field 
 14.2598  \begin{tabular}{|c|c|p{7cm}|}
 14.2599   \hline
 14.2600  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2601 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2602 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2603  
 14.2604  \end{tabular}
 14.2605  
 14.2606 @@ -4750,7 +5249,7 @@ value of the field
 14.2607  \subsubsection{RPC name:~create}
 14.2608  
 14.2609  {\bf Overview:} 
 14.2610 -constructor for class host\_cpu
 14.2611 +Create a new host\_cpu instance, and return its handle.
 14.2612  
 14.2613   \noindent {\bf Signature:} 
 14.2614  \begin{verbatim} (host_cpu ref) create (session_id s, host_cpu record args)\end{verbatim}
 14.2615 @@ -4782,7 +5281,7 @@ reference to the newly created object
 14.2616  \subsubsection{RPC name:~destroy}
 14.2617  
 14.2618  {\bf Overview:} 
 14.2619 -destructor for class host\_cpu
 14.2620 +Destroy the specified host\_cpu instance.
 14.2621  
 14.2622   \noindent {\bf Signature:} 
 14.2623  \begin{verbatim} void destroy (session_id s, host_cpu ref self)\end{verbatim}
 14.2624 @@ -4795,7 +5294,7 @@ destructor for class host\_cpu
 14.2625  \begin{tabular}{|c|c|p{7cm}|}
 14.2626   \hline
 14.2627  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2628 -{\tt host\_cpu ref } & self & object instance \\ \hline 
 14.2629 +{\tt host\_cpu ref } & self & reference to the object \\ \hline 
 14.2630  
 14.2631  \end{tabular}
 14.2632  
 14.2633 @@ -4814,7 +5313,7 @@ void
 14.2634  \subsubsection{RPC name:~get\_by\_uuid}
 14.2635  
 14.2636  {\bf Overview:} 
 14.2637 -returns the host\_cpu instance with a particular uuid
 14.2638 +Get a reference to the host\_cpu instance with the specified UUID.
 14.2639  
 14.2640   \noindent {\bf Signature:} 
 14.2641  \begin{verbatim} (host_cpu ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.2642 @@ -4846,7 +5345,7 @@ reference to the object
 14.2643  \subsubsection{RPC name:~get\_record}
 14.2644  
 14.2645  {\bf Overview:} 
 14.2646 -returns a record containing the state of an instance of class host\_cpu
 14.2647 +Get a record containing the current state of the given host\_cpu.
 14.2648  
 14.2649   \noindent {\bf Signature:} 
 14.2650  \begin{verbatim} (host_cpu record) get_record (session_id s, host_cpu ref self)\end{verbatim}
 14.2651 @@ -4921,7 +5420,7 @@ A list of all the IDs of all the network
 14.2652  \subsubsection{RPC name:~get\_uuid}
 14.2653  
 14.2654  {\bf Overview:} 
 14.2655 -get accessor message derived from field uuid of object network
 14.2656 +Get the uuid field of the given network.
 14.2657  
 14.2658   \noindent {\bf Signature:} 
 14.2659  \begin{verbatim} string get_uuid (session_id s, network ref self)\end{verbatim}
 14.2660 @@ -4934,7 +5433,7 @@ get accessor message derived from field 
 14.2661  \begin{tabular}{|c|c|p{7cm}|}
 14.2662   \hline
 14.2663  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2664 -{\tt network ref } & self & object instance \\ \hline 
 14.2665 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2666  
 14.2667  \end{tabular}
 14.2668  
 14.2669 @@ -4953,7 +5452,7 @@ value of the field
 14.2670  \subsubsection{RPC name:~get\_name\_label}
 14.2671  
 14.2672  {\bf Overview:} 
 14.2673 -get accessor message derived from field name/label of object network
 14.2674 +Get the name/label field of the given network.
 14.2675  
 14.2676   \noindent {\bf Signature:} 
 14.2677  \begin{verbatim} string get_name_label (session_id s, network ref self)\end{verbatim}
 14.2678 @@ -4966,7 +5465,7 @@ get accessor message derived from field 
 14.2679  \begin{tabular}{|c|c|p{7cm}|}
 14.2680   \hline
 14.2681  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2682 -{\tt network ref } & self & object instance \\ \hline 
 14.2683 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2684  
 14.2685  \end{tabular}
 14.2686  
 14.2687 @@ -4985,7 +5484,7 @@ value of the field
 14.2688  \subsubsection{RPC name:~set\_name\_label}
 14.2689  
 14.2690  {\bf Overview:} 
 14.2691 -set accessor message derived from field name/label of object network
 14.2692 +Set the name/label field of the given network.
 14.2693  
 14.2694   \noindent {\bf Signature:} 
 14.2695  \begin{verbatim} void set_name_label (session_id s, network ref self, string value)\end{verbatim}
 14.2696 @@ -4998,7 +5497,7 @@ set accessor message derived from field 
 14.2697  \begin{tabular}{|c|c|p{7cm}|}
 14.2698   \hline
 14.2699  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2700 -{\tt network ref } & self & object instance \\ \hline 
 14.2701 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2702  
 14.2703  {\tt string } & value & New value to set \\ \hline 
 14.2704  
 14.2705 @@ -5019,7 +5518,7 @@ void
 14.2706  \subsubsection{RPC name:~get\_name\_description}
 14.2707  
 14.2708  {\bf Overview:} 
 14.2709 -get accessor message derived from field name/description of object network
 14.2710 +Get the name/description field of the given network.
 14.2711  
 14.2712   \noindent {\bf Signature:} 
 14.2713  \begin{verbatim} string get_name_description (session_id s, network ref self)\end{verbatim}
 14.2714 @@ -5032,7 +5531,7 @@ get accessor message derived from field 
 14.2715  \begin{tabular}{|c|c|p{7cm}|}
 14.2716   \hline
 14.2717  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2718 -{\tt network ref } & self & object instance \\ \hline 
 14.2719 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2720  
 14.2721  \end{tabular}
 14.2722  
 14.2723 @@ -5051,7 +5550,7 @@ value of the field
 14.2724  \subsubsection{RPC name:~set\_name\_description}
 14.2725  
 14.2726  {\bf Overview:} 
 14.2727 -set accessor message derived from field name/description of object network
 14.2728 +Set the name/description field of the given network.
 14.2729  
 14.2730   \noindent {\bf Signature:} 
 14.2731  \begin{verbatim} void set_name_description (session_id s, network ref self, string value)\end{verbatim}
 14.2732 @@ -5064,7 +5563,7 @@ set accessor message derived from field 
 14.2733  \begin{tabular}{|c|c|p{7cm}|}
 14.2734   \hline
 14.2735  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2736 -{\tt network ref } & self & object instance \\ \hline 
 14.2737 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2738  
 14.2739  {\tt string } & value & New value to set \\ \hline 
 14.2740  
 14.2741 @@ -5085,7 +5584,7 @@ void
 14.2742  \subsubsection{RPC name:~get\_VIFs}
 14.2743  
 14.2744  {\bf Overview:} 
 14.2745 -get accessor message derived from field VIFs of object network
 14.2746 +Get the VIFs field of the given network.
 14.2747  
 14.2748   \noindent {\bf Signature:} 
 14.2749  \begin{verbatim} ((VIF ref) Set) get_VIFs (session_id s, network ref self)\end{verbatim}
 14.2750 @@ -5098,7 +5597,7 @@ get accessor message derived from field 
 14.2751  \begin{tabular}{|c|c|p{7cm}|}
 14.2752   \hline
 14.2753  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2754 -{\tt network ref } & self & object instance \\ \hline 
 14.2755 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2756  
 14.2757  \end{tabular}
 14.2758  
 14.2759 @@ -5117,7 +5616,7 @@ value of the field
 14.2760  \subsubsection{RPC name:~get\_PIFs}
 14.2761  
 14.2762  {\bf Overview:} 
 14.2763 -get accessor message derived from field PIFs of object network
 14.2764 +Get the PIFs field of the given network.
 14.2765  
 14.2766   \noindent {\bf Signature:} 
 14.2767  \begin{verbatim} ((PIF ref) Set) get_PIFs (session_id s, network ref self)\end{verbatim}
 14.2768 @@ -5130,7 +5629,7 @@ get accessor message derived from field 
 14.2769  \begin{tabular}{|c|c|p{7cm}|}
 14.2770   \hline
 14.2771  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2772 -{\tt network ref } & self & object instance \\ \hline 
 14.2773 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2774  
 14.2775  \end{tabular}
 14.2776  
 14.2777 @@ -5149,7 +5648,7 @@ value of the field
 14.2778  \subsubsection{RPC name:~get\_default\_gateway}
 14.2779  
 14.2780  {\bf Overview:} 
 14.2781 -get accessor message derived from field default\_gateway of object network
 14.2782 +Get the default\_gateway field of the given network.
 14.2783  
 14.2784   \noindent {\bf Signature:} 
 14.2785  \begin{verbatim} string get_default_gateway (session_id s, network ref self)\end{verbatim}
 14.2786 @@ -5162,7 +5661,7 @@ get accessor message derived from field 
 14.2787  \begin{tabular}{|c|c|p{7cm}|}
 14.2788   \hline
 14.2789  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2790 -{\tt network ref } & self & object instance \\ \hline 
 14.2791 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2792  
 14.2793  \end{tabular}
 14.2794  
 14.2795 @@ -5181,7 +5680,7 @@ value of the field
 14.2796  \subsubsection{RPC name:~set\_default\_gateway}
 14.2797  
 14.2798  {\bf Overview:} 
 14.2799 -set accessor message derived from field default\_gateway of object network
 14.2800 +Set the default\_gateway field of the given network.
 14.2801  
 14.2802   \noindent {\bf Signature:} 
 14.2803  \begin{verbatim} void set_default_gateway (session_id s, network ref self, string value)\end{verbatim}
 14.2804 @@ -5194,7 +5693,7 @@ set accessor message derived from field 
 14.2805  \begin{tabular}{|c|c|p{7cm}|}
 14.2806   \hline
 14.2807  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2808 -{\tt network ref } & self & object instance \\ \hline 
 14.2809 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2810  
 14.2811  {\tt string } & value & New value to set \\ \hline 
 14.2812  
 14.2813 @@ -5215,7 +5714,7 @@ void
 14.2814  \subsubsection{RPC name:~get\_default\_netmask}
 14.2815  
 14.2816  {\bf Overview:} 
 14.2817 -get accessor message derived from field default\_netmask of object network
 14.2818 +Get the default\_netmask field of the given network.
 14.2819  
 14.2820   \noindent {\bf Signature:} 
 14.2821  \begin{verbatim} string get_default_netmask (session_id s, network ref self)\end{verbatim}
 14.2822 @@ -5228,7 +5727,7 @@ get accessor message derived from field 
 14.2823  \begin{tabular}{|c|c|p{7cm}|}
 14.2824   \hline
 14.2825  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2826 -{\tt network ref } & self & object instance \\ \hline 
 14.2827 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2828  
 14.2829  \end{tabular}
 14.2830  
 14.2831 @@ -5247,7 +5746,7 @@ value of the field
 14.2832  \subsubsection{RPC name:~set\_default\_netmask}
 14.2833  
 14.2834  {\bf Overview:} 
 14.2835 -set accessor message derived from field default\_netmask of object network
 14.2836 +Set the default\_netmask field of the given network.
 14.2837  
 14.2838   \noindent {\bf Signature:} 
 14.2839  \begin{verbatim} void set_default_netmask (session_id s, network ref self, string value)\end{verbatim}
 14.2840 @@ -5260,7 +5759,7 @@ set accessor message derived from field 
 14.2841  \begin{tabular}{|c|c|p{7cm}|}
 14.2842   \hline
 14.2843  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2844 -{\tt network ref } & self & object instance \\ \hline 
 14.2845 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2846  
 14.2847  {\tt string } & value & New value to set \\ \hline 
 14.2848  
 14.2849 @@ -5281,7 +5780,7 @@ void
 14.2850  \subsubsection{RPC name:~create}
 14.2851  
 14.2852  {\bf Overview:} 
 14.2853 -constructor for class network
 14.2854 +Create a new network instance, and return its handle.
 14.2855  
 14.2856   \noindent {\bf Signature:} 
 14.2857  \begin{verbatim} (network ref) create (session_id s, network record args)\end{verbatim}
 14.2858 @@ -5313,7 +5812,7 @@ reference to the newly created object
 14.2859  \subsubsection{RPC name:~destroy}
 14.2860  
 14.2861  {\bf Overview:} 
 14.2862 -destructor for class network
 14.2863 +Destroy the specified network instance.
 14.2864  
 14.2865   \noindent {\bf Signature:} 
 14.2866  \begin{verbatim} void destroy (session_id s, network ref self)\end{verbatim}
 14.2867 @@ -5326,7 +5825,7 @@ destructor for class network
 14.2868  \begin{tabular}{|c|c|p{7cm}|}
 14.2869   \hline
 14.2870  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2871 -{\tt network ref } & self & object instance \\ \hline 
 14.2872 +{\tt network ref } & self & reference to the object \\ \hline 
 14.2873  
 14.2874  \end{tabular}
 14.2875  
 14.2876 @@ -5345,7 +5844,7 @@ void
 14.2877  \subsubsection{RPC name:~get\_by\_uuid}
 14.2878  
 14.2879  {\bf Overview:} 
 14.2880 -returns the network instance with a particular uuid
 14.2881 +Get a reference to the network instance with the specified UUID.
 14.2882  
 14.2883   \noindent {\bf Signature:} 
 14.2884  \begin{verbatim} (network ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.2885 @@ -5377,7 +5876,7 @@ reference to the object
 14.2886  \subsubsection{RPC name:~get\_record}
 14.2887  
 14.2888  {\bf Overview:} 
 14.2889 -returns a record containing the state of an instance of class network
 14.2890 +Get a record containing the current state of the given network.
 14.2891  
 14.2892   \noindent {\bf Signature:} 
 14.2893  \begin{verbatim} (network record) get_record (session_id s, network ref self)\end{verbatim}
 14.2894 @@ -5409,7 +5908,7 @@ all fields from the object
 14.2895  \subsubsection{RPC name:~get\_by\_name\_label}
 14.2896  
 14.2897  {\bf Overview:} 
 14.2898 -returns the network instance with a particular name label
 14.2899 +Get all the network instances with the given label.
 14.2900  
 14.2901   \noindent {\bf Signature:} 
 14.2902  \begin{verbatim} ((network ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
 14.2903 @@ -5466,7 +5965,7 @@ Quals & Field & Type & Description \\
 14.2904  \subsubsection{RPC name:~get\_uuid}
 14.2905  
 14.2906  {\bf Overview:} 
 14.2907 -get accessor message derived from field uuid of object VIF
 14.2908 +Get the uuid field of the given VIF.
 14.2909  
 14.2910   \noindent {\bf Signature:} 
 14.2911  \begin{verbatim} string get_uuid (session_id s, VIF ref self)\end{verbatim}
 14.2912 @@ -5479,7 +5978,7 @@ get accessor message derived from field 
 14.2913  \begin{tabular}{|c|c|p{7cm}|}
 14.2914   \hline
 14.2915  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2916 -{\tt VIF ref } & self & object instance \\ \hline 
 14.2917 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.2918  
 14.2919  \end{tabular}
 14.2920  
 14.2921 @@ -5498,7 +5997,7 @@ value of the field
 14.2922  \subsubsection{RPC name:~get\_name}
 14.2923  
 14.2924  {\bf Overview:} 
 14.2925 -get accessor message derived from field name of object VIF
 14.2926 +Get the name field of the given VIF.
 14.2927  
 14.2928   \noindent {\bf Signature:} 
 14.2929  \begin{verbatim} string get_name (session_id s, VIF ref self)\end{verbatim}
 14.2930 @@ -5511,7 +6010,7 @@ get accessor message derived from field 
 14.2931  \begin{tabular}{|c|c|p{7cm}|}
 14.2932   \hline
 14.2933  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2934 -{\tt VIF ref } & self & object instance \\ \hline 
 14.2935 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.2936  
 14.2937  \end{tabular}
 14.2938  
 14.2939 @@ -5530,7 +6029,7 @@ value of the field
 14.2940  \subsubsection{RPC name:~set\_name}
 14.2941  
 14.2942  {\bf Overview:} 
 14.2943 -set accessor message derived from field name of object VIF
 14.2944 +Set the name field of the given VIF.
 14.2945  
 14.2946   \noindent {\bf Signature:} 
 14.2947  \begin{verbatim} void set_name (session_id s, VIF ref self, string value)\end{verbatim}
 14.2948 @@ -5543,7 +6042,7 @@ set accessor message derived from field 
 14.2949  \begin{tabular}{|c|c|p{7cm}|}
 14.2950   \hline
 14.2951  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2952 -{\tt VIF ref } & self & object instance \\ \hline 
 14.2953 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.2954  
 14.2955  {\tt string } & value & New value to set \\ \hline 
 14.2956  
 14.2957 @@ -5564,7 +6063,7 @@ void
 14.2958  \subsubsection{RPC name:~get\_type}
 14.2959  
 14.2960  {\bf Overview:} 
 14.2961 -get accessor message derived from field type of object VIF
 14.2962 +Get the type field of the given VIF.
 14.2963  
 14.2964   \noindent {\bf Signature:} 
 14.2965  \begin{verbatim} (driver_type) get_type (session_id s, VIF ref self)\end{verbatim}
 14.2966 @@ -5577,7 +6076,7 @@ get accessor message derived from field 
 14.2967  \begin{tabular}{|c|c|p{7cm}|}
 14.2968   \hline
 14.2969  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2970 -{\tt VIF ref } & self & object instance \\ \hline 
 14.2971 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.2972  
 14.2973  \end{tabular}
 14.2974  
 14.2975 @@ -5596,7 +6095,7 @@ value of the field
 14.2976  \subsubsection{RPC name:~set\_type}
 14.2977  
 14.2978  {\bf Overview:} 
 14.2979 -set accessor message derived from field type of object VIF
 14.2980 +Set the type field of the given VIF.
 14.2981  
 14.2982   \noindent {\bf Signature:} 
 14.2983  \begin{verbatim} void set_type (session_id s, VIF ref self, driver_type value)\end{verbatim}
 14.2984 @@ -5609,7 +6108,7 @@ set accessor message derived from field 
 14.2985  \begin{tabular}{|c|c|p{7cm}|}
 14.2986   \hline
 14.2987  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.2988 -{\tt VIF ref } & self & object instance \\ \hline 
 14.2989 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.2990  
 14.2991  {\tt driver\_type } & value & New value to set \\ \hline 
 14.2992  
 14.2993 @@ -5630,7 +6129,7 @@ void
 14.2994  \subsubsection{RPC name:~get\_device}
 14.2995  
 14.2996  {\bf Overview:} 
 14.2997 -get accessor message derived from field device of object VIF
 14.2998 +Get the device field of the given VIF.
 14.2999  
 14.3000   \noindent {\bf Signature:} 
 14.3001  \begin{verbatim} string get_device (session_id s, VIF ref self)\end{verbatim}
 14.3002 @@ -5643,7 +6142,7 @@ get accessor message derived from field 
 14.3003  \begin{tabular}{|c|c|p{7cm}|}
 14.3004   \hline
 14.3005  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3006 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3007 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3008  
 14.3009  \end{tabular}
 14.3010  
 14.3011 @@ -5662,7 +6161,7 @@ value of the field
 14.3012  \subsubsection{RPC name:~set\_device}
 14.3013  
 14.3014  {\bf Overview:} 
 14.3015 -set accessor message derived from field device of object VIF
 14.3016 +Set the device field of the given VIF.
 14.3017  
 14.3018   \noindent {\bf Signature:} 
 14.3019  \begin{verbatim} void set_device (session_id s, VIF ref self, string value)\end{verbatim}
 14.3020 @@ -5675,7 +6174,7 @@ set accessor message derived from field 
 14.3021  \begin{tabular}{|c|c|p{7cm}|}
 14.3022   \hline
 14.3023  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3024 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3025 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3026  
 14.3027  {\tt string } & value & New value to set \\ \hline 
 14.3028  
 14.3029 @@ -5696,7 +6195,7 @@ void
 14.3030  \subsubsection{RPC name:~get\_network}
 14.3031  
 14.3032  {\bf Overview:} 
 14.3033 -get accessor message derived from field network of object VIF
 14.3034 +Get the network field of the given VIF.
 14.3035  
 14.3036   \noindent {\bf Signature:} 
 14.3037  \begin{verbatim} (network ref) get_network (session_id s, VIF ref self)\end{verbatim}
 14.3038 @@ -5709,7 +6208,7 @@ get accessor message derived from field 
 14.3039  \begin{tabular}{|c|c|p{7cm}|}
 14.3040   \hline
 14.3041  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3042 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3043 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3044  
 14.3045  \end{tabular}
 14.3046  
 14.3047 @@ -5728,7 +6227,7 @@ value of the field
 14.3048  \subsubsection{RPC name:~set\_network}
 14.3049  
 14.3050  {\bf Overview:} 
 14.3051 -set accessor message derived from field network of object VIF
 14.3052 +Set the network field of the given VIF.
 14.3053  
 14.3054   \noindent {\bf Signature:} 
 14.3055  \begin{verbatim} void set_network (session_id s, VIF ref self, network ref value)\end{verbatim}
 14.3056 @@ -5741,7 +6240,7 @@ set accessor message derived from field 
 14.3057  \begin{tabular}{|c|c|p{7cm}|}
 14.3058   \hline
 14.3059  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3060 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3061 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3062  
 14.3063  {\tt network ref } & value & New value to set \\ \hline 
 14.3064  
 14.3065 @@ -5762,7 +6261,7 @@ void
 14.3066  \subsubsection{RPC name:~get\_VM}
 14.3067  
 14.3068  {\bf Overview:} 
 14.3069 -get accessor message derived from field VM of object VIF
 14.3070 +Get the VM field of the given VIF.
 14.3071  
 14.3072   \noindent {\bf Signature:} 
 14.3073  \begin{verbatim} (VM ref) get_VM (session_id s, VIF ref self)\end{verbatim}
 14.3074 @@ -5775,7 +6274,7 @@ get accessor message derived from field 
 14.3075  \begin{tabular}{|c|c|p{7cm}|}
 14.3076   \hline
 14.3077  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3078 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3079 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3080  
 14.3081  \end{tabular}
 14.3082  
 14.3083 @@ -5794,7 +6293,7 @@ value of the field
 14.3084  \subsubsection{RPC name:~set\_VM}
 14.3085  
 14.3086  {\bf Overview:} 
 14.3087 -set accessor message derived from field VM of object VIF
 14.3088 +Set the VM field of the given VIF.
 14.3089  
 14.3090   \noindent {\bf Signature:} 
 14.3091  \begin{verbatim} void set_VM (session_id s, VIF ref self, VM ref value)\end{verbatim}
 14.3092 @@ -5807,7 +6306,7 @@ set accessor message derived from field 
 14.3093  \begin{tabular}{|c|c|p{7cm}|}
 14.3094   \hline
 14.3095  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3096 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3097 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3098  
 14.3099  {\tt VM ref } & value & New value to set \\ \hline 
 14.3100  
 14.3101 @@ -5828,7 +6327,7 @@ void
 14.3102  \subsubsection{RPC name:~get\_MAC}
 14.3103  
 14.3104  {\bf Overview:} 
 14.3105 -get accessor message derived from field MAC of object VIF
 14.3106 +Get the MAC field of the given VIF.
 14.3107  
 14.3108   \noindent {\bf Signature:} 
 14.3109  \begin{verbatim} string get_MAC (session_id s, VIF ref self)\end{verbatim}
 14.3110 @@ -5841,7 +6340,7 @@ get accessor message derived from field 
 14.3111  \begin{tabular}{|c|c|p{7cm}|}
 14.3112   \hline
 14.3113  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3114 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3115 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3116  
 14.3117  \end{tabular}
 14.3118  
 14.3119 @@ -5860,7 +6359,7 @@ value of the field
 14.3120  \subsubsection{RPC name:~set\_MAC}
 14.3121  
 14.3122  {\bf Overview:} 
 14.3123 -set accessor message derived from field MAC of object VIF
 14.3124 +Set the MAC field of the given VIF.
 14.3125  
 14.3126   \noindent {\bf Signature:} 
 14.3127  \begin{verbatim} void set_MAC (session_id s, VIF ref self, string value)\end{verbatim}
 14.3128 @@ -5873,7 +6372,7 @@ set accessor message derived from field 
 14.3129  \begin{tabular}{|c|c|p{7cm}|}
 14.3130   \hline
 14.3131  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3132 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3133 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3134  
 14.3135  {\tt string } & value & New value to set \\ \hline 
 14.3136  
 14.3137 @@ -5894,7 +6393,7 @@ void
 14.3138  \subsubsection{RPC name:~get\_MTU}
 14.3139  
 14.3140  {\bf Overview:} 
 14.3141 -get accessor message derived from field MTU of object VIF
 14.3142 +Get the MTU field of the given VIF.
 14.3143  
 14.3144   \noindent {\bf Signature:} 
 14.3145  \begin{verbatim} int get_MTU (session_id s, VIF ref self)\end{verbatim}
 14.3146 @@ -5907,7 +6406,7 @@ get accessor message derived from field 
 14.3147  \begin{tabular}{|c|c|p{7cm}|}
 14.3148   \hline
 14.3149  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3150 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3151 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3152  
 14.3153  \end{tabular}
 14.3154  
 14.3155 @@ -5926,7 +6425,7 @@ value of the field
 14.3156  \subsubsection{RPC name:~set\_MTU}
 14.3157  
 14.3158  {\bf Overview:} 
 14.3159 -set accessor message derived from field MTU of object VIF
 14.3160 +Set the MTU field of the given VIF.
 14.3161  
 14.3162   \noindent {\bf Signature:} 
 14.3163  \begin{verbatim} void set_MTU (session_id s, VIF ref self, int value)\end{verbatim}
 14.3164 @@ -5939,7 +6438,7 @@ set accessor message derived from field 
 14.3165  \begin{tabular}{|c|c|p{7cm}|}
 14.3166   \hline
 14.3167  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3168 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3169 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3170  
 14.3171  {\tt int } & value & New value to set \\ \hline 
 14.3172  
 14.3173 @@ -5960,7 +6459,7 @@ void
 14.3174  \subsubsection{RPC name:~get\_io\_read\_kbs}
 14.3175  
 14.3176  {\bf Overview:} 
 14.3177 -get accessor message derived from field io/read\_kbs of object VIF
 14.3178 +Get the io/read\_kbs field of the given VIF.
 14.3179  
 14.3180   \noindent {\bf Signature:} 
 14.3181  \begin{verbatim} float get_io_read_kbs (session_id s, VIF ref self)\end{verbatim}
 14.3182 @@ -5973,7 +6472,7 @@ get accessor message derived from field 
 14.3183  \begin{tabular}{|c|c|p{7cm}|}
 14.3184   \hline
 14.3185  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3186 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3187 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3188  
 14.3189  \end{tabular}
 14.3190  
 14.3191 @@ -5992,7 +6491,7 @@ value of the field
 14.3192  \subsubsection{RPC name:~get\_io\_write\_kbs}
 14.3193  
 14.3194  {\bf Overview:} 
 14.3195 -get accessor message derived from field io/write\_kbs of object VIF
 14.3196 +Get the io/write\_kbs field of the given VIF.
 14.3197  
 14.3198   \noindent {\bf Signature:} 
 14.3199  \begin{verbatim} float get_io_write_kbs (session_id s, VIF ref self)\end{verbatim}
 14.3200 @@ -6005,7 +6504,7 @@ get accessor message derived from field 
 14.3201  \begin{tabular}{|c|c|p{7cm}|}
 14.3202   \hline
 14.3203  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3204 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3205 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3206  
 14.3207  \end{tabular}
 14.3208  
 14.3209 @@ -6024,7 +6523,7 @@ value of the field
 14.3210  \subsubsection{RPC name:~create}
 14.3211  
 14.3212  {\bf Overview:} 
 14.3213 -constructor for class VIF
 14.3214 +Create a new VIF instance, and return its handle.
 14.3215  
 14.3216   \noindent {\bf Signature:} 
 14.3217  \begin{verbatim} (VIF ref) create (session_id s, VIF record args)\end{verbatim}
 14.3218 @@ -6056,7 +6555,7 @@ reference to the newly created object
 14.3219  \subsubsection{RPC name:~destroy}
 14.3220  
 14.3221  {\bf Overview:} 
 14.3222 -destructor for class VIF
 14.3223 +Destroy the specified VIF instance.
 14.3224  
 14.3225   \noindent {\bf Signature:} 
 14.3226  \begin{verbatim} void destroy (session_id s, VIF ref self)\end{verbatim}
 14.3227 @@ -6069,7 +6568,7 @@ destructor for class VIF
 14.3228  \begin{tabular}{|c|c|p{7cm}|}
 14.3229   \hline
 14.3230  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3231 -{\tt VIF ref } & self & object instance \\ \hline 
 14.3232 +{\tt VIF ref } & self & reference to the object \\ \hline 
 14.3233  
 14.3234  \end{tabular}
 14.3235  
 14.3236 @@ -6088,7 +6587,7 @@ void
 14.3237  \subsubsection{RPC name:~get\_by\_uuid}
 14.3238  
 14.3239  {\bf Overview:} 
 14.3240 -returns the VIF instance with a particular uuid
 14.3241 +Get a reference to the VIF instance with the specified UUID.
 14.3242  
 14.3243   \noindent {\bf Signature:} 
 14.3244  \begin{verbatim} (VIF ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.3245 @@ -6120,7 +6619,7 @@ reference to the object
 14.3246  \subsubsection{RPC name:~get\_record}
 14.3247  
 14.3248  {\bf Overview:} 
 14.3249 -returns a record containing the state of an instance of class VIF
 14.3250 +Get a record containing the current state of the given VIF.
 14.3251  
 14.3252   \noindent {\bf Signature:} 
 14.3253  \begin{verbatim} (VIF record) get_record (session_id s, VIF ref self)\end{verbatim}
 14.3254 @@ -6176,7 +6675,7 @@ Quals & Field & Type & Description \\
 14.3255  \subsubsection{RPC name:~get\_uuid}
 14.3256  
 14.3257  {\bf Overview:} 
 14.3258 -get accessor message derived from field uuid of object PIF
 14.3259 +Get the uuid field of the given PIF.
 14.3260  
 14.3261   \noindent {\bf Signature:} 
 14.3262  \begin{verbatim} string get_uuid (session_id s, PIF ref self)\end{verbatim}
 14.3263 @@ -6189,7 +6688,7 @@ get accessor message derived from field 
 14.3264  \begin{tabular}{|c|c|p{7cm}|}
 14.3265   \hline
 14.3266  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3267 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3268 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3269  
 14.3270  \end{tabular}
 14.3271  
 14.3272 @@ -6208,7 +6707,7 @@ value of the field
 14.3273  \subsubsection{RPC name:~get\_name}
 14.3274  
 14.3275  {\bf Overview:} 
 14.3276 -get accessor message derived from field name of object PIF
 14.3277 +Get the name field of the given PIF.
 14.3278  
 14.3279   \noindent {\bf Signature:} 
 14.3280  \begin{verbatim} string get_name (session_id s, PIF ref self)\end{verbatim}
 14.3281 @@ -6221,7 +6720,7 @@ get accessor message derived from field 
 14.3282  \begin{tabular}{|c|c|p{7cm}|}
 14.3283   \hline
 14.3284  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3285 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3286 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3287  
 14.3288  \end{tabular}
 14.3289  
 14.3290 @@ -6240,7 +6739,7 @@ value of the field
 14.3291  \subsubsection{RPC name:~set\_name}
 14.3292  
 14.3293  {\bf Overview:} 
 14.3294 -set accessor message derived from field name of object PIF
 14.3295 +Set the name field of the given PIF.
 14.3296  
 14.3297   \noindent {\bf Signature:} 
 14.3298  \begin{verbatim} void set_name (session_id s, PIF ref self, string value)\end{verbatim}
 14.3299 @@ -6253,7 +6752,7 @@ set accessor message derived from field 
 14.3300  \begin{tabular}{|c|c|p{7cm}|}
 14.3301   \hline
 14.3302  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3303 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3304 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3305  
 14.3306  {\tt string } & value & New value to set \\ \hline 
 14.3307  
 14.3308 @@ -6274,7 +6773,7 @@ void
 14.3309  \subsubsection{RPC name:~get\_network}
 14.3310  
 14.3311  {\bf Overview:} 
 14.3312 -get accessor message derived from field network of object PIF
 14.3313 +Get the network field of the given PIF.
 14.3314  
 14.3315   \noindent {\bf Signature:} 
 14.3316  \begin{verbatim} (network ref) get_network (session_id s, PIF ref self)\end{verbatim}
 14.3317 @@ -6287,7 +6786,7 @@ get accessor message derived from field 
 14.3318  \begin{tabular}{|c|c|p{7cm}|}
 14.3319   \hline
 14.3320  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3321 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3322 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3323  
 14.3324  \end{tabular}
 14.3325  
 14.3326 @@ -6306,7 +6805,7 @@ value of the field
 14.3327  \subsubsection{RPC name:~set\_network}
 14.3328  
 14.3329  {\bf Overview:} 
 14.3330 -set accessor message derived from field network of object PIF
 14.3331 +Set the network field of the given PIF.
 14.3332  
 14.3333   \noindent {\bf Signature:} 
 14.3334  \begin{verbatim} void set_network (session_id s, PIF ref self, network ref value)\end{verbatim}
 14.3335 @@ -6319,7 +6818,7 @@ set accessor message derived from field 
 14.3336  \begin{tabular}{|c|c|p{7cm}|}
 14.3337   \hline
 14.3338  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3339 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3340 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3341  
 14.3342  {\tt network ref } & value & New value to set \\ \hline 
 14.3343  
 14.3344 @@ -6340,7 +6839,7 @@ void
 14.3345  \subsubsection{RPC name:~get\_host}
 14.3346  
 14.3347  {\bf Overview:} 
 14.3348 -get accessor message derived from field host of object PIF
 14.3349 +Get the host field of the given PIF.
 14.3350  
 14.3351   \noindent {\bf Signature:} 
 14.3352  \begin{verbatim} (host ref) get_host (session_id s, PIF ref self)\end{verbatim}
 14.3353 @@ -6353,7 +6852,7 @@ get accessor message derived from field 
 14.3354  \begin{tabular}{|c|c|p{7cm}|}
 14.3355   \hline
 14.3356  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3357 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3358 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3359  
 14.3360  \end{tabular}
 14.3361  
 14.3362 @@ -6372,7 +6871,7 @@ value of the field
 14.3363  \subsubsection{RPC name:~set\_host}
 14.3364  
 14.3365  {\bf Overview:} 
 14.3366 -set accessor message derived from field host of object PIF
 14.3367 +Set the host field of the given PIF.
 14.3368  
 14.3369   \noindent {\bf Signature:} 
 14.3370  \begin{verbatim} void set_host (session_id s, PIF ref self, host ref value)\end{verbatim}
 14.3371 @@ -6385,7 +6884,7 @@ set accessor message derived from field 
 14.3372  \begin{tabular}{|c|c|p{7cm}|}
 14.3373   \hline
 14.3374  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3375 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3376 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3377  
 14.3378  {\tt host ref } & value & New value to set \\ \hline 
 14.3379  
 14.3380 @@ -6406,7 +6905,7 @@ void
 14.3381  \subsubsection{RPC name:~get\_MAC}
 14.3382  
 14.3383  {\bf Overview:} 
 14.3384 -get accessor message derived from field MAC of object PIF
 14.3385 +Get the MAC field of the given PIF.
 14.3386  
 14.3387   \noindent {\bf Signature:} 
 14.3388  \begin{verbatim} string get_MAC (session_id s, PIF ref self)\end{verbatim}
 14.3389 @@ -6419,7 +6918,7 @@ get accessor message derived from field 
 14.3390  \begin{tabular}{|c|c|p{7cm}|}
 14.3391   \hline
 14.3392  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3393 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3394 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3395  
 14.3396  \end{tabular}
 14.3397  
 14.3398 @@ -6438,7 +6937,7 @@ value of the field
 14.3399  \subsubsection{RPC name:~set\_MAC}
 14.3400  
 14.3401  {\bf Overview:} 
 14.3402 -set accessor message derived from field MAC of object PIF
 14.3403 +Set the MAC field of the given PIF.
 14.3404  
 14.3405   \noindent {\bf Signature:} 
 14.3406  \begin{verbatim} void set_MAC (session_id s, PIF ref self, string value)\end{verbatim}
 14.3407 @@ -6451,7 +6950,7 @@ set accessor message derived from field 
 14.3408  \begin{tabular}{|c|c|p{7cm}|}
 14.3409   \hline
 14.3410  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3411 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3412 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3413  
 14.3414  {\tt string } & value & New value to set \\ \hline 
 14.3415  
 14.3416 @@ -6472,7 +6971,7 @@ void
 14.3417  \subsubsection{RPC name:~get\_MTU}
 14.3418  
 14.3419  {\bf Overview:} 
 14.3420 -get accessor message derived from field MTU of object PIF
 14.3421 +Get the MTU field of the given PIF.
 14.3422  
 14.3423   \noindent {\bf Signature:} 
 14.3424  \begin{verbatim} int get_MTU (session_id s, PIF ref self)\end{verbatim}
 14.3425 @@ -6485,7 +6984,7 @@ get accessor message derived from field 
 14.3426  \begin{tabular}{|c|c|p{7cm}|}
 14.3427   \hline
 14.3428  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3429 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3430 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3431  
 14.3432  \end{tabular}
 14.3433  
 14.3434 @@ -6504,7 +7003,7 @@ value of the field
 14.3435  \subsubsection{RPC name:~set\_MTU}
 14.3436  
 14.3437  {\bf Overview:} 
 14.3438 -set accessor message derived from field MTU of object PIF
 14.3439 +Set the MTU field of the given PIF.
 14.3440  
 14.3441   \noindent {\bf Signature:} 
 14.3442  \begin{verbatim} void set_MTU (session_id s, PIF ref self, int value)\end{verbatim}
 14.3443 @@ -6517,7 +7016,7 @@ set accessor message derived from field 
 14.3444  \begin{tabular}{|c|c|p{7cm}|}
 14.3445   \hline
 14.3446  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3447 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3448 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3449  
 14.3450  {\tt int } & value & New value to set \\ \hline 
 14.3451  
 14.3452 @@ -6538,7 +7037,7 @@ void
 14.3453  \subsubsection{RPC name:~get\_VLAN}
 14.3454  
 14.3455  {\bf Overview:} 
 14.3456 -get accessor message derived from field VLAN of object PIF
 14.3457 +Get the VLAN field of the given PIF.
 14.3458  
 14.3459   \noindent {\bf Signature:} 
 14.3460  \begin{verbatim} string get_VLAN (session_id s, PIF ref self)\end{verbatim}
 14.3461 @@ -6551,7 +7050,7 @@ get accessor message derived from field 
 14.3462  \begin{tabular}{|c|c|p{7cm}|}
 14.3463   \hline
 14.3464  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3465 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3466 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3467  
 14.3468  \end{tabular}
 14.3469  
 14.3470 @@ -6570,7 +7069,7 @@ value of the field
 14.3471  \subsubsection{RPC name:~set\_VLAN}
 14.3472  
 14.3473  {\bf Overview:} 
 14.3474 -set accessor message derived from field VLAN of object PIF
 14.3475 +Set the VLAN field of the given PIF.
 14.3476  
 14.3477   \noindent {\bf Signature:} 
 14.3478  \begin{verbatim} void set_VLAN (session_id s, PIF ref self, string value)\end{verbatim}
 14.3479 @@ -6583,7 +7082,7 @@ set accessor message derived from field 
 14.3480  \begin{tabular}{|c|c|p{7cm}|}
 14.3481   \hline
 14.3482  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3483 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3484 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3485  
 14.3486  {\tt string } & value & New value to set \\ \hline 
 14.3487  
 14.3488 @@ -6604,7 +7103,7 @@ void
 14.3489  \subsubsection{RPC name:~get\_io\_read\_kbs}
 14.3490  
 14.3491  {\bf Overview:} 
 14.3492 -get accessor message derived from field io/read\_kbs of object PIF
 14.3493 +Get the io/read\_kbs field of the given PIF.
 14.3494  
 14.3495   \noindent {\bf Signature:} 
 14.3496  \begin{verbatim} float get_io_read_kbs (session_id s, PIF ref self)\end{verbatim}
 14.3497 @@ -6617,7 +7116,7 @@ get accessor message derived from field 
 14.3498  \begin{tabular}{|c|c|p{7cm}|}
 14.3499   \hline
 14.3500  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3501 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3502 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3503  
 14.3504  \end{tabular}
 14.3505  
 14.3506 @@ -6636,7 +7135,7 @@ value of the field
 14.3507  \subsubsection{RPC name:~get\_io\_write\_kbs}
 14.3508  
 14.3509  {\bf Overview:} 
 14.3510 -get accessor message derived from field io/write\_kbs of object PIF
 14.3511 +Get the io/write\_kbs field of the given PIF.
 14.3512  
 14.3513   \noindent {\bf Signature:} 
 14.3514  \begin{verbatim} float get_io_write_kbs (session_id s, PIF ref self)\end{verbatim}
 14.3515 @@ -6649,7 +7148,7 @@ get accessor message derived from field 
 14.3516  \begin{tabular}{|c|c|p{7cm}|}
 14.3517   \hline
 14.3518  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3519 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3520 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3521  
 14.3522  \end{tabular}
 14.3523  
 14.3524 @@ -6668,7 +7167,7 @@ value of the field
 14.3525  \subsubsection{RPC name:~create}
 14.3526  
 14.3527  {\bf Overview:} 
 14.3528 -constructor for class PIF
 14.3529 +Create a new PIF instance, and return its handle.
 14.3530  
 14.3531   \noindent {\bf Signature:} 
 14.3532  \begin{verbatim} (PIF ref) create (session_id s, PIF record args)\end{verbatim}
 14.3533 @@ -6700,7 +7199,7 @@ reference to the newly created object
 14.3534  \subsubsection{RPC name:~destroy}
 14.3535  
 14.3536  {\bf Overview:} 
 14.3537 -destructor for class PIF
 14.3538 +Destroy the specified PIF instance.
 14.3539  
 14.3540   \noindent {\bf Signature:} 
 14.3541  \begin{verbatim} void destroy (session_id s, PIF ref self)\end{verbatim}
 14.3542 @@ -6713,7 +7212,7 @@ destructor for class PIF
 14.3543  \begin{tabular}{|c|c|p{7cm}|}
 14.3544   \hline
 14.3545  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3546 -{\tt PIF ref } & self & object instance \\ \hline 
 14.3547 +{\tt PIF ref } & self & reference to the object \\ \hline 
 14.3548  
 14.3549  \end{tabular}
 14.3550  
 14.3551 @@ -6732,7 +7231,7 @@ void
 14.3552  \subsubsection{RPC name:~get\_by\_uuid}
 14.3553  
 14.3554  {\bf Overview:} 
 14.3555 -returns the PIF instance with a particular uuid
 14.3556 +Get a reference to the PIF instance with the specified UUID.
 14.3557  
 14.3558   \noindent {\bf Signature:} 
 14.3559  \begin{verbatim} (PIF ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.3560 @@ -6764,7 +7263,7 @@ reference to the object
 14.3561  \subsubsection{RPC name:~get\_record}
 14.3562  
 14.3563  {\bf Overview:} 
 14.3564 -returns a record containing the state of an instance of class PIF
 14.3565 +Get a record containing the current state of the given PIF.
 14.3566  
 14.3567   \noindent {\bf Signature:} 
 14.3568  \begin{verbatim} (PIF record) get_record (session_id s, PIF ref self)\end{verbatim}
 14.3569 @@ -6878,7 +7377,7 @@ A list of all the IDs of all the Storage
 14.3570  \subsubsection{RPC name:~get\_uuid}
 14.3571  
 14.3572  {\bf Overview:} 
 14.3573 -get accessor message derived from field uuid of object SR
 14.3574 +Get the uuid field of the given SR.
 14.3575  
 14.3576   \noindent {\bf Signature:} 
 14.3577  \begin{verbatim} string get_uuid (session_id s, SR ref self)\end{verbatim}
 14.3578 @@ -6891,7 +7390,7 @@ get accessor message derived from field 
 14.3579  \begin{tabular}{|c|c|p{7cm}|}
 14.3580   \hline
 14.3581  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3582 -{\tt SR ref } & self & object instance \\ \hline 
 14.3583 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3584  
 14.3585  \end{tabular}
 14.3586  
 14.3587 @@ -6910,7 +7409,7 @@ value of the field
 14.3588  \subsubsection{RPC name:~get\_name\_label}
 14.3589  
 14.3590  {\bf Overview:} 
 14.3591 -get accessor message derived from field name/label of object SR
 14.3592 +Get the name/label field of the given SR.
 14.3593  
 14.3594   \noindent {\bf Signature:} 
 14.3595  \begin{verbatim} string get_name_label (session_id s, SR ref self)\end{verbatim}
 14.3596 @@ -6923,7 +7422,7 @@ get accessor message derived from field 
 14.3597  \begin{tabular}{|c|c|p{7cm}|}
 14.3598   \hline
 14.3599  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3600 -{\tt SR ref } & self & object instance \\ \hline 
 14.3601 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3602  
 14.3603  \end{tabular}
 14.3604  
 14.3605 @@ -6942,7 +7441,7 @@ value of the field
 14.3606  \subsubsection{RPC name:~set\_name\_label}
 14.3607  
 14.3608  {\bf Overview:} 
 14.3609 -set accessor message derived from field name/label of object SR
 14.3610 +Set the name/label field of the given SR.
 14.3611  
 14.3612   \noindent {\bf Signature:} 
 14.3613  \begin{verbatim} void set_name_label (session_id s, SR ref self, string value)\end{verbatim}
 14.3614 @@ -6955,7 +7454,7 @@ set accessor message derived from field 
 14.3615  \begin{tabular}{|c|c|p{7cm}|}
 14.3616   \hline
 14.3617  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3618 -{\tt SR ref } & self & object instance \\ \hline 
 14.3619 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3620  
 14.3621  {\tt string } & value & New value to set \\ \hline 
 14.3622  
 14.3623 @@ -6976,7 +7475,7 @@ void
 14.3624  \subsubsection{RPC name:~get\_name\_description}
 14.3625  
 14.3626  {\bf Overview:} 
 14.3627 -get accessor message derived from field name/description of object SR
 14.3628 +Get the name/description field of the given SR.
 14.3629  
 14.3630   \noindent {\bf Signature:} 
 14.3631  \begin{verbatim} string get_name_description (session_id s, SR ref self)\end{verbatim}
 14.3632 @@ -6989,7 +7488,7 @@ get accessor message derived from field 
 14.3633  \begin{tabular}{|c|c|p{7cm}|}
 14.3634   \hline
 14.3635  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3636 -{\tt SR ref } & self & object instance \\ \hline 
 14.3637 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3638  
 14.3639  \end{tabular}
 14.3640  
 14.3641 @@ -7008,7 +7507,7 @@ value of the field
 14.3642  \subsubsection{RPC name:~set\_name\_description}
 14.3643  
 14.3644  {\bf Overview:} 
 14.3645 -set accessor message derived from field name/description of object SR
 14.3646 +Set the name/description field of the given SR.
 14.3647  
 14.3648   \noindent {\bf Signature:} 
 14.3649  \begin{verbatim} void set_name_description (session_id s, SR ref self, string value)\end{verbatim}
 14.3650 @@ -7021,7 +7520,7 @@ set accessor message derived from field 
 14.3651  \begin{tabular}{|c|c|p{7cm}|}
 14.3652   \hline
 14.3653  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3654 -{\tt SR ref } & self & object instance \\ \hline 
 14.3655 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3656  
 14.3657  {\tt string } & value & New value to set \\ \hline 
 14.3658  
 14.3659 @@ -7042,7 +7541,7 @@ void
 14.3660  \subsubsection{RPC name:~get\_VDIs}
 14.3661  
 14.3662  {\bf Overview:} 
 14.3663 -get accessor message derived from field VDIs of object SR
 14.3664 +Get the VDIs field of the given SR.
 14.3665  
 14.3666   \noindent {\bf Signature:} 
 14.3667  \begin{verbatim} ((VDI ref) Set) get_VDIs (session_id s, SR ref self)\end{verbatim}
 14.3668 @@ -7055,7 +7554,7 @@ get accessor message derived from field 
 14.3669  \begin{tabular}{|c|c|p{7cm}|}
 14.3670   \hline
 14.3671  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3672 -{\tt SR ref } & self & object instance \\ \hline 
 14.3673 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3674  
 14.3675  \end{tabular}
 14.3676  
 14.3677 @@ -7074,7 +7573,7 @@ value of the field
 14.3678  \subsubsection{RPC name:~get\_virtual\_allocation}
 14.3679  
 14.3680  {\bf Overview:} 
 14.3681 -get accessor message derived from field virtual\_allocation of object SR
 14.3682 +Get the virtual\_allocation field of the given SR.
 14.3683  
 14.3684   \noindent {\bf Signature:} 
 14.3685  \begin{verbatim} int get_virtual_allocation (session_id s, SR ref self)\end{verbatim}
 14.3686 @@ -7087,7 +7586,7 @@ get accessor message derived from field 
 14.3687  \begin{tabular}{|c|c|p{7cm}|}
 14.3688   \hline
 14.3689  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3690 -{\tt SR ref } & self & object instance \\ \hline 
 14.3691 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3692  
 14.3693  \end{tabular}
 14.3694  
 14.3695 @@ -7106,7 +7605,7 @@ value of the field
 14.3696  \subsubsection{RPC name:~get\_physical\_utilisation}
 14.3697  
 14.3698  {\bf Overview:} 
 14.3699 -get accessor message derived from field physical\_utilisation of object SR
 14.3700 +Get the physical\_utilisation field of the given SR.
 14.3701  
 14.3702   \noindent {\bf Signature:} 
 14.3703  \begin{verbatim} int get_physical_utilisation (session_id s, SR ref self)\end{verbatim}
 14.3704 @@ -7119,7 +7618,7 @@ get accessor message derived from field 
 14.3705  \begin{tabular}{|c|c|p{7cm}|}
 14.3706   \hline
 14.3707  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3708 -{\tt SR ref } & self & object instance \\ \hline 
 14.3709 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3710  
 14.3711  \end{tabular}
 14.3712  
 14.3713 @@ -7138,7 +7637,7 @@ value of the field
 14.3714  \subsubsection{RPC name:~get\_physical\_size}
 14.3715  
 14.3716  {\bf Overview:} 
 14.3717 -get accessor message derived from field physical\_size of object SR
 14.3718 +Get the physical\_size field of the given SR.
 14.3719  
 14.3720   \noindent {\bf Signature:} 
 14.3721  \begin{verbatim} int get_physical_size (session_id s, SR ref self)\end{verbatim}
 14.3722 @@ -7151,7 +7650,7 @@ get accessor message derived from field 
 14.3723  \begin{tabular}{|c|c|p{7cm}|}
 14.3724   \hline
 14.3725  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3726 -{\tt SR ref } & self & object instance \\ \hline 
 14.3727 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3728  
 14.3729  \end{tabular}
 14.3730  
 14.3731 @@ -7170,7 +7669,7 @@ value of the field
 14.3732  \subsubsection{RPC name:~get\_type}
 14.3733  
 14.3734  {\bf Overview:} 
 14.3735 -get accessor message derived from field type of object SR
 14.3736 +Get the type field of the given SR.
 14.3737  
 14.3738   \noindent {\bf Signature:} 
 14.3739  \begin{verbatim} string get_type (session_id s, SR ref self)\end{verbatim}
 14.3740 @@ -7183,7 +7682,7 @@ get accessor message derived from field 
 14.3741  \begin{tabular}{|c|c|p{7cm}|}
 14.3742   \hline
 14.3743  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3744 -{\tt SR ref } & self & object instance \\ \hline 
 14.3745 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3746  
 14.3747  \end{tabular}
 14.3748  
 14.3749 @@ -7202,7 +7701,7 @@ value of the field
 14.3750  \subsubsection{RPC name:~get\_location}
 14.3751  
 14.3752  {\bf Overview:} 
 14.3753 -get accessor message derived from field location of object SR
 14.3754 +Get the location field of the given SR.
 14.3755  
 14.3756   \noindent {\bf Signature:} 
 14.3757  \begin{verbatim} string get_location (session_id s, SR ref self)\end{verbatim}
 14.3758 @@ -7215,7 +7714,7 @@ get accessor message derived from field 
 14.3759  \begin{tabular}{|c|c|p{7cm}|}
 14.3760   \hline
 14.3761  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3762 -{\tt SR ref } & self & object instance \\ \hline 
 14.3763 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3764  
 14.3765  \end{tabular}
 14.3766  
 14.3767 @@ -7234,7 +7733,7 @@ value of the field
 14.3768  \subsubsection{RPC name:~create}
 14.3769  
 14.3770  {\bf Overview:} 
 14.3771 -constructor for class SR
 14.3772 +Create a new SR instance, and return its handle.
 14.3773  
 14.3774   \noindent {\bf Signature:} 
 14.3775  \begin{verbatim} (SR ref) create (session_id s, SR record args)\end{verbatim}
 14.3776 @@ -7266,7 +7765,7 @@ reference to the newly created object
 14.3777  \subsubsection{RPC name:~destroy}
 14.3778  
 14.3779  {\bf Overview:} 
 14.3780 -destructor for class SR
 14.3781 +Destroy the specified SR instance.
 14.3782  
 14.3783   \noindent {\bf Signature:} 
 14.3784  \begin{verbatim} void destroy (session_id s, SR ref self)\end{verbatim}
 14.3785 @@ -7279,7 +7778,7 @@ destructor for class SR
 14.3786  \begin{tabular}{|c|c|p{7cm}|}
 14.3787   \hline
 14.3788  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3789 -{\tt SR ref } & self & object instance \\ \hline 
 14.3790 +{\tt SR ref } & self & reference to the object \\ \hline 
 14.3791  
 14.3792  \end{tabular}
 14.3793  
 14.3794 @@ -7298,7 +7797,7 @@ void
 14.3795  \subsubsection{RPC name:~get\_by\_uuid}
 14.3796  
 14.3797  {\bf Overview:} 
 14.3798 -returns the SR instance with a particular uuid
 14.3799 +Get a reference to the SR instance with the specified UUID.
 14.3800  
 14.3801   \noindent {\bf Signature:} 
 14.3802  \begin{verbatim} (SR ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.3803 @@ -7330,7 +7829,7 @@ reference to the object
 14.3804  \subsubsection{RPC name:~get\_record}
 14.3805  
 14.3806  {\bf Overview:} 
 14.3807 -returns a record containing the state of an instance of class SR
 14.3808 +Get a record containing the current state of the given SR.
 14.3809  
 14.3810   \noindent {\bf Signature:} 
 14.3811  \begin{verbatim} (SR record) get_record (session_id s, SR ref self)\end{verbatim}
 14.3812 @@ -7362,7 +7861,7 @@ all fields from the object
 14.3813  \subsubsection{RPC name:~get\_by\_name\_label}
 14.3814  
 14.3815  {\bf Overview:} 
 14.3816 -returns the SR instance with a particular name label
 14.3817 +Get all the SR instances with the given label.
 14.3818  
 14.3819   \noindent {\bf Signature:} 
 14.3820  \begin{verbatim} ((SR ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
 14.3821 @@ -7488,7 +7987,7 @@ void
 14.3822  \subsubsection{RPC name:~get\_uuid}
 14.3823  
 14.3824  {\bf Overview:} 
 14.3825 -get accessor message derived from field uuid of object VDI
 14.3826 +Get the uuid field of the given VDI.
 14.3827  
 14.3828   \noindent {\bf Signature:} 
 14.3829  \begin{verbatim} string get_uuid (session_id s, VDI ref self)\end{verbatim}
 14.3830 @@ -7501,7 +8000,7 @@ get accessor message derived from field 
 14.3831  \begin{tabular}{|c|c|p{7cm}|}
 14.3832   \hline
 14.3833  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3834 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3835 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3836  
 14.3837  \end{tabular}
 14.3838  
 14.3839 @@ -7520,7 +8019,7 @@ value of the field
 14.3840  \subsubsection{RPC name:~get\_name\_label}
 14.3841  
 14.3842  {\bf Overview:} 
 14.3843 -get accessor message derived from field name/label of object VDI
 14.3844 +Get the name/label field of the given VDI.
 14.3845  
 14.3846   \noindent {\bf Signature:} 
 14.3847  \begin{verbatim} string get_name_label (session_id s, VDI ref self)\end{verbatim}
 14.3848 @@ -7533,7 +8032,7 @@ get accessor message derived from field 
 14.3849  \begin{tabular}{|c|c|p{7cm}|}
 14.3850   \hline
 14.3851  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3852 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3853 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3854  
 14.3855  \end{tabular}
 14.3856  
 14.3857 @@ -7552,7 +8051,7 @@ value of the field
 14.3858  \subsubsection{RPC name:~set\_name\_label}
 14.3859  
 14.3860  {\bf Overview:} 
 14.3861 -set accessor message derived from field name/label of object VDI
 14.3862 +Set the name/label field of the given VDI.
 14.3863  
 14.3864   \noindent {\bf Signature:} 
 14.3865  \begin{verbatim} void set_name_label (session_id s, VDI ref self, string value)\end{verbatim}
 14.3866 @@ -7565,7 +8064,7 @@ set accessor message derived from field 
 14.3867  \begin{tabular}{|c|c|p{7cm}|}
 14.3868   \hline
 14.3869  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3870 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3871 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3872  
 14.3873  {\tt string } & value & New value to set \\ \hline 
 14.3874  
 14.3875 @@ -7586,7 +8085,7 @@ void
 14.3876  \subsubsection{RPC name:~get\_name\_description}
 14.3877  
 14.3878  {\bf Overview:} 
 14.3879 -get accessor message derived from field name/description of object VDI
 14.3880 +Get the name/description field of the given VDI.
 14.3881  
 14.3882   \noindent {\bf Signature:} 
 14.3883  \begin{verbatim} string get_name_description (session_id s, VDI ref self)\end{verbatim}
 14.3884 @@ -7599,7 +8098,7 @@ get accessor message derived from field 
 14.3885  \begin{tabular}{|c|c|p{7cm}|}
 14.3886   \hline
 14.3887  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3888 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3889 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3890  
 14.3891  \end{tabular}
 14.3892  
 14.3893 @@ -7618,7 +8117,7 @@ value of the field
 14.3894  \subsubsection{RPC name:~set\_name\_description}
 14.3895  
 14.3896  {\bf Overview:} 
 14.3897 -set accessor message derived from field name/description of object VDI
 14.3898 +Set the name/description field of the given VDI.
 14.3899  
 14.3900   \noindent {\bf Signature:} 
 14.3901  \begin{verbatim} void set_name_description (session_id s, VDI ref self, string value)\end{verbatim}
 14.3902 @@ -7631,7 +8130,7 @@ set accessor message derived from field 
 14.3903  \begin{tabular}{|c|c|p{7cm}|}
 14.3904   \hline
 14.3905  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3906 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3907 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3908  
 14.3909  {\tt string } & value & New value to set \\ \hline 
 14.3910  
 14.3911 @@ -7652,7 +8151,7 @@ void
 14.3912  \subsubsection{RPC name:~get\_SR}
 14.3913  
 14.3914  {\bf Overview:} 
 14.3915 -get accessor message derived from field SR of object VDI
 14.3916 +Get the SR field of the given VDI.
 14.3917  
 14.3918   \noindent {\bf Signature:} 
 14.3919  \begin{verbatim} (SR ref) get_SR (session_id s, VDI ref self)\end{verbatim}
 14.3920 @@ -7665,7 +8164,7 @@ get accessor message derived from field 
 14.3921  \begin{tabular}{|c|c|p{7cm}|}
 14.3922   \hline
 14.3923  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3924 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3925 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3926  
 14.3927  \end{tabular}
 14.3928  
 14.3929 @@ -7684,7 +8183,7 @@ value of the field
 14.3930  \subsubsection{RPC name:~set\_SR}
 14.3931  
 14.3932  {\bf Overview:} 
 14.3933 -set accessor message derived from field SR of object VDI
 14.3934 +Set the SR field of the given VDI.
 14.3935  
 14.3936   \noindent {\bf Signature:} 
 14.3937  \begin{verbatim} void set_SR (session_id s, VDI ref self, SR ref value)\end{verbatim}
 14.3938 @@ -7697,7 +8196,7 @@ set accessor message derived from field 
 14.3939  \begin{tabular}{|c|c|p{7cm}|}
 14.3940   \hline
 14.3941  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3942 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3943 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3944  
 14.3945  {\tt SR ref } & value & New value to set \\ \hline 
 14.3946  
 14.3947 @@ -7718,7 +8217,7 @@ void
 14.3948  \subsubsection{RPC name:~get\_VBDs}
 14.3949  
 14.3950  {\bf Overview:} 
 14.3951 -get accessor message derived from field VBDs of object VDI
 14.3952 +Get the VBDs field of the given VDI.
 14.3953  
 14.3954   \noindent {\bf Signature:} 
 14.3955  \begin{verbatim} ((VBD ref) Set) get_VBDs (session_id s, VDI ref self)\end{verbatim}
 14.3956 @@ -7731,7 +8230,7 @@ get accessor message derived from field 
 14.3957  \begin{tabular}{|c|c|p{7cm}|}
 14.3958   \hline
 14.3959  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3960 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3961 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3962  
 14.3963  \end{tabular}
 14.3964  
 14.3965 @@ -7750,7 +8249,7 @@ value of the field
 14.3966  \subsubsection{RPC name:~get\_virtual\_size}
 14.3967  
 14.3968  {\bf Overview:} 
 14.3969 -get accessor message derived from field virtual\_size of object VDI
 14.3970 +Get the virtual\_size field of the given VDI.
 14.3971  
 14.3972   \noindent {\bf Signature:} 
 14.3973  \begin{verbatim} int get_virtual_size (session_id s, VDI ref self)\end{verbatim}
 14.3974 @@ -7763,7 +8262,7 @@ get accessor message derived from field 
 14.3975  \begin{tabular}{|c|c|p{7cm}|}
 14.3976   \hline
 14.3977  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3978 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3979 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3980  
 14.3981  \end{tabular}
 14.3982  
 14.3983 @@ -7782,7 +8281,7 @@ value of the field
 14.3984  \subsubsection{RPC name:~set\_virtual\_size}
 14.3985  
 14.3986  {\bf Overview:} 
 14.3987 -set accessor message derived from field virtual\_size of object VDI
 14.3988 +Set the virtual\_size field of the given VDI.
 14.3989  
 14.3990   \noindent {\bf Signature:} 
 14.3991  \begin{verbatim} void set_virtual_size (session_id s, VDI ref self, int value)\end{verbatim}
 14.3992 @@ -7795,7 +8294,7 @@ set accessor message derived from field 
 14.3993  \begin{tabular}{|c|c|p{7cm}|}
 14.3994   \hline
 14.3995  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.3996 -{\tt VDI ref } & self & object instance \\ \hline 
 14.3997 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.3998  
 14.3999  {\tt int } & value & New value to set \\ \hline 
 14.4000  
 14.4001 @@ -7816,7 +8315,7 @@ void
 14.4002  \subsubsection{RPC name:~get\_physical\_utilisation}
 14.4003  
 14.4004  {\bf Overview:} 
 14.4005 -get accessor message derived from field physical\_utilisation of object VDI
 14.4006 +Get the physical\_utilisation field of the given VDI.
 14.4007  
 14.4008   \noindent {\bf Signature:} 
 14.4009  \begin{verbatim} int get_physical_utilisation (session_id s, VDI ref self)\end{verbatim}
 14.4010 @@ -7829,7 +8328,7 @@ get accessor message derived from field 
 14.4011  \begin{tabular}{|c|c|p{7cm}|}
 14.4012   \hline
 14.4013  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4014 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4015 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4016  
 14.4017  \end{tabular}
 14.4018  
 14.4019 @@ -7848,7 +8347,7 @@ value of the field
 14.4020  \subsubsection{RPC name:~get\_sector\_size}
 14.4021  
 14.4022  {\bf Overview:} 
 14.4023 -get accessor message derived from field sector\_size of object VDI
 14.4024 +Get the sector\_size field of the given VDI.
 14.4025  
 14.4026   \noindent {\bf Signature:} 
 14.4027  \begin{verbatim} int get_sector_size (session_id s, VDI ref self)\end{verbatim}
 14.4028 @@ -7861,7 +8360,7 @@ get accessor message derived from field 
 14.4029  \begin{tabular}{|c|c|p{7cm}|}
 14.4030   \hline
 14.4031  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4032 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4033 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4034  
 14.4035  \end{tabular}
 14.4036  
 14.4037 @@ -7880,7 +8379,7 @@ value of the field
 14.4038  \subsubsection{RPC name:~get\_type}
 14.4039  
 14.4040  {\bf Overview:} 
 14.4041 -get accessor message derived from field type of object VDI
 14.4042 +Get the type field of the given VDI.
 14.4043  
 14.4044   \noindent {\bf Signature:} 
 14.4045  \begin{verbatim} (vdi_type) get_type (session_id s, VDI ref self)\end{verbatim}
 14.4046 @@ -7893,7 +8392,7 @@ get accessor message derived from field 
 14.4047  \begin{tabular}{|c|c|p{7cm}|}
 14.4048   \hline
 14.4049  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4050 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4051 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4052  
 14.4053  \end{tabular}
 14.4054  
 14.4055 @@ -7912,7 +8411,7 @@ value of the field
 14.4056  \subsubsection{RPC name:~get\_parent}
 14.4057  
 14.4058  {\bf Overview:} 
 14.4059 -get accessor message derived from field parent of object VDI
 14.4060 +Get the parent field of the given VDI.
 14.4061  
 14.4062   \noindent {\bf Signature:} 
 14.4063  \begin{verbatim} (VDI ref) get_parent (session_id s, VDI ref self)\end{verbatim}
 14.4064 @@ -7925,7 +8424,7 @@ get accessor message derived from field 
 14.4065  \begin{tabular}{|c|c|p{7cm}|}
 14.4066   \hline
 14.4067  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4068 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4069 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4070  
 14.4071  \end{tabular}
 14.4072  
 14.4073 @@ -7944,7 +8443,7 @@ value of the field
 14.4074  \subsubsection{RPC name:~get\_children}
 14.4075  
 14.4076  {\bf Overview:} 
 14.4077 -get accessor message derived from field children of object VDI
 14.4078 +Get the children field of the given VDI.
 14.4079  
 14.4080   \noindent {\bf Signature:} 
 14.4081  \begin{verbatim} ((VDI ref) Set) get_children (session_id s, VDI ref self)\end{verbatim}
 14.4082 @@ -7957,7 +8456,7 @@ get accessor message derived from field 
 14.4083  \begin{tabular}{|c|c|p{7cm}|}
 14.4084   \hline
 14.4085  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4086 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4087 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4088  
 14.4089  \end{tabular}
 14.4090  
 14.4091 @@ -7976,7 +8475,7 @@ value of the field
 14.4092  \subsubsection{RPC name:~get\_sharable}
 14.4093  
 14.4094  {\bf Overview:} 
 14.4095 -get accessor message derived from field sharable of object VDI
 14.4096 +Get the sharable field of the given VDI.
 14.4097  
 14.4098   \noindent {\bf Signature:} 
 14.4099  \begin{verbatim} bool get_sharable (session_id s, VDI ref self)\end{verbatim}
 14.4100 @@ -7989,7 +8488,7 @@ get accessor message derived from field 
 14.4101  \begin{tabular}{|c|c|p{7cm}|}
 14.4102   \hline
 14.4103  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4104 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4105 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4106  
 14.4107  \end{tabular}
 14.4108  
 14.4109 @@ -8008,7 +8507,7 @@ value of the field
 14.4110  \subsubsection{RPC name:~set\_sharable}
 14.4111  
 14.4112  {\bf Overview:} 
 14.4113 -set accessor message derived from field sharable of object VDI
 14.4114 +Set the sharable field of the given VDI.
 14.4115  
 14.4116   \noindent {\bf Signature:} 
 14.4117  \begin{verbatim} void set_sharable (session_id s, VDI ref self, bool value)\end{verbatim}
 14.4118 @@ -8021,7 +8520,7 @@ set accessor message derived from field 
 14.4119  \begin{tabular}{|c|c|p{7cm}|}
 14.4120   \hline
 14.4121  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4122 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4123 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4124  
 14.4125  {\tt bool } & value & New value to set \\ \hline 
 14.4126  
 14.4127 @@ -8042,7 +8541,7 @@ void
 14.4128  \subsubsection{RPC name:~get\_read\_only}
 14.4129  
 14.4130  {\bf Overview:} 
 14.4131 -get accessor message derived from field read\_only of object VDI
 14.4132 +Get the read\_only field of the given VDI.
 14.4133  
 14.4134   \noindent {\bf Signature:} 
 14.4135  \begin{verbatim} bool get_read_only (session_id s, VDI ref self)\end{verbatim}
 14.4136 @@ -8055,7 +8554,7 @@ get accessor message derived from field 
 14.4137  \begin{tabular}{|c|c|p{7cm}|}
 14.4138   \hline
 14.4139  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4140 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4141 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4142  
 14.4143  \end{tabular}
 14.4144  
 14.4145 @@ -8074,7 +8573,7 @@ value of the field
 14.4146  \subsubsection{RPC name:~set\_read\_only}
 14.4147  
 14.4148  {\bf Overview:} 
 14.4149 -set accessor message derived from field read\_only of object VDI
 14.4150 +Set the read\_only field of the given VDI.
 14.4151  
 14.4152   \noindent {\bf Signature:} 
 14.4153  \begin{verbatim} void set_read_only (session_id s, VDI ref self, bool value)\end{verbatim}
 14.4154 @@ -8087,7 +8586,7 @@ set accessor message derived from field 
 14.4155  \begin{tabular}{|c|c|p{7cm}|}
 14.4156   \hline
 14.4157  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4158 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4159 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4160  
 14.4161  {\tt bool } & value & New value to set \\ \hline 
 14.4162  
 14.4163 @@ -8108,7 +8607,7 @@ void
 14.4164  \subsubsection{RPC name:~create}
 14.4165  
 14.4166  {\bf Overview:} 
 14.4167 -constructor for class VDI
 14.4168 +Create a new VDI instance, and return its handle.
 14.4169  
 14.4170   \noindent {\bf Signature:} 
 14.4171  \begin{verbatim} (VDI ref) create (session_id s, VDI record args)\end{verbatim}
 14.4172 @@ -8140,7 +8639,7 @@ reference to the newly created object
 14.4173  \subsubsection{RPC name:~destroy}
 14.4174  
 14.4175  {\bf Overview:} 
 14.4176 -destructor for class VDI
 14.4177 +Destroy the specified VDI instance.
 14.4178  
 14.4179   \noindent {\bf Signature:} 
 14.4180  \begin{verbatim} void destroy (session_id s, VDI ref self)\end{verbatim}
 14.4181 @@ -8153,7 +8652,7 @@ destructor for class VDI
 14.4182  \begin{tabular}{|c|c|p{7cm}|}
 14.4183   \hline
 14.4184  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4185 -{\tt VDI ref } & self & object instance \\ \hline 
 14.4186 +{\tt VDI ref } & self & reference to the object \\ \hline 
 14.4187  
 14.4188  \end{tabular}
 14.4189  
 14.4190 @@ -8172,7 +8671,7 @@ void
 14.4191  \subsubsection{RPC name:~get\_by\_uuid}
 14.4192  
 14.4193  {\bf Overview:} 
 14.4194 -returns the VDI instance with a particular uuid
 14.4195 +Get a reference to the VDI instance with the specified UUID.
 14.4196  
 14.4197   \noindent {\bf Signature:} 
 14.4198  \begin{verbatim} (VDI ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.4199 @@ -8204,7 +8703,7 @@ reference to the object
 14.4200  \subsubsection{RPC name:~get\_record}
 14.4201  
 14.4202  {\bf Overview:} 
 14.4203 -returns a record containing the state of an instance of class VDI
 14.4204 +Get a record containing the current state of the given VDI.
 14.4205  
 14.4206   \noindent {\bf Signature:} 
 14.4207  \begin{verbatim} (VDI record) get_record (session_id s, VDI ref self)\end{verbatim}
 14.4208 @@ -8236,7 +8735,7 @@ all fields from the object
 14.4209  \subsubsection{RPC name:~get\_by\_name\_label}
 14.4210  
 14.4211  {\bf Overview:} 
 14.4212 -returns the VDI instance with a particular name label
 14.4213 +Get all the VDI instances with the given label.
 14.4214  
 14.4215   \noindent {\bf Signature:} 
 14.4216  \begin{verbatim} ((VDI ref) Set) get_by_name_label (session_id s, string label)\end{verbatim}
 14.4217 @@ -8282,6 +8781,7 @@ Quals & Field & Type & Description \\
 14.4218  $\mathit{RW}$ &  {\tt VDI} & VDI ref & the virtual disk \\
 14.4219  $\mathit{RW}$ &  {\tt device} & string & device seen by the guest e.g. hda1 \\
 14.4220  $\mathit{RW}$ &  {\tt mode} & vbd\_mode & the mode the disk should be mounted with \\
 14.4221 +$\mathit{RW}$ &  {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\
 14.4222  $\mathit{RW}$ &  {\tt driver} & driver\_type & the style of driver \\
 14.4223  $\mathit{RO}_\mathit{run}$ &  {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
 14.4224  $\mathit{RO}_\mathit{run}$ &  {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\
 14.4225 @@ -8325,7 +8825,7 @@ void
 14.4226  \subsubsection{RPC name:~get\_uuid}
 14.4227  
 14.4228  {\bf Overview:} 
 14.4229 -get accessor message derived from field uuid of object VBD
 14.4230 +Get the uuid field of the given VBD.
 14.4231  
 14.4232   \noindent {\bf Signature:} 
 14.4233  \begin{verbatim} string get_uuid (session_id s, VBD ref self)\end{verbatim}
 14.4234 @@ -8338,7 +8838,7 @@ get accessor message derived from field 
 14.4235  \begin{tabular}{|c|c|p{7cm}|}
 14.4236   \hline
 14.4237  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4238 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4239 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4240  
 14.4241  \end{tabular}
 14.4242  
 14.4243 @@ -8357,7 +8857,7 @@ value of the field
 14.4244  \subsubsection{RPC name:~get\_VM}
 14.4245  
 14.4246  {\bf Overview:} 
 14.4247 -get accessor message derived from field VM of object VBD
 14.4248 +Get the VM field of the given VBD.
 14.4249  
 14.4250   \noindent {\bf Signature:} 
 14.4251  \begin{verbatim} (VM ref) get_VM (session_id s, VBD ref self)\end{verbatim}
 14.4252 @@ -8370,7 +8870,7 @@ get accessor message derived from field 
 14.4253  \begin{tabular}{|c|c|p{7cm}|}
 14.4254   \hline
 14.4255  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4256 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4257 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4258  
 14.4259  \end{tabular}
 14.4260  
 14.4261 @@ -8389,7 +8889,7 @@ value of the field
 14.4262  \subsubsection{RPC name:~set\_VM}
 14.4263  
 14.4264  {\bf Overview:} 
 14.4265 -set accessor message derived from field VM of object VBD
 14.4266 +Set the VM field of the given VBD.
 14.4267  
 14.4268   \noindent {\bf Signature:} 
 14.4269  \begin{verbatim} void set_VM (session_id s, VBD ref self, VM ref value)\end{verbatim}
 14.4270 @@ -8402,7 +8902,7 @@ set accessor message derived from field 
 14.4271  \begin{tabular}{|c|c|p{7cm}|}
 14.4272   \hline
 14.4273  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4274 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4275 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4276  
 14.4277  {\tt VM ref } & value & New value to set \\ \hline 
 14.4278  
 14.4279 @@ -8423,7 +8923,7 @@ void
 14.4280  \subsubsection{RPC name:~get\_VDI}
 14.4281  
 14.4282  {\bf Overview:} 
 14.4283 -get accessor message derived from field VDI of object VBD
 14.4284 +Get the VDI field of the given VBD.
 14.4285  
 14.4286   \noindent {\bf Signature:} 
 14.4287  \begin{verbatim} (VDI ref) get_VDI (session_id s, VBD ref self)\end{verbatim}
 14.4288 @@ -8436,7 +8936,7 @@ get accessor message derived from field 
 14.4289  \begin{tabular}{|c|c|p{7cm}|}
 14.4290   \hline
 14.4291  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4292 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4293 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4294  
 14.4295  \end{tabular}
 14.4296  
 14.4297 @@ -8455,7 +8955,7 @@ value of the field
 14.4298  \subsubsection{RPC name:~set\_VDI}
 14.4299  
 14.4300  {\bf Overview:} 
 14.4301 -set accessor message derived from field VDI of object VBD
 14.4302 +Set the VDI field of the given VBD.
 14.4303  
 14.4304   \noindent {\bf Signature:} 
 14.4305  \begin{verbatim} void set_VDI (session_id s, VBD ref self, VDI ref value)\end{verbatim}
 14.4306 @@ -8468,7 +8968,7 @@ set accessor message derived from field 
 14.4307  \begin{tabular}{|c|c|p{7cm}|}
 14.4308   \hline
 14.4309  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4310 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4311 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4312  
 14.4313  {\tt VDI ref } & value & New value to set \\ \hline 
 14.4314  
 14.4315 @@ -8489,7 +8989,7 @@ void
 14.4316  \subsubsection{RPC name:~get\_device}
 14.4317  
 14.4318  {\bf Overview:} 
 14.4319 -get accessor message derived from field device of object VBD
 14.4320 +Get the device field of the given VBD.
 14.4321  
 14.4322   \noindent {\bf Signature:} 
 14.4323  \begin{verbatim} string get_device (session_id s, VBD ref self)\end{verbatim}
 14.4324 @@ -8502,7 +9002,7 @@ get accessor message derived from field 
 14.4325  \begin{tabular}{|c|c|p{7cm}|}
 14.4326   \hline
 14.4327  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4328 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4329 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4330  
 14.4331  \end{tabular}
 14.4332  
 14.4333 @@ -8521,7 +9021,7 @@ value of the field
 14.4334  \subsubsection{RPC name:~set\_device}
 14.4335  
 14.4336  {\bf Overview:} 
 14.4337 -set accessor message derived from field device of object VBD
 14.4338 +Set the device field of the given VBD.
 14.4339  
 14.4340   \noindent {\bf Signature:} 
 14.4341  \begin{verbatim} void set_device (session_id s, VBD ref self, string value)\end{verbatim}
 14.4342 @@ -8534,7 +9034,7 @@ set accessor message derived from field 
 14.4343  \begin{tabular}{|c|c|p{7cm}|}
 14.4344   \hline
 14.4345  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4346 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4347 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4348  
 14.4349  {\tt string } & value & New value to set \\ \hline 
 14.4350  
 14.4351 @@ -8555,7 +9055,7 @@ void
 14.4352  \subsubsection{RPC name:~get\_mode}
 14.4353  
 14.4354  {\bf Overview:} 
 14.4355 -get accessor message derived from field mode of object VBD
 14.4356 +Get the mode field of the given VBD.
 14.4357  
 14.4358   \noindent {\bf Signature:} 
 14.4359  \begin{verbatim} (vbd_mode) get_mode (session_id s, VBD ref self)\end{verbatim}
 14.4360 @@ -8568,7 +9068,7 @@ get accessor message derived from field 
 14.4361  \begin{tabular}{|c|c|p{7cm}|}
 14.4362   \hline
 14.4363  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4364 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4365 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4366  
 14.4367  \end{tabular}
 14.4368  
 14.4369 @@ -8587,7 +9087,7 @@ value of the field
 14.4370  \subsubsection{RPC name:~set\_mode}
 14.4371  
 14.4372  {\bf Overview:} 
 14.4373 -set accessor message derived from field mode of object VBD
 14.4374 +Set the mode field of the given VBD.
 14.4375  
 14.4376   \noindent {\bf Signature:} 
 14.4377  \begin{verbatim} void set_mode (session_id s, VBD ref self, vbd_mode value)\end{verbatim}
 14.4378 @@ -8600,7 +9100,7 @@ set accessor message derived from field 
 14.4379  \begin{tabular}{|c|c|p{7cm}|}
 14.4380   \hline
 14.4381  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4382 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4383 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4384  
 14.4385  {\tt vbd\_mode } & value & New value to set \\ \hline 
 14.4386  
 14.4387 @@ -8618,10 +9118,76 @@ void
 14.4388  \vspace{0.3cm}
 14.4389  \vspace{0.3cm}
 14.4390  \vspace{0.3cm}
 14.4391 +\subsubsection{RPC name:~get\_type}
 14.4392 +
 14.4393 +{\bf Overview:} 
 14.4394 +Get the type field of the given VBD.
 14.4395 +
 14.4396 + \noindent {\bf Signature:} 
 14.4397 +\begin{verbatim} (vbd_type) get_type (session_id s, VBD ref self)\end{verbatim}
 14.4398 +
 14.4399 +
 14.4400 +\noindent{\bf Arguments:}
 14.4401 +
 14.4402 + 
 14.4403 +\vspace{0.3cm}
 14.4404 +\begin{tabular}{|c|c|p{7cm}|}
 14.4405 + \hline
 14.4406 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4407 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4408 +
 14.4409 +\end{tabular}
 14.4410 +
 14.4411 +\vspace{0.3cm}
 14.4412 +
 14.4413 + \noindent {\bf Return Type:} 
 14.4414 +{\tt 
 14.4415 +vbd\_type
 14.4416 +}
 14.4417 +
 14.4418 +
 14.4419 +value of the field
 14.4420 +\vspace{0.3cm}
 14.4421 +\vspace{0.3cm}
 14.4422 +\vspace{0.3cm}
 14.4423 +\subsubsection{RPC name:~set\_type}
 14.4424 +
 14.4425 +{\bf Overview:} 
 14.4426 +Set the type field of the given VBD.
 14.4427 +
 14.4428 + \noindent {\bf Signature:} 
 14.4429 +\begin{verbatim} void set_type (session_id s, VBD ref self, vbd_type value)\end{verbatim}
 14.4430 +
 14.4431 +
 14.4432 +\noindent{\bf Arguments:}
 14.4433 +
 14.4434 + 
 14.4435 +\vspace{0.3cm}
 14.4436 +\begin{tabular}{|c|c|p{7cm}|}
 14.4437 + \hline
 14.4438 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4439 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4440 +
 14.4441 +{\tt vbd\_type } & value & New value to set \\ \hline 
 14.4442 +
 14.4443 +\end{tabular}
 14.4444 +
 14.4445 +\vspace{0.3cm}
 14.4446 +
 14.4447 + \noindent {\bf Return Type:} 
 14.4448 +{\tt 
 14.4449 +void
 14.4450 +}
 14.4451 +
 14.4452 +
 14.4453 +
 14.4454 +\vspace{0.3cm}
 14.4455 +\vspace{0.3cm}
 14.4456 +\vspace{0.3cm}
 14.4457  \subsubsection{RPC name:~get\_driver}
 14.4458  
 14.4459  {\bf Overview:} 
 14.4460 -get accessor message derived from field driver of object VBD
 14.4461 +Get the driver field of the given VBD.
 14.4462  
 14.4463   \noindent {\bf Signature:} 
 14.4464  \begin{verbatim} (driver_type) get_driver (session_id s, VBD ref self)\end{verbatim}
 14.4465 @@ -8634,7 +9200,7 @@ get accessor message derived from field 
 14.4466  \begin{tabular}{|c|c|p{7cm}|}
 14.4467   \hline
 14.4468  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4469 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4470 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4471  
 14.4472  \end{tabular}
 14.4473  
 14.4474 @@ -8653,7 +9219,7 @@ value of the field
 14.4475  \subsubsection{RPC name:~set\_driver}
 14.4476  
 14.4477  {\bf Overview:} 
 14.4478 -set accessor message derived from field driver of object VBD
 14.4479 +Set the driver field of the given VBD.
 14.4480  
 14.4481   \noindent {\bf Signature:} 
 14.4482  \begin{verbatim} void set_driver (session_id s, VBD ref self, driver_type value)\end{verbatim}
 14.4483 @@ -8666,7 +9232,7 @@ set accessor message derived from field 
 14.4484  \begin{tabular}{|c|c|p{7cm}|}
 14.4485   \hline
 14.4486  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4487 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4488 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4489  
 14.4490  {\tt driver\_type } & value & New value to set \\ \hline 
 14.4491  
 14.4492 @@ -8687,7 +9253,7 @@ void
 14.4493  \subsubsection{RPC name:~get\_io\_read\_kbs}
 14.4494  
 14.4495  {\bf Overview:} 
 14.4496 -get accessor message derived from field io/read\_kbs of object VBD
 14.4497 +Get the io/read\_kbs field of the given VBD.
 14.4498  
 14.4499   \noindent {\bf Signature:} 
 14.4500  \begin{verbatim} float get_io_read_kbs (session_id s, VBD ref self)\end{verbatim}
 14.4501 @@ -8700,7 +9266,7 @@ get accessor message derived from field 
 14.4502  \begin{tabular}{|c|c|p{7cm}|}
 14.4503   \hline
 14.4504  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4505 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4506 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4507  
 14.4508  \end{tabular}
 14.4509  
 14.4510 @@ -8719,7 +9285,7 @@ value of the field
 14.4511  \subsubsection{RPC name:~get\_io\_write\_kbs}
 14.4512  
 14.4513  {\bf Overview:} 
 14.4514 -get accessor message derived from field io/write\_kbs of object VBD
 14.4515 +Get the io/write\_kbs field of the given VBD.
 14.4516  
 14.4517   \noindent {\bf Signature:} 
 14.4518  \begin{verbatim} float get_io_write_kbs (session_id s, VBD ref self)\end{verbatim}
 14.4519 @@ -8732,7 +9298,7 @@ get accessor message derived from field 
 14.4520  \begin{tabular}{|c|c|p{7cm}|}
 14.4521   \hline
 14.4522  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4523 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4524 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4525  
 14.4526  \end{tabular}
 14.4527  
 14.4528 @@ -8751,7 +9317,7 @@ value of the field
 14.4529  \subsubsection{RPC name:~create}
 14.4530  
 14.4531  {\bf Overview:} 
 14.4532 -constructor for class VBD
 14.4533 +Create a new VBD instance, and return its handle.
 14.4534  
 14.4535   \noindent {\bf Signature:} 
 14.4536  \begin{verbatim} (VBD ref) create (session_id s, VBD record args)\end{verbatim}
 14.4537 @@ -8783,7 +9349,7 @@ reference to the newly created object
 14.4538  \subsubsection{RPC name:~destroy}
 14.4539  
 14.4540  {\bf Overview:} 
 14.4541 -destructor for class VBD
 14.4542 +Destroy the specified VBD instance.
 14.4543  
 14.4544   \noindent {\bf Signature:} 
 14.4545  \begin{verbatim} void destroy (session_id s, VBD ref self)\end{verbatim}
 14.4546 @@ -8796,7 +9362,7 @@ destructor for class VBD
 14.4547  \begin{tabular}{|c|c|p{7cm}|}
 14.4548   \hline
 14.4549  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4550 -{\tt VBD ref } & self & object instance \\ \hline 
 14.4551 +{\tt VBD ref } & self & reference to the object \\ \hline 
 14.4552  
 14.4553  \end{tabular}
 14.4554  
 14.4555 @@ -8815,7 +9381,7 @@ void
 14.4556  \subsubsection{RPC name:~get\_by\_uuid}
 14.4557  
 14.4558  {\bf Overview:} 
 14.4559 -returns the VBD instance with a particular uuid
 14.4560 +Get a reference to the VBD instance with the specified UUID.
 14.4561  
 14.4562   \noindent {\bf Signature:} 
 14.4563  \begin{verbatim} (VBD ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.4564 @@ -8847,7 +9413,7 @@ reference to the object
 14.4565  \subsubsection{RPC name:~get\_record}
 14.4566  
 14.4567  {\bf Overview:} 
 14.4568 -returns a record containing the state of an instance of class VBD
 14.4569 +Get a record containing the current state of the given VBD.
 14.4570  
 14.4571   \noindent {\bf Signature:} 
 14.4572  \begin{verbatim} (VBD record) get_record (session_id s, VBD ref self)\end{verbatim}
 14.4573 @@ -8899,7 +9465,7 @@ Quals & Field & Type & Description \\
 14.4574  \subsubsection{RPC name:~get\_uuid}
 14.4575  
 14.4576  {\bf Overview:} 
 14.4577 -get accessor message derived from field uuid of object VTPM
 14.4578 +Get the uuid field of the given VTPM.
 14.4579  
 14.4580   \noindent {\bf Signature:} 
 14.4581  \begin{verbatim} string get_uuid (session_id s, VTPM ref self)\end{verbatim}
 14.4582 @@ -8912,7 +9478,7 @@ get accessor message derived from field 
 14.4583  \begin{tabular}{|c|c|p{7cm}|}
 14.4584   \hline
 14.4585  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4586 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4587 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4588  
 14.4589  \end{tabular}
 14.4590  
 14.4591 @@ -8931,7 +9497,7 @@ value of the field
 14.4592  \subsubsection{RPC name:~get\_VM}
 14.4593  
 14.4594  {\bf Overview:} 
 14.4595 -get accessor message derived from field VM of object VTPM
 14.4596 +Get the VM field of the given VTPM.
 14.4597  
 14.4598   \noindent {\bf Signature:} 
 14.4599  \begin{verbatim} (VM ref) get_VM (session_id s, VTPM ref self)\end{verbatim}
 14.4600 @@ -8944,7 +9510,7 @@ get accessor message derived from field 
 14.4601  \begin{tabular}{|c|c|p{7cm}|}
 14.4602   \hline
 14.4603  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4604 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4605 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4606  
 14.4607  \end{tabular}
 14.4608  
 14.4609 @@ -8963,7 +9529,7 @@ value of the field
 14.4610  \subsubsection{RPC name:~get\_backend}
 14.4611  
 14.4612  {\bf Overview:} 
 14.4613 -get accessor message derived from field backend of object VTPM
 14.4614 +Get the backend field of the given VTPM.
 14.4615  
 14.4616   \noindent {\bf Signature:} 
 14.4617  \begin{verbatim} (VM ref) get_backend (session_id s, VTPM ref self)\end{verbatim}
 14.4618 @@ -8976,7 +9542,7 @@ get accessor message derived from field 
 14.4619  \begin{tabular}{|c|c|p{7cm}|}
 14.4620   \hline
 14.4621  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4622 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4623 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4624  
 14.4625  \end{tabular}
 14.4626  
 14.4627 @@ -8995,7 +9561,7 @@ value of the field
 14.4628  \subsubsection{RPC name:~get\_driver}
 14.4629  
 14.4630  {\bf Overview:} 
 14.4631 -get accessor message derived from field driver of object VTPM
 14.4632 +Get the driver field of the given VTPM.
 14.4633  
 14.4634   \noindent {\bf Signature:} 
 14.4635  \begin{verbatim} (driver_type) get_driver (session_id s, VTPM ref self)\end{verbatim}
 14.4636 @@ -9008,7 +9574,7 @@ get accessor message derived from field 
 14.4637  \begin{tabular}{|c|c|p{7cm}|}
 14.4638   \hline
 14.4639  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4640 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4641 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4642  
 14.4643  \end{tabular}
 14.4644  
 14.4645 @@ -9027,7 +9593,7 @@ value of the field
 14.4646  \subsubsection{RPC name:~get\_instance}
 14.4647  
 14.4648  {\bf Overview:} 
 14.4649 -get accessor message derived from field instance of object VTPM
 14.4650 +Get the instance field of the given VTPM.
 14.4651  
 14.4652   \noindent {\bf Signature:} 
 14.4653  \begin{verbatim} int get_instance (session_id s, VTPM ref self)\end{verbatim}
 14.4654 @@ -9040,7 +9606,7 @@ get accessor message derived from field 
 14.4655  \begin{tabular}{|c|c|p{7cm}|}
 14.4656   \hline
 14.4657  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4658 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4659 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4660  
 14.4661  \end{tabular}
 14.4662  
 14.4663 @@ -9059,7 +9625,7 @@ value of the field
 14.4664  \subsubsection{RPC name:~create}
 14.4665  
 14.4666  {\bf Overview:} 
 14.4667 -constructor for class VTPM
 14.4668 +Create a new VTPM instance, and return its handle.
 14.4669  
 14.4670   \noindent {\bf Signature:} 
 14.4671  \begin{verbatim} (VTPM ref) create (session_id s, VTPM record args)\end{verbatim}
 14.4672 @@ -9091,7 +9657,7 @@ reference to the newly created object
 14.4673  \subsubsection{RPC name:~destroy}
 14.4674  
 14.4675  {\bf Overview:} 
 14.4676 -destructor for class VTPM
 14.4677 +Destroy the specified VTPM instance.
 14.4678  
 14.4679   \noindent {\bf Signature:} 
 14.4680  \begin{verbatim} void destroy (session_id s, VTPM ref self)\end{verbatim}
 14.4681 @@ -9104,7 +9670,7 @@ destructor for class VTPM
 14.4682  \begin{tabular}{|c|c|p{7cm}|}
 14.4683   \hline
 14.4684  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4685 -{\tt VTPM ref } & self & object instance \\ \hline 
 14.4686 +{\tt VTPM ref } & self & reference to the object \\ \hline 
 14.4687  
 14.4688  \end{tabular}
 14.4689  
 14.4690 @@ -9123,7 +9689,7 @@ void
 14.4691  \subsubsection{RPC name:~get\_by\_uuid}
 14.4692  
 14.4693  {\bf Overview:} 
 14.4694 -returns the VTPM instance with a particular uuid
 14.4695 +Get a reference to the VTPM instance with the specified UUID.
 14.4696  
 14.4697   \noindent {\bf Signature:} 
 14.4698  \begin{verbatim} (VTPM ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.4699 @@ -9155,7 +9721,7 @@ reference to the object
 14.4700  \subsubsection{RPC name:~get\_record}
 14.4701  
 14.4702  {\bf Overview:} 
 14.4703 -returns a record containing the state of an instance of class VTPM
 14.4704 +Get a record containing the current state of the given VTPM.
 14.4705  
 14.4706   \noindent {\bf Signature:} 
 14.4707  \begin{verbatim} (VTPM record) get_record (session_id s, VTPM ref self)\end{verbatim}
 14.4708 @@ -9187,6 +9753,281 @@ all fields from the object
 14.4709  
 14.4710  \vspace{1cm}
 14.4711  \newpage
 14.4712 +\section{Class: console}
 14.4713 +\subsection{Fields for class: console}
 14.4714 +\begin{longtable}{|lllp{0.38\textwidth}|}
 14.4715 +\hline
 14.4716 +\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf console} \\
 14.4717 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A console}} \\
 14.4718 +\hline
 14.4719 +Quals & Field & Type & Description \\
 14.4720 +\hline
 14.4721 +$\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object reference \\
 14.4722 +$\mathit{RO}_\mathit{run}$ &  {\tt protocol} & console\_protocol & the protocol used by this console \\
 14.4723 +$\mathit{RO}_\mathit{run}$ &  {\tt uri} & string & URI for the console service \\
 14.4724 +$\mathit{RO}_\mathit{run}$ &  {\tt VM} & VM ref & VM to which this console is attached \\
 14.4725 +\hline
 14.4726 +\end{longtable}
 14.4727 +\subsection{Additional RPCs associated with class: console}
 14.4728 +\subsubsection{RPC name:~get\_record}
 14.4729 +
 14.4730 +{\bf Overview:} 
 14.4731 +Get the current state of the given console.
 14.4732 +
 14.4733 + \noindent {\bf Signature:} 
 14.4734 +\begin{verbatim} (console record) get_record (session_id s, console ref self)\end{verbatim}
 14.4735 +
 14.4736 +
 14.4737 +\noindent{\bf Arguments:}
 14.4738 +
 14.4739 + 
 14.4740 +\vspace{0.3cm}
 14.4741 +\begin{tabular}{|c|c|p{7cm}|}
 14.4742 + \hline
 14.4743 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4744 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4745 +
 14.4746 +\end{tabular}
 14.4747 +
 14.4748 +\vspace{0.3cm}
 14.4749 +
 14.4750 + \noindent {\bf Return Type:} 
 14.4751 +{\tt 
 14.4752 +console record
 14.4753 +}
 14.4754 +
 14.4755 +
 14.4756 +all fields from the object
 14.4757 +\vspace{0.3cm}
 14.4758 +\vspace{0.3cm}
 14.4759 +\vspace{0.3cm}
 14.4760 +\subsubsection{RPC name:~get\_by\_uuid}
 14.4761 +
 14.4762 +{\bf Overview:} 
 14.4763 +Get a reference to the object with the specified UUID.
 14.4764 +
 14.4765 + \noindent {\bf Signature:} 
 14.4766 +\begin{verbatim} (console ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.4767 +
 14.4768 +
 14.4769 +\noindent{\bf Arguments:}
 14.4770 +
 14.4771 + 
 14.4772 +\vspace{0.3cm}
 14.4773 +\begin{tabular}{|c|c|p{7cm}|}
 14.4774 + \hline
 14.4775 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4776 +{\tt string } & uuid & UUID of object to return \\ \hline 
 14.4777 +
 14.4778 +\end{tabular}
 14.4779 +
 14.4780 +\vspace{0.3cm}
 14.4781 +
 14.4782 + \noindent {\bf Return Type:} 
 14.4783 +{\tt 
 14.4784 +console ref
 14.4785 +}
 14.4786 +
 14.4787 +
 14.4788 +reference to the object
 14.4789 +\vspace{0.3cm}
 14.4790 +\vspace{0.3cm}
 14.4791 +\vspace{0.3cm}
 14.4792 +\subsubsection{RPC name:~create}
 14.4793 +
 14.4794 +{\bf Overview:} 
 14.4795 +Create a new console instance, and return its handle.
 14.4796 +
 14.4797 + \noindent {\bf Signature:} 
 14.4798 +\begin{verbatim} (console ref) create (session_id s, console record args)\end{verbatim}
 14.4799 +
 14.4800 +
 14.4801 +\noindent{\bf Arguments:}
 14.4802 +
 14.4803 + 
 14.4804 +\vspace{0.3cm}
 14.4805 +\begin{tabular}{|c|c|p{7cm}|}
 14.4806 + \hline
 14.4807 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4808 +{\tt console record } & args & All constructor arguments \\ \hline 
 14.4809 +
 14.4810 +\end{tabular}
 14.4811 +
 14.4812 +\vspace{0.3cm}
 14.4813 +
 14.4814 + \noindent {\bf Return Type:} 
 14.4815 +{\tt 
 14.4816 +console ref
 14.4817 +}
 14.4818 +
 14.4819 +
 14.4820 +reference to the newly created object
 14.4821 +\vspace{0.3cm}
 14.4822 +\vspace{0.3cm}
 14.4823 +\vspace{0.3cm}
 14.4824 +\subsubsection{RPC name:~destroy}
 14.4825 +
 14.4826 +{\bf Overview:} 
 14.4827 +Destroy the specified console instance.
 14.4828 +
 14.4829 + \noindent {\bf Signature:} 
 14.4830 +\begin{verbatim} void destroy (session_id s, console ref self)\end{verbatim}
 14.4831 +
 14.4832 +
 14.4833 +\noindent{\bf Arguments:}
 14.4834 +
 14.4835 + 
 14.4836 +\vspace{0.3cm}
 14.4837 +\begin{tabular}{|c|c|p{7cm}|}
 14.4838 + \hline
 14.4839 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4840 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4841 +
 14.4842 +\end{tabular}
 14.4843 +
 14.4844 +\vspace{0.3cm}
 14.4845 +
 14.4846 + \noindent {\bf Return Type:} 
 14.4847 +{\tt 
 14.4848 +void
 14.4849 +}
 14.4850 +
 14.4851 +
 14.4852 +
 14.4853 +\vspace{0.3cm}
 14.4854 +\vspace{0.3cm}
 14.4855 +\vspace{0.3cm}
 14.4856 +\subsubsection{RPC name:~get\_uuid}
 14.4857 +
 14.4858 +{\bf Overview:} 
 14.4859 +Get the uuid field of the given console.
 14.4860 +
 14.4861 + \noindent {\bf Signature:} 
 14.4862 +\begin{verbatim} string get_uuid (session_id s, console ref self)\end{verbatim}
 14.4863 +
 14.4864 +
 14.4865 +\noindent{\bf Arguments:}
 14.4866 +
 14.4867 + 
 14.4868 +\vspace{0.3cm}
 14.4869 +\begin{tabular}{|c|c|p{7cm}|}
 14.4870 + \hline
 14.4871 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4872 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4873 +
 14.4874 +\end{tabular}
 14.4875 +
 14.4876 +\vspace{0.3cm}
 14.4877 +
 14.4878 + \noindent {\bf Return Type:} 
 14.4879 +{\tt 
 14.4880 +string
 14.4881 +}
 14.4882 +
 14.4883 +
 14.4884 +value of the field
 14.4885 +\vspace{0.3cm}
 14.4886 +\vspace{0.3cm}
 14.4887 +\vspace{0.3cm}
 14.4888 +\subsubsection{RPC name:~get\_protocol}
 14.4889 +
 14.4890 +{\bf Overview:} 
 14.4891 +Get the protocol field of the given console.
 14.4892 +
 14.4893 + \noindent {\bf Signature:} 
 14.4894 +\begin{verbatim} (console_protocol) get_protocol (session_id s, console ref self)\end{verbatim}
 14.4895 +
 14.4896 +
 14.4897 +\noindent{\bf Arguments:}
 14.4898 +
 14.4899 + 
 14.4900 +\vspace{0.3cm}
 14.4901 +\begin{tabular}{|c|c|p{7cm}|}
 14.4902 + \hline
 14.4903 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4904 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4905 +
 14.4906 +\end{tabular}
 14.4907 +
 14.4908 +\vspace{0.3cm}
 14.4909 +
 14.4910 + \noindent {\bf Return Type:} 
 14.4911 +{\tt 
 14.4912 +console\_protocol
 14.4913 +}
 14.4914 +
 14.4915 +
 14.4916 +value of the field
 14.4917 +\vspace{0.3cm}
 14.4918 +\vspace{0.3cm}
 14.4919 +\vspace{0.3cm}
 14.4920 +\subsubsection{RPC name:~get\_uri}
 14.4921 +
 14.4922 +{\bf Overview:} 
 14.4923 +Get the uri field of the given console.
 14.4924 +
 14.4925 + \noindent {\bf Signature:} 
 14.4926 +\begin{verbatim} string get_uri (session_id s, console ref self)\end{verbatim}
 14.4927 +
 14.4928 +
 14.4929 +\noindent{\bf Arguments:}
 14.4930 +
 14.4931 + 
 14.4932 +\vspace{0.3cm}
 14.4933 +\begin{tabular}{|c|c|p{7cm}|}
 14.4934 + \hline
 14.4935 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4936 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4937 +
 14.4938 +\end{tabular}
 14.4939 +
 14.4940 +\vspace{0.3cm}
 14.4941 +
 14.4942 + \noindent {\bf Return Type:} 
 14.4943 +{\tt 
 14.4944 +string
 14.4945 +}
 14.4946 +
 14.4947 +
 14.4948 +value of the field
 14.4949 +\vspace{0.3cm}
 14.4950 +\vspace{0.3cm}
 14.4951 +\vspace{0.3cm}
 14.4952 +\subsubsection{RPC name:~get\_VM}
 14.4953 +
 14.4954 +{\bf Overview:} 
 14.4955 +Get the VM field of the given console.
 14.4956 +
 14.4957 + \noindent {\bf Signature:} 
 14.4958 +\begin{verbatim} (VM ref) get_VM (session_id s, console ref self)\end{verbatim}
 14.4959 +
 14.4960 +
 14.4961 +\noindent{\bf Arguments:}
 14.4962 +
 14.4963 + 
 14.4964 +\vspace{0.3cm}
 14.4965 +\begin{tabular}{|c|c|p{7cm}|}
 14.4966 + \hline
 14.4967 +{\bf type} & {\bf name} & {\bf description} \\ \hline
 14.4968 +{\tt console ref } & self & reference to the object \\ \hline 
 14.4969 +
 14.4970 +\end{tabular}
 14.4971 +
 14.4972 +\vspace{0.3cm}
 14.4973 +
 14.4974 + \noindent {\bf Return Type:} 
 14.4975 +{\tt 
 14.4976 +VM ref
 14.4977 +}
 14.4978 +
 14.4979 +
 14.4980 +value of the field
 14.4981 +\vspace{0.3cm}
 14.4982 +\vspace{0.3cm}
 14.4983 +\vspace{0.3cm}
 14.4984 +
 14.4985 +\vspace{1cm}
 14.4986 +\newpage
 14.4987  \section{Class: user}
 14.4988  \subsection{Fields for class: user}
 14.4989  \begin{longtable}{|lllp{0.38\textwidth}|}
 14.4990 @@ -9205,7 +10046,7 @@ Quals & Field & Type & Description \\
 14.4991  \subsubsection{RPC name:~get\_uuid}
 14.4992  
 14.4993  {\bf Overview:} 
 14.4994 -get accessor message derived from field uuid of object user
 14.4995 +Get the uuid field of the given user.
 14.4996  
 14.4997   \noindent {\bf Signature:} 
 14.4998  \begin{verbatim} string get_uuid (session_id s, user ref self)\end{verbatim}
 14.4999 @@ -9218,7 +10059,7 @@ get accessor message derived from field 
 14.5000  \begin{tabular}{|c|c|p{7cm}|}
 14.5001   \hline
 14.5002  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5003 -{\tt user ref } & self & object instance \\ \hline 
 14.5004 +{\tt user ref } & self & reference to the object \\ \hline 
 14.5005  
 14.5006  \end{tabular}
 14.5007  
 14.5008 @@ -9237,7 +10078,7 @@ value of the field
 14.5009  \subsubsection{RPC name:~get\_short\_name}
 14.5010  
 14.5011  {\bf Overview:} 
 14.5012 -get accessor message derived from field short\_name of object user
 14.5013 +Get the short\_name field of the given user.
 14.5014  
 14.5015   \noindent {\bf Signature:} 
 14.5016  \begin{verbatim} string get_short_name (session_id s, user ref self)\end{verbatim}
 14.5017 @@ -9250,7 +10091,7 @@ get accessor message derived from field 
 14.5018  \begin{tabular}{|c|c|p{7cm}|}
 14.5019   \hline
 14.5020  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5021 -{\tt user ref } & self & object instance \\ \hline 
 14.5022 +{\tt user ref } & self & reference to the object \\ \hline 
 14.5023  
 14.5024  \end{tabular}
 14.5025  
 14.5026 @@ -9269,7 +10110,7 @@ value of the field
 14.5027  \subsubsection{RPC name:~get\_fullname}
 14.5028  
 14.5029  {\bf Overview:} 
 14.5030 -get accessor message derived from field fullname of object user
 14.5031 +Get the fullname field of the given user.
 14.5032  
 14.5033   \noindent {\bf Signature:} 
 14.5034  \begin{verbatim} string get_fullname (session_id s, user ref self)\end{verbatim}
 14.5035 @@ -9282,7 +10123,7 @@ get accessor message derived from field 
 14.5036  \begin{tabular}{|c|c|p{7cm}|}
 14.5037   \hline
 14.5038  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5039 -{\tt user ref } & self & object instance \\ \hline 
 14.5040 +{\tt user ref } & self & reference to the object \\ \hline 
 14.5041  
 14.5042  \end{tabular}
 14.5043  
 14.5044 @@ -9301,7 +10142,7 @@ value of the field
 14.5045  \subsubsection{RPC name:~set\_fullname}
 14.5046  
 14.5047  {\bf Overview:} 
 14.5048 -set accessor message derived from field fullname of object user
 14.5049 +Set the fullname field of the given user.
 14.5050  
 14.5051   \noindent {\bf Signature:} 
 14.5052  \begin{verbatim} void set_fullname (session_id s, user ref self, string value)\end{verbatim}
 14.5053 @@ -9314,7 +10155,7 @@ set accessor message derived from field 
 14.5054  \begin{tabular}{|c|c|p{7cm}|}
 14.5055   \hline
 14.5056  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5057 -{\tt user ref } & self & object instance \\ \hline 
 14.5058 +{\tt user ref } & self & reference to the object \\ \hline 
 14.5059  
 14.5060  {\tt string } & value & New value to set \\ \hline 
 14.5061  
 14.5062 @@ -9335,7 +10176,7 @@ void
 14.5063  \subsubsection{RPC name:~create}
 14.5064  
 14.5065  {\bf Overview:} 
 14.5066 -constructor for class user
 14.5067 +Create a new user instance, and return its handle.
 14.5068  
 14.5069   \noindent {\bf Signature:} 
 14.5070  \begin{verbatim} (user ref) create (session_id s, user record args)\end{verbatim}
 14.5071 @@ -9367,7 +10208,7 @@ reference to the newly created object
 14.5072  \subsubsection{RPC name:~destroy}
 14.5073  
 14.5074  {\bf Overview:} 
 14.5075 -destructor for class user
 14.5076 +Destroy the specified user instance.
 14.5077  
 14.5078   \noindent {\bf Signature:} 
 14.5079  \begin{verbatim} void destroy (session_id s, user ref self)\end{verbatim}
 14.5080 @@ -9380,7 +10221,7 @@ destructor for class user
 14.5081  \begin{tabular}{|c|c|p{7cm}|}
 14.5082   \hline
 14.5083  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5084 -{\tt user ref } & self & object instance \\ \hline 
 14.5085 +{\tt user ref } & self & reference to the object \\ \hline 
 14.5086  
 14.5087  \end{tabular}
 14.5088  
 14.5089 @@ -9399,7 +10240,7 @@ void
 14.5090  \subsubsection{RPC name:~get\_by\_uuid}
 14.5091  
 14.5092  {\bf Overview:} 
 14.5093 -returns the user instance with a particular uuid
 14.5094 +Get a reference to the user instance with the specified UUID.
 14.5095  
 14.5096   \noindent {\bf Signature:} 
 14.5097  \begin{verbatim} (user ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.5098 @@ -9431,7 +10272,7 @@ reference to the object
 14.5099  \subsubsection{RPC name:~get\_record}
 14.5100  
 14.5101  {\bf Overview:} 
 14.5102 -returns a record containing the state of an instance of class user
 14.5103 +Get a record containing the current state of the given user.
 14.5104  
 14.5105   \noindent {\bf Signature:} 
 14.5106  \begin{verbatim} (user record) get_record (session_id s, user ref self)\end{verbatim}
 14.5107 @@ -9512,7 +10353,7 @@ void
 14.5108  \subsubsection{RPC name:~create}
 14.5109  
 14.5110  {\bf Overview:} 
 14.5111 -constructor for class debug
 14.5112 +Create a new debug instance, and return its handle.
 14.5113  
 14.5114   \noindent {\bf Signature:} 
 14.5115  \begin{verbatim} (debug ref) create (session_id s, debug record args)\end{verbatim}
 14.5116 @@ -9544,7 +10385,7 @@ reference to the newly created object
 14.5117  \subsubsection{RPC name:~destroy}
 14.5118  
 14.5119  {\bf Overview:} 
 14.5120 -destructor for class debug
 14.5121 +Destroy the specified debug instance.
 14.5122  
 14.5123   \noindent {\bf Signature:} 
 14.5124  \begin{verbatim} void destroy (session_id s, debug ref self)\end{verbatim}
 14.5125 @@ -9557,7 +10398,7 @@ destructor for class debug
 14.5126  \begin{tabular}{|c|c|p{7cm}|}
 14.5127   \hline
 14.5128  {\bf type} & {\bf name} & {\bf description} \\ \hline
 14.5129 -{\tt debug ref } & self & object instance \\ \hline 
 14.5130 +{\tt debug ref } & self & reference to the object \\ \hline 
 14.5131  
 14.5132  \end{tabular}
 14.5133  
 14.5134 @@ -9576,7 +10417,7 @@ void
 14.5135  \subsubsection{RPC name:~get\_by\_uuid}
 14.5136  
 14.5137  {\bf Overview:} 
 14.5138 -returns the debug instance with a particular uuid
 14.5139 +Get a reference to the debug instance with the specified UUID.
 14.5140  
 14.5141   \noindent {\bf Signature:} 
 14.5142  \begin{verbatim} (debug ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
 14.5143 @@ -9608,7 +10449,7 @@ reference to the object
 14.5144  \subsubsection{RPC name:~get\_record}
 14.5145  
 14.5146  {\bf Overview:} 
 14.5147 -returns a record containing the state of an instance of class debug
 14.5148 +Get a record containing the current state of the given debug.
 14.5149  
 14.5150   \noindent {\bf Signature:} 
 14.5151  \begin{verbatim} (debug record) get_record (session_id s, debug ref self)\end{verbatim}
    15.1 --- a/extras/mini-os/events.c	Tue Dec 12 09:56:06 2006 -0600
    15.2 +++ b/extras/mini-os/events.c	Tue Dec 12 09:58:42 2006 -0600
    15.3 @@ -31,26 +31,27 @@ typedef struct _ev_action_t {
    15.4      u32 count;
    15.5  } ev_action_t;
    15.6  
    15.7 -
    15.8  static ev_action_t ev_actions[NR_EVS];
    15.9  void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
   15.10  
   15.11 +static unsigned long bound_ports[NR_EVS/(8*sizeof(unsigned long))];
   15.12 +
   15.13  void unbind_all_ports(void)
   15.14  {
   15.15      int i;
   15.16  
   15.17 -	for(i=0;i<NR_EVS;i++)
   15.18 -	{
   15.19 -		if(ev_actions[i].handler != default_handler)
   15.20 -		{
   15.21 -			struct evtchn_close close;
   15.22 -			mask_evtchn(i);
   15.23 -			close.port = i;
   15.24 -			HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
   15.25 -		}
   15.26 -	}
   15.27 +    for (i = 0; i < NR_EVS; i++)
   15.28 +    {
   15.29 +        if (test_and_clear_bit(i, bound_ports))
   15.30 +        {
   15.31 +            struct evtchn_close close;
   15.32 +            mask_evtchn(i);
   15.33 +            close.port = i;
   15.34 +            HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
   15.35 +        }
   15.36 +    }
   15.37  }
   15.38 -
   15.39 +  
   15.40  /*
   15.41   * Demux events to different handlers.
   15.42   */
   15.43 @@ -114,6 +115,7 @@ int bind_virq(uint32_t virq, evtchn_hand
   15.44  		printk("Failed to bind virtual IRQ %d\n", virq);
   15.45  		return 1;
   15.46      }
   15.47 +    set_bit(op.port,bound_ports);
   15.48      bind_evtchn(op.port, handler, data);
   15.49  	return 0;
   15.50  }
   15.51 @@ -188,6 +190,7 @@ int evtchn_bind_interdomain(domid_t pal,
   15.52      int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op);
   15.53      if (err)
   15.54  		return err;
   15.55 +    set_bit(op.local_port,bound_ports);
   15.56  	evtchn_port_t port = op.local_port;
   15.57      clear_evtchn(port);	      /* Without, handler gets invoked now! */
   15.58      *local_port = bind_evtchn(port, handler, data);
    16.1 --- a/extras/mini-os/include/events.h	Tue Dec 12 09:56:06 2006 -0600
    16.2 +++ b/extras/mini-os/include/events.h	Tue Dec 12 09:58:42 2006 -0600
    16.3 @@ -36,6 +36,7 @@ int evtchn_alloc_unbound(domid_t pal, ev
    16.4  int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port,
    16.5  							evtchn_handler_t handler, void *data,
    16.6  							evtchn_port_t *local_port);
    16.7 +void unbind_all_ports(void);
    16.8  
    16.9  static inline int notify_remote_via_evtchn(evtchn_port_t port)
   16.10  {
    17.1 --- a/linux-2.6-xen-sparse/arch/i386/Kconfig	Tue Dec 12 09:56:06 2006 -0600
    17.2 +++ b/linux-2.6-xen-sparse/arch/i386/Kconfig	Tue Dec 12 09:58:42 2006 -0600
    17.3 @@ -726,7 +726,7 @@ source kernel/Kconfig.hz
    17.4  
    17.5  config KEXEC
    17.6  	bool "kexec system call (EXPERIMENTAL)"
    17.7 -	depends on EXPERIMENTAL && !X86_XEN
    17.8 +	depends on EXPERIMENTAL && !XEN_UNPRIVILEGED_GUEST
    17.9  	help
   17.10  	  kexec is a system call that implements the ability to shutdown your
   17.11  	  current kernel, and to start another kernel.  It is like a reboot
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/crash.c	Tue Dec 12 09:58:42 2006 -0600
    18.3 @@ -0,0 +1,187 @@
    18.4 +/*
    18.5 + * Architecture specific (i386) functions for kexec based crash dumps.
    18.6 + *
    18.7 + * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
    18.8 + *
    18.9 + * Copyright (C) IBM Corporation, 2004. All rights reserved.
   18.10 + *
   18.11 + */
   18.12 +
   18.13 +#include <linux/init.h>
   18.14 +#include <linux/types.h>
   18.15 +#include <linux/kernel.h>
   18.16 +#include <linux/smp.h>
   18.17 +#include <linux/reboot.h>
   18.18 +#include <linux/kexec.h>
   18.19 +#include <linux/delay.h>
   18.20 +#include <linux/elf.h>
   18.21 +#include <linux/elfcore.h>
   18.22 +
   18.23 +#include <asm/processor.h>
   18.24 +#include <asm/hardirq.h>
   18.25 +#include <asm/nmi.h>
   18.26 +#include <asm/hw_irq.h>
   18.27 +#include <asm/apic.h>
   18.28 +#include <mach_ipi.h>
   18.29 +
   18.30 +
   18.31 +/* This keeps a track of which one is crashing cpu. */
   18.32 +static int crashing_cpu;
   18.33 +
   18.34 +static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
   18.35 +							       size_t data_len)
   18.36 +{
   18.37 +	struct elf_note note;
   18.38 +
   18.39 +	note.n_namesz = strlen(name) + 1;
   18.40 +	note.n_descsz = data_len;
   18.41 +	note.n_type   = type;
   18.42 +	memcpy(buf, &note, sizeof(note));
   18.43 +	buf += (sizeof(note) +3)/4;
   18.44 +	memcpy(buf, name, note.n_namesz);
   18.45 +	buf += (note.n_namesz + 3)/4;
   18.46 +	memcpy(buf, data, note.n_descsz);
   18.47 +	buf += (note.n_descsz + 3)/4;
   18.48 +
   18.49 +	return buf;
   18.50 +}
   18.51 +
   18.52 +static void final_note(u32 *buf)
   18.53 +{
   18.54 +	struct elf_note note;
   18.55 +
   18.56 +	note.n_namesz = 0;
   18.57 +	note.n_descsz = 0;
   18.58 +	note.n_type   = 0;
   18.59 +	memcpy(buf, &note, sizeof(note));
   18.60 +}
   18.61 +
   18.62 +static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
   18.63 +{
   18.64 +	struct elf_prstatus prstatus;
   18.65 +	u32 *buf;
   18.66 +
   18.67 +	if ((cpu < 0) || (cpu >= NR_CPUS))
   18.68 +		return;
   18.69 +
   18.70 +	/* Using ELF notes here is opportunistic.
   18.71 +	 * I need a well defined structure format
   18.72 +	 * for the data I pass, and I need tags
   18.73 +	 * on the data to indicate what information I have
   18.74 +	 * squirrelled away.  ELF notes happen to provide
   18.75 +	 * all of that that no need to invent something new.
   18.76 +	 */
   18.77 +	buf = (u32*)per_cpu_ptr(crash_notes, cpu);
   18.78 +	if (!buf)
   18.79 +		return;
   18.80 +	memset(&prstatus, 0, sizeof(prstatus));
   18.81 +	prstatus.pr_pid = current->pid;
   18.82 +	elf_core_copy_regs(&prstatus.pr_reg, regs);
   18.83 +	buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
   18.84 +				sizeof(prstatus));
   18.85 +	final_note(buf);
   18.86 +}
   18.87 +
   18.88 +static void crash_save_self(struct pt_regs *regs)
   18.89 +{
   18.90 +	int cpu;
   18.91 +
   18.92 +	cpu = smp_processor_id();
   18.93 +	crash_save_this_cpu(regs, cpu);
   18.94 +}
   18.95 +
   18.96 +#ifndef CONFIG_XEN
   18.97 +#ifdef CONFIG_SMP
   18.98 +static atomic_t waiting_for_crash_ipi;
   18.99 +
  18.100 +static int crash_nmi_callback(struct pt_regs *regs, int cpu)
  18.101 +{
  18.102 +	struct pt_regs fixed_regs;
  18.103 +
  18.104 +	/* Don't do anything if this handler is invoked on crashing cpu.
  18.105 +	 * Otherwise, system will completely hang. Crashing cpu can get
  18.106 +	 * an NMI if system was initially booted with nmi_watchdog parameter.
  18.107 +	 */
  18.108 +	if (cpu == crashing_cpu)
  18.109 +		return 1;
  18.110 +	local_irq_disable();
  18.111 +
  18.112 +	if (!user_mode(regs)) {
  18.113 +		crash_fixup_ss_esp(&fixed_regs, regs);
  18.114 +		regs = &fixed_regs;
  18.115 +	}
  18.116 +	crash_save_this_cpu(regs, cpu);
  18.117 +	disable_local_APIC();
  18.118 +	atomic_dec(&waiting_for_crash_ipi);
  18.119 +	/* Assume hlt works */
  18.120 +	halt();
  18.121 +	for(;;);
  18.122 +
  18.123 +	return 1;
  18.124 +}
  18.125 +
  18.126 +/*
  18.127 + * By using the NMI code instead of a vector we just sneak thru the
  18.128 + * word generator coming out with just what we want.  AND it does
  18.129 + * not matter if clustered_apic_mode is set or not.
  18.130 + */
  18.131 +static void smp_send_nmi_allbutself(void)
  18.132 +{
  18.133 +	send_IPI_allbutself(APIC_DM_NMI);
  18.134 +}
  18.135 +
  18.136 +static void nmi_shootdown_cpus(void)
  18.137 +{
  18.138 +	unsigned long msecs;
  18.139 +
  18.140 +	atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
  18.141 +	/* Would it be better to replace the trap vector here? */
  18.142 +	set_nmi_callback(crash_nmi_callback);
  18.143 +	/* Ensure the new callback function is set before sending
  18.144 +	 * out the NMI
  18.145 +	 */
  18.146 +	wmb();
  18.147 +
  18.148 +	smp_send_nmi_allbutself();
  18.149 +
  18.150 +	msecs = 1000; /* Wait at most a second for the other cpus to stop */
  18.151 +	while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
  18.152 +		mdelay(1);
  18.153 +		msecs--;
  18.154 +	}
  18.155 +
  18.156 +	/* Leave the nmi callback set */
  18.157 +	disable_local_APIC();
  18.158 +}
  18.159 +#else
  18.160 +static void nmi_shootdown_cpus(void)
  18.161 +{
  18.162 +	/* There are no cpus to shootdown */
  18.163 +}
  18.164 +#endif
  18.165 +#endif /* CONFIG_XEN */
  18.166 +
  18.167 +void machine_crash_shutdown(struct pt_regs *regs)
  18.168 +{
  18.169 +	/* This function is only called after the system
  18.170 +	 * has paniced or is otherwise in a critical state.
  18.171 +	 * The minimum amount of code to allow a kexec'd kernel
  18.172 +	 * to run successfully needs to happen here.
  18.173 +	 *
  18.174 +	 * In practice this means shooting down the other cpus in
  18.175 +	 * an SMP system.
  18.176 +	 */
  18.177 +	/* The kernel is broken so disable interrupts */
  18.178 +	local_irq_disable();
  18.179 +
  18.180 +	/* Make a note of crashing cpu. Will be used in NMI callback.*/
  18.181 +	crashing_cpu = smp_processor_id();
  18.182 +#ifndef CONFIG_XEN
  18.183 +	nmi_shootdown_cpus();
  18.184 +	lapic_shutdown();
  18.185 +#if defined(CONFIG_X86_IO_APIC)
  18.186 +	disable_IO_APIC();
  18.187 +#endif
  18.188 +#endif /* CONFIG_XEN */
  18.189 +	crash_save_self(regs);
  18.190 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/machine_kexec.c	Tue Dec 12 09:58:42 2006 -0600
    19.3 @@ -0,0 +1,129 @@
    19.4 +/*
    19.5 + * machine_kexec.c - handle transition of Linux booting another kernel
    19.6 + * Copyright (C) 2002-2005 Eric Biederman  <ebiederm@xmission.com>
    19.7 + *
    19.8 + * This source code is licensed under the GNU General Public License,
    19.9 + * Version 2.  See the file COPYING for more details.
   19.10 + */
   19.11 +
   19.12 +#include <linux/mm.h>
   19.13 +#include <linux/kexec.h>
   19.14 +#include <linux/delay.h>
   19.15 +#include <asm/pgtable.h>
   19.16 +#include <asm/pgalloc.h>
   19.17 +#include <asm/tlbflush.h>
   19.18 +#include <asm/mmu_context.h>
   19.19 +#include <asm/io.h>
   19.20 +#include <asm/apic.h>
   19.21 +#include <asm/cpufeature.h>
   19.22 +#include <asm/desc.h>
   19.23 +#include <asm/system.h>
   19.24 +
   19.25 +#ifdef CONFIG_XEN
   19.26 +#include <xen/interface/kexec.h>
   19.27 +#endif
   19.28 +
   19.29 +#define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
   19.30 +static u32 kexec_pgd[1024] PAGE_ALIGNED;
   19.31 +#ifdef CONFIG_X86_PAE
   19.32 +static u32 kexec_pmd0[1024] PAGE_ALIGNED;
   19.33 +static u32 kexec_pmd1[1024] PAGE_ALIGNED;
   19.34 +#endif
   19.35 +static u32 kexec_pte0[1024] PAGE_ALIGNED;
   19.36 +static u32 kexec_pte1[1024] PAGE_ALIGNED;
   19.37 +
   19.38 +#ifdef CONFIG_XEN
   19.39 +
   19.40 +#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT)
   19.41 +
   19.42 +#if PAGES_NR > KEXEC_XEN_NO_PAGES
   19.43 +#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break
   19.44 +#endif
   19.45 +
   19.46 +#if PA_CONTROL_PAGE != 0
   19.47 +#error PA_CONTROL_PAGE is non zero - Xen support will break
   19.48 +#endif
   19.49 +
   19.50 +void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)
   19.51 +{
   19.52 +	void *control_page;
   19.53 +
   19.54 +	memset(xki->page_list, 0, sizeof(xki->page_list));
   19.55 +
   19.56 +	control_page = page_address(image->control_code_page);
   19.57 +	memcpy(control_page, relocate_kernel, PAGE_SIZE);
   19.58 +
   19.59 +	xki->page_list[PA_CONTROL_PAGE] = __ma(control_page);
   19.60 +	xki->page_list[PA_PGD] = __ma(kexec_pgd);
   19.61 +#ifdef CONFIG_X86_PAE
   19.62 +	xki->page_list[PA_PMD_0] = __ma(kexec_pmd0);
   19.63 +	xki->page_list[PA_PMD_1] = __ma(kexec_pmd1);
   19.64 +#endif
   19.65 +	xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
   19.66 +	xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
   19.67 +
   19.68 +}
   19.69 +
   19.70 +#endif /* CONFIG_XEN */
   19.71 +
   19.72 +/*
   19.73 + * A architecture hook called to validate the
   19.74 + * proposed image and prepare the control pages
   19.75 + * as needed.  The pages for KEXEC_CONTROL_CODE_SIZE
   19.76 + * have been allocated, but the segments have yet
   19.77 + * been copied into the kernel.
   19.78 + *
   19.79 + * Do what every setup is needed on image and the
   19.80 + * reboot code buffer to allow us to avoid allocations
   19.81 + * later.
   19.82 + *
   19.83 + * Currently nothing.
   19.84 + */
   19.85 +int machine_kexec_prepare(struct kimage *image)
   19.86 +{
   19.87 +	return 0;
   19.88 +}
   19.89 +
   19.90 +/*
   19.91 + * Undo anything leftover by machine_kexec_prepare
   19.92 + * when an image is freed.
   19.93 + */
   19.94 +void machine_kexec_cleanup(struct kimage *image)
   19.95 +{
   19.96 +}
   19.97 +
   19.98 +#ifndef CONFIG_XEN
   19.99 +/*
  19.100 + * Do not allocate memory (or fail in any way) in machine_kexec().
  19.101 + * We are past the point of no return, committed to rebooting now.
  19.102 + */
  19.103 +NORET_TYPE void machine_kexec(struct kimage *image)
  19.104 +{
  19.105 +	unsigned long page_list[PAGES_NR];
  19.106 +	void *control_page;
  19.107 +
  19.108 +	/* Interrupts aren't acceptable while we reboot */
  19.109 +	local_irq_disable();
  19.110 +
  19.111 +	control_page = page_address(image->control_code_page);
  19.112 +	memcpy(control_page, relocate_kernel, PAGE_SIZE);
  19.113 +
  19.114 +	page_list[PA_CONTROL_PAGE] = __pa(control_page);
  19.115 +	page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel;
  19.116 +	page_list[PA_PGD] = __pa(kexec_pgd);
  19.117 +	page_list[VA_PGD] = (unsigned long)kexec_pgd;
  19.118 +#ifdef CONFIG_X86_PAE
  19.119 +	page_list[PA_PMD_0] = __pa(kexec_pmd0);
  19.120 +	page_list[VA_PMD_0] = (unsigned long)kexec_pmd0;
  19.121 +	page_list[PA_PMD_1] = __pa(kexec_pmd1);
  19.122 +	page_list[VA_PMD_1] = (unsigned long)kexec_pmd1;
  19.123 +#endif
  19.124 +	page_list[PA_PTE_0] = __pa(kexec_pte0);
  19.125 +	page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
  19.126 +	page_list[PA_PTE_1] = __pa(kexec_pte1);
  19.127 +	page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
  19.128 +
  19.129 +	relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
  19.130 +			image->start, cpu_has_pae);
  19.131 +}
  19.132 +#endif
    20.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Tue Dec 12 09:56:06 2006 -0600
    20.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Tue Dec 12 09:58:42 2006 -0600
    20.3 @@ -69,6 +69,10 @@
    20.4  #include "setup_arch_pre.h"
    20.5  #include <bios_ebda.h>
    20.6  
    20.7 +#ifdef CONFIG_XEN
    20.8 +#include <xen/interface/kexec.h>
    20.9 +#endif
   20.10 +
   20.11  /* Forward Declaration. */
   20.12  void __init find_max_pfn(void);
   20.13  
   20.14 @@ -943,6 +947,7 @@ static void __init parse_cmdline_early (
   20.15  		 * after a kernel panic.
   20.16  		 */
   20.17  		else if (!memcmp(from, "crashkernel=", 12)) {
   20.18 +#ifndef CONFIG_XEN
   20.19  			unsigned long size, base;
   20.20  			size = memparse(from+12, &from);
   20.21  			if (*from == '@') {
   20.22 @@ -953,6 +958,10 @@ static void __init parse_cmdline_early (
   20.23  				crashk_res.start = base;
   20.24  				crashk_res.end   = base + size - 1;
   20.25  			}
   20.26 +#else
   20.27 +			printk("Ignoring crashkernel command line, "
   20.28 +			       "parameter will be supplied by xen\n");
   20.29 +#endif
   20.30  		}
   20.31  #endif
   20.32  #ifdef CONFIG_PROC_VMCORE
   20.33 @@ -1322,10 +1331,14 @@ void __init setup_bootmem_allocator(void
   20.34  	}
   20.35  #endif
   20.36  #ifdef CONFIG_KEXEC
   20.37 +#ifdef CONFIG_XEN
   20.38 +	xen_machine_kexec_setup_resources();
   20.39 +#else
   20.40  	if (crashk_res.start != crashk_res.end)
   20.41  		reserve_bootmem(crashk_res.start,
   20.42  			crashk_res.end - crashk_res.start + 1);
   20.43  #endif
   20.44 +#endif
   20.45  
   20.46  	if (!xen_feature(XENFEAT_auto_translated_physmap))
   20.47  		phys_to_machine_mapping =
   20.48 @@ -1389,7 +1402,11 @@ legacy_init_iomem_resources(struct e820e
   20.49  			request_resource(res, data_resource);
   20.50  #endif
   20.51  #ifdef CONFIG_KEXEC
   20.52 -			request_resource(res, &crashk_res);
   20.53 +			if (crashk_res.start != crashk_res.end)
   20.54 +			     request_resource(res, &crashk_res);
   20.55 +#ifdef CONFIG_XEN
   20.56 +			xen_machine_kexec_register_resources(res);
   20.57 +#endif
   20.58  #endif
   20.59  		}
   20.60  	}
   20.61 @@ -1850,9 +1867,11 @@ void __init setup_arch(char **cmdline_p)
   20.62  #endif
   20.63  #endif
   20.64  	} else {
   20.65 -		extern int console_use_vt;
   20.66 -		console_use_vt = 0;
   20.67 +#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
   20.68 +		conswitchp = &dummy_con;
   20.69 +#endif
   20.70  	}
   20.71 +	xencons_early_setup();
   20.72  }
   20.73  
   20.74  static int
    21.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Tue Dec 12 09:56:06 2006 -0600
    21.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Tue Dec 12 09:58:42 2006 -0600
    21.3 @@ -47,8 +47,8 @@ EXPORT_SYMBOL(swiotlb);
    21.4   */
    21.5  #define IO_TLB_SHIFT 11
    21.6  
    21.7 -/* Width of DMA addresses in the IO TLB. 31 bits is an aacraid limitation. */
    21.8 -#define IO_TLB_DMA_BITS 31
    21.9 +/* Width of DMA addresses in the IO TLB. 30 bits is a b44 limitation. */
   21.10 +#define DEFAULT_IO_TLB_DMA_BITS 30
   21.11  
   21.12  static int swiotlb_force;
   21.13  static char *iotlb_virt_start;
   21.14 @@ -98,6 +98,15 @@ static struct phys_addr {
   21.15   */
   21.16  static DEFINE_SPINLOCK(io_tlb_lock);
   21.17  
   21.18 +static unsigned int io_tlb_dma_bits = DEFAULT_IO_TLB_DMA_BITS;
   21.19 +static int __init
   21.20 +setup_io_tlb_bits(char *str)
   21.21 +{
   21.22 +	io_tlb_dma_bits = simple_strtoul(str, NULL, 0);
   21.23 +	return 0;
   21.24 +}
   21.25 +__setup("swiotlb_bits=", setup_io_tlb_bits);
   21.26 +
   21.27  static int __init
   21.28  setup_io_tlb_npages(char *str)
   21.29  {
   21.30 @@ -158,7 +167,7 @@ swiotlb_init_with_default_size (size_t d
   21.31  		int rc = xen_create_contiguous_region(
   21.32  			(unsigned long)iotlb_virt_start + (i << IO_TLB_SHIFT),
   21.33  			get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT),
   21.34 -			IO_TLB_DMA_BITS);
   21.35 +			io_tlb_dma_bits);
   21.36  		BUG_ON(rc);
   21.37  	}
   21.38  
   21.39 @@ -183,10 +192,12 @@ swiotlb_init_with_default_size (size_t d
   21.40  
   21.41  	printk(KERN_INFO "Software IO TLB enabled: \n"
   21.42  	       " Aperture:     %lu megabytes\n"
   21.43 -	       " Kernel range: 0x%016lx - 0x%016lx\n",
   21.44 +	       " Kernel range: 0x%016lx - 0x%016lx\n"
   21.45 +	       " Address size: %u bits\n",
   21.46  	       bytes >> 20,
   21.47  	       (unsigned long)iotlb_virt_start,
   21.48 -	       (unsigned long)iotlb_virt_start + bytes);
   21.49 +	       (unsigned long)iotlb_virt_start + bytes,
   21.50 +	       io_tlb_dma_bits);
   21.51  }
   21.52  
   21.53  void
   21.54 @@ -654,7 +665,7 @@ swiotlb_dma_mapping_error(dma_addr_t dma
   21.55  int
   21.56  swiotlb_dma_supported (struct device *hwdev, u64 mask)
   21.57  {
   21.58 -	return (mask >= ((1UL << IO_TLB_DMA_BITS) - 1));
   21.59 +	return (mask >= ((1UL << io_tlb_dma_bits) - 1));
   21.60  }
   21.61  
   21.62  EXPORT_SYMBOL(swiotlb_init);
    22.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Tue Dec 12 09:56:06 2006 -0600
    22.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Tue Dec 12 09:58:42 2006 -0600
    22.3 @@ -710,6 +710,10 @@ irqreturn_t timer_interrupt(int irq, voi
    22.4  					    (cputime_t)delta_cpu);
    22.5  	}
    22.6  
    22.7 +	/* Offlined for more than a few seconds? Avoid lockup warnings. */
    22.8 +	if (stolen > 5*HZ)
    22.9 +		touch_softlockup_watchdog();
   22.10 +
   22.11  	/* Local timer processing (see update_process_times()). */
   22.12  	run_local_timers();
   22.13  	if (rcu_pending(cpu))
   22.14 @@ -1043,9 +1047,9 @@ void time_resume(void)
   22.15  #ifdef CONFIG_SMP
   22.16  static char timer_name[NR_CPUS][15];
   22.17  
   22.18 -void local_setup_timer(unsigned int cpu)
   22.19 +int local_setup_timer(unsigned int cpu)
   22.20  {
   22.21 -	int seq;
   22.22 +	int seq, irq;
   22.23  
   22.24  	BUG_ON(cpu == 0);
   22.25  
   22.26 @@ -1058,15 +1062,17 @@ void local_setup_timer(unsigned int cpu)
   22.27  	} while (read_seqretry(&xtime_lock, seq));
   22.28  
   22.29  	sprintf(timer_name[cpu], "timer%d", cpu);
   22.30 -	per_cpu(timer_irq, cpu) =
   22.31 -		bind_virq_to_irqhandler(
   22.32 -			VIRQ_TIMER,
   22.33 -			cpu,
   22.34 -			timer_interrupt,
   22.35 -			SA_INTERRUPT,
   22.36 -			timer_name[cpu],
   22.37 -			NULL);
   22.38 -	BUG_ON(per_cpu(timer_irq, cpu) < 0);
   22.39 +	irq = bind_virq_to_irqhandler(VIRQ_TIMER,
   22.40 +				      cpu,
   22.41 +				      timer_interrupt,
   22.42 +				      SA_INTERRUPT,
   22.43 +				      timer_name[cpu],
   22.44 +				      NULL);
   22.45 +	if (irq < 0)
   22.46 +		return irq;
   22.47 +	per_cpu(timer_irq, cpu) = irq;
   22.48 +
   22.49 +	return 0;
   22.50  }
   22.51  
   22.52  void local_teardown_timer(unsigned int cpu)
    23.1 --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig	Tue Dec 12 09:56:06 2006 -0600
    23.2 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig	Tue Dec 12 09:58:42 2006 -0600
    23.3 @@ -533,9 +533,6 @@ config XEN_BALLOON
    23.4  config XEN_SKBUFF
    23.5  	default y
    23.6  
    23.7 -config XEN_DEVMEM
    23.8 -	default n
    23.9 -
   23.10  config XEN_REBOOT
   23.11  	default y
   23.12  
    24.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Tue Dec 12 09:56:06 2006 -0600
    24.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/entry.S	Tue Dec 12 09:58:42 2006 -0600
    24.3 @@ -602,7 +602,7 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
    24.4  .ret4:	br.cond.sptk ia64_leave_kernel
    24.5  END(ia64_strace_leave_kernel)
    24.6  
    24.7 -GLOBAL_ENTRY(ia64_ret_from_clone)
    24.8 +GLOBAL_ENTRY(__ia64_ret_from_clone)
    24.9  	PT_REGS_UNWIND_INFO(0)
   24.10  {	/*
   24.11  	 * Some versions of gas generate bad unwind info if the first instruction of a
   24.12 @@ -628,7 +628,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
   24.13  	cmp.ne p6,p0=r2,r0
   24.14  (p6)	br.cond.spnt .strace_check_retval
   24.15  	;;					// added stop bits to prevent r8 dependency
   24.16 -END(ia64_ret_from_clone)
   24.17 +END(__ia64_ret_from_clone)
   24.18  	// fall through
   24.19  GLOBAL_ENTRY(ia64_ret_from_syscall)
   24.20  	PT_REGS_UNWIND_INFO(0)
    25.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Tue Dec 12 09:56:06 2006 -0600
    25.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Tue Dec 12 09:58:42 2006 -0600
    25.3 @@ -197,6 +197,16 @@ int xen_assign_irq_vector(int irq)
    25.4  
    25.5  	return irq_op.vector;
    25.6  }
    25.7 +
    25.8 +void xen_free_irq_vector(int vector)
    25.9 +{
   25.10 +	struct physdev_irq irq_op;
   25.11 +
   25.12 +	irq_op.vector = vector;
   25.13 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_free_irq_vector, &irq_op))
   25.14 +		printk(KERN_WARNING "%s: xen_free_irq_vecotr fail vector=%d\n",
   25.15 +		       __FUNCTION__, vector);
   25.16 +}
   25.17  #endif /* XEN */
   25.18  
   25.19  /*
    26.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue Dec 12 09:56:06 2006 -0600
    26.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Tue Dec 12 09:58:42 2006 -0600
    26.3 @@ -94,6 +94,13 @@ free_irq_vector (int vector)
    26.4  	if (vector < IA64_FIRST_DEVICE_VECTOR || vector > IA64_LAST_DEVICE_VECTOR)
    26.5  		return;
    26.6  
    26.7 +#ifdef CONFIG_XEN
    26.8 +	if (is_running_on_xen()) {
    26.9 +		extern void xen_free_irq_vector(int);
   26.10 +		xen_free_irq_vector(vector);
   26.11 +		return;
   26.12 +	}
   26.13 +#endif
   26.14  	pos = vector - IA64_FIRST_DEVICE_VECTOR;
   26.15  	if (!test_and_clear_bit(pos, ia64_vector_mask))
   26.16  		printk(KERN_WARNING "%s: double free!\n", __FUNCTION__);
   26.17 @@ -241,9 +248,15 @@ static struct irqaction ipi_irqaction = 
   26.18  static DEFINE_PER_CPU(int, timer_irq) = -1;
   26.19  static DEFINE_PER_CPU(int, ipi_irq) = -1;
   26.20  static DEFINE_PER_CPU(int, resched_irq) = -1;
   26.21 +static DEFINE_PER_CPU(int, cmc_irq) = -1;
   26.22 +static DEFINE_PER_CPU(int, cmcp_irq) = -1;
   26.23 +static DEFINE_PER_CPU(int, cpep_irq) = -1;
   26.24  static char timer_name[NR_CPUS][15];
   26.25  static char ipi_name[NR_CPUS][15];
   26.26  static char resched_name[NR_CPUS][15];
   26.27 +static char cmc_name[NR_CPUS][15];
   26.28 +static char cmcp_name[NR_CPUS][15];
   26.29 +static char cpep_name[NR_CPUS][15];
   26.30  
   26.31  struct saved_irq {
   26.32  	unsigned int irq;
   26.33 @@ -323,6 +336,43 @@ xen_register_percpu_irq (unsigned int ir
   26.34  			break;
   26.35  		case IA64_SPURIOUS_INT_VECTOR:
   26.36  			break;
   26.37 +		case IA64_CMC_VECTOR:
   26.38 +			sprintf(cmc_name[cpu], "%s%d", action->name, cpu);
   26.39 +			ret = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu,
   26.40 +			                              action->handler,
   26.41 +			                              action->flags,
   26.42 +			                              cmc_name[cpu],
   26.43 +			                              action->dev_id);
   26.44 +			per_cpu(cmc_irq,cpu) = ret;
   26.45 +			printk(KERN_INFO "register VIRQ_MCA_CMC (%s) to xen "
   26.46 +			       "irq (%d)\n", cmc_name[cpu], ret);
   26.47 +			break;
   26.48 +		case IA64_CMCP_VECTOR:
   26.49 +			sprintf(cmcp_name[cpu], "%s%d", action->name, cpu);
   26.50 +			ret = bind_ipi_to_irqhandler(CMCP_VECTOR, cpu,
   26.51 +			                             action->handler,
   26.52 +			                             action->flags,
   26.53 +			                             cmcp_name[cpu],
   26.54 +			                             action->dev_id);
   26.55 +			per_cpu(cmcp_irq,cpu) = ret;
   26.56 +			printk(KERN_INFO "register CMCP_VECTOR (%s) to xen "
   26.57 +			       "irq (%d)\n", cmcp_name[cpu], ret);
   26.58 +			break;
   26.59 +		case IA64_CPEP_VECTOR:
   26.60 +			sprintf(cpep_name[cpu], "%s%d", action->name, cpu);
   26.61 +			ret = bind_ipi_to_irqhandler(CPEP_VECTOR, cpu,
   26.62 +			                             action->handler,
   26.63 +			                             action->flags,
   26.64 +			                             cpep_name[cpu],
   26.65 +			                             action->dev_id);
   26.66 +			per_cpu(cpep_irq,cpu) = ret;
   26.67 +			printk(KERN_INFO "register CPEP_VECTOR (%s) to xen "
   26.68 +			       "irq (%d)\n", cpep_name[cpu], ret);
   26.69 +			break;
   26.70 +		case IA64_CPE_VECTOR:
   26.71 +			printk(KERN_WARNING "register IA64_CPE_VECTOR "
   26.72 +			       "IGNORED\n");
   26.73 +			break;
   26.74  		default:
   26.75  			printk(KERN_WARNING "Percpu irq %d is unsupported by xen!\n", irq);
   26.76  			break;
   26.77 @@ -373,6 +423,18 @@ unbind_evtchn_callback(struct notifier_b
   26.78  
   26.79  	if (action == CPU_DEAD) {
   26.80  		/* Unregister evtchn.  */
   26.81 +		if (per_cpu(cpep_irq,cpu) >= 0) {
   26.82 +			unbind_from_irqhandler(per_cpu(cpep_irq, cpu), NULL);
   26.83 +			per_cpu(cpep_irq, cpu) = -1;
   26.84 +		}
   26.85 +		if (per_cpu(cmcp_irq,cpu) >= 0) {
   26.86 +			unbind_from_irqhandler(per_cpu(cmcp_irq, cpu), NULL);
   26.87 +			per_cpu(cmcp_irq, cpu) = -1;
   26.88 +		}
   26.89 +		if (per_cpu(cmc_irq,cpu) >= 0) {
   26.90 +			unbind_from_irqhandler(per_cpu(cmc_irq, cpu), NULL);
   26.91 +			per_cpu(cmc_irq, cpu) = -1;
   26.92 +		}
   26.93  		if (per_cpu(ipi_irq,cpu) >= 0) {
   26.94  			unbind_from_irqhandler (per_cpu(ipi_irq, cpu), NULL);
   26.95  			per_cpu(ipi_irq, cpu) = -1;
   26.96 @@ -503,6 +565,12 @@ ia64_send_ipi (int cpu, int vector, int 
   26.97  		case IA64_IPI_RESCHEDULE:
   26.98  			irq = per_cpu(ipi_to_irq, cpu)[RESCHEDULE_VECTOR];
   26.99  			break;
  26.100 +		case IA64_CMCP_VECTOR:
  26.101 +			irq = per_cpu(ipi_to_irq, cpu)[CMCP_VECTOR];
  26.102 +			break;
  26.103 +		case IA64_CPEP_VECTOR:
  26.104 +			irq = per_cpu(ipi_to_irq, cpu)[CPEP_VECTOR];
  26.105 +			break;
  26.106  		default:
  26.107  			printk(KERN_WARNING"Unsupported IPI type 0x%x\n", vector);
  26.108  			irq = 0;
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/perfmon.c	Tue Dec 12 09:58:42 2006 -0600
    27.3 @@ -0,0 +1,6941 @@
    27.4 +/*
    27.5 + * This file implements the perfmon-2 subsystem which is used
    27.6 + * to program the IA-64 Performance Monitoring Unit (PMU).
    27.7 + *
    27.8 + * The initial version of perfmon.c was written by
    27.9 + * Ganesh Venkitachalam, IBM Corp.
   27.10 + *
   27.11 + * Then it was modified for perfmon-1.x by Stephane Eranian and
   27.12 + * David Mosberger, Hewlett Packard Co.
   27.13 + *
   27.14 + * Version Perfmon-2.x is a rewrite of perfmon-1.x
   27.15 + * by Stephane Eranian, Hewlett Packard Co.
   27.16 + *
   27.17 + * Copyright (C) 1999-2005  Hewlett Packard Co
   27.18 + *               Stephane Eranian <eranian@hpl.hp.com>
   27.19 + *               David Mosberger-Tang <davidm@hpl.hp.com>
   27.20 + *
   27.21 + * More information about perfmon available at:
   27.22 + * 	http://www.hpl.hp.com/research/linux/perfmon
   27.23 + */
   27.24 +
   27.25 +#include <linux/config.h>
   27.26 +#include <linux/module.h>
   27.27 +#include <linux/kernel.h>
   27.28 +#include <linux/sched.h>
   27.29 +#include <linux/interrupt.h>
   27.30 +#include <linux/smp_lock.h>
   27.31 +#include <linux/proc_fs.h>
   27.32 +#include <linux/seq_file.h>
   27.33 +#include <linux/init.h>
   27.34 +#include <linux/vmalloc.h>
   27.35 +#include <linux/mm.h>
   27.36 +#include <linux/sysctl.h>
   27.37 +#include <linux/list.h>
   27.38 +#include <linux/file.h>
   27.39 +#include <linux/poll.h>
   27.40 +#include <linux/vfs.h>
   27.41 +#include <linux/pagemap.h>
   27.42 +#include <linux/mount.h>
   27.43 +#include <linux/bitops.h>
   27.44 +#include <linux/capability.h>
   27.45 +#include <linux/rcupdate.h>
   27.46 +#include <linux/completion.h>
   27.47 +
   27.48 +#include <asm/errno.h>
   27.49 +#include <asm/intrinsics.h>
   27.50 +#include <asm/page.h>
   27.51 +#include <asm/perfmon.h>
   27.52 +#include <asm/processor.h>
   27.53 +#include <asm/signal.h>
   27.54 +#include <asm/system.h>
   27.55 +#include <asm/uaccess.h>
   27.56 +#include <asm/delay.h>
   27.57 +
   27.58 +#ifdef CONFIG_PERFMON
   27.59 +#ifdef CONFIG_XEN
   27.60 +//#include <xen/xenoprof.h>
   27.61 +#include <xen/interface/xenoprof.h>
   27.62 +
   27.63 +static int xenoprof_is_primary = 0;
   27.64 +#define init_xenoprof_primary(is_primary)  (xenoprof_is_primary = (is_primary))
   27.65 +#define is_xenoprof_primary()	(xenoprof_is_primary)
   27.66 +#define XEN_NOT_SUPPORTED_YET						\
   27.67 +	do {								\
   27.68 +		if (is_running_on_xen()) {				\
   27.69 +			printk("%s is not supported yet under xen.\n",	\
   27.70 +			       __func__);				\
   27.71 +			return -ENOSYS;					\
   27.72 +		}							\
   27.73 +	} while (0)
   27.74 +#else
   27.75 +#define init_xenoprof_primary(is_primary)	do { } while (0)
   27.76 +#define is_xenoprof_primary()			(0)
   27.77 +#define XEN_NOT_SUPPORTED_YET			do { } while (0)
   27.78 +#define HYPERVISOR_perfmon_op(cmd, arg, count)	do { } while (0)
   27.79 +#endif
   27.80 +
   27.81 +/*
   27.82 + * perfmon context state
   27.83 + */
   27.84 +#define PFM_CTX_UNLOADED	1	/* context is not loaded onto any task */
   27.85 +#define PFM_CTX_LOADED		2	/* context is loaded onto a task */
   27.86 +#define PFM_CTX_MASKED		3	/* context is loaded but monitoring is masked due to overflow */
   27.87 +#define PFM_CTX_ZOMBIE		4	/* owner of the context is closing it */
   27.88 +
   27.89 +#define PFM_INVALID_ACTIVATION	(~0UL)
   27.90 +
   27.91 +/*
   27.92 + * depth of message queue
   27.93 + */
   27.94 +#define PFM_MAX_MSGS		32
   27.95 +#define PFM_CTXQ_EMPTY(g)	((g)->ctx_msgq_head == (g)->ctx_msgq_tail)
   27.96 +
   27.97 +/*
   27.98 + * type of a PMU register (bitmask).
   27.99 + * bitmask structure:
  27.100 + * 	bit0   : register implemented
  27.101 + * 	bit1   : end marker
  27.102 + * 	bit2-3 : reserved
  27.103 + * 	bit4   : pmc has pmc.pm
  27.104 + * 	bit5   : pmc controls a counter (has pmc.oi), pmd is used as counter
  27.105 + * 	bit6-7 : register type
  27.106 + * 	bit8-31: reserved
  27.107 + */
  27.108 +#define PFM_REG_NOTIMPL		0x0 /* not implemented at all */
  27.109 +#define PFM_REG_IMPL		0x1 /* register implemented */
  27.110 +#define PFM_REG_END		0x2 /* end marker */
  27.111 +#define PFM_REG_MONITOR		(0x1<<4|PFM_REG_IMPL) /* a PMC with a pmc.pm field only */
  27.112 +#define PFM_REG_COUNTING	(0x2<<4|PFM_REG_MONITOR) /* a monitor + pmc.oi+ PMD used as a counter */
  27.113 +#define PFM_REG_CONTROL		(0x4<<4|PFM_REG_IMPL) /* PMU control register */
  27.114 +#define	PFM_REG_CONFIG		(0x8<<4|PFM_REG_IMPL) /* configuration register */
  27.115 +#define PFM_REG_BUFFER	 	(0xc<<4|PFM_REG_IMPL) /* PMD used as buffer */
  27.116 +
  27.117 +#define PMC_IS_LAST(i)	(pmu_conf->pmc_desc[i].type & PFM_REG_END)
  27.118 +#define PMD_IS_LAST(i)	(pmu_conf->pmd_desc[i].type & PFM_REG_END)
  27.119 +
  27.120 +#define PMC_OVFL_NOTIFY(ctx, i)	((ctx)->ctx_pmds[i].flags &  PFM_REGFL_OVFL_NOTIFY)
  27.121 +
  27.122 +/* i assumed unsigned */
  27.123 +#define PMC_IS_IMPL(i)	  (i< PMU_MAX_PMCS && (pmu_conf->pmc_desc[i].type & PFM_REG_IMPL))
  27.124 +#define PMD_IS_IMPL(i)	  (i< PMU_MAX_PMDS && (pmu_conf->pmd_desc[i].type & PFM_REG_IMPL))
  27.125 +
  27.126 +/* XXX: these assume that register i is implemented */
  27.127 +#define PMD_IS_COUNTING(i) ((pmu_conf->pmd_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
  27.128 +#define PMC_IS_COUNTING(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
  27.129 +#define PMC_IS_MONITOR(i)  ((pmu_conf->pmc_desc[i].type & PFM_REG_MONITOR)  == PFM_REG_MONITOR)
  27.130 +#define PMC_IS_CONTROL(i)  ((pmu_conf->pmc_desc[i].type & PFM_REG_CONTROL)  == PFM_REG_CONTROL)
  27.131 +
  27.132 +#define PMC_DFL_VAL(i)     pmu_conf->pmc_desc[i].default_value
  27.133 +#define PMC_RSVD_MASK(i)   pmu_conf->pmc_desc[i].reserved_mask
  27.134 +#define PMD_PMD_DEP(i)	   pmu_conf->pmd_desc[i].dep_pmd[0]
  27.135 +#define PMC_PMD_DEP(i)	   pmu_conf->pmc_desc[i].dep_pmd[0]
  27.136 +
  27.137 +#define PFM_NUM_IBRS	  IA64_NUM_DBG_REGS
  27.138 +#define PFM_NUM_DBRS	  IA64_NUM_DBG_REGS
  27.139 +
  27.140 +#define CTX_OVFL_NOBLOCK(c)	((c)->ctx_fl_block == 0)
  27.141 +#define CTX_HAS_SMPL(c)		((c)->ctx_fl_is_sampling)
  27.142 +#define PFM_CTX_TASK(h)		(h)->ctx_task
  27.143 +
  27.144 +#define PMU_PMC_OI		5 /* position of pmc.oi bit */
  27.145 +
  27.146 +/* XXX: does not support more than 64 PMDs */
  27.147 +#define CTX_USED_PMD(ctx, mask) (ctx)->ctx_used_pmds[0] |= (mask)
  27.148 +#define CTX_IS_USED_PMD(ctx, c) (((ctx)->ctx_used_pmds[0] & (1UL << (c))) != 0UL)
  27.149 +
  27.150 +#define CTX_USED_MONITOR(ctx, mask) (ctx)->ctx_used_monitors[0] |= (mask)
  27.151 +
  27.152 +#define CTX_USED_IBR(ctx,n) 	(ctx)->ctx_used_ibrs[(n)>>6] |= 1UL<< ((n) % 64)
  27.153 +#define CTX_USED_DBR(ctx,n) 	(ctx)->ctx_used_dbrs[(n)>>6] |= 1UL<< ((n) % 64)
  27.154 +#define CTX_USES_DBREGS(ctx)	(((pfm_context_t *)(ctx))->ctx_fl_using_dbreg==1)
  27.155 +#define PFM_CODE_RR	0	/* requesting code range restriction */
  27.156 +#define PFM_DATA_RR	1	/* requestion data range restriction */
  27.157 +
  27.158 +#define PFM_CPUINFO_CLEAR(v)	pfm_get_cpu_var(pfm_syst_info) &= ~(v)
  27.159 +#define PFM_CPUINFO_SET(v)	pfm_get_cpu_var(pfm_syst_info) |= (v)
  27.160 +#define PFM_CPUINFO_GET()	pfm_get_cpu_var(pfm_syst_info)
  27.161 +
  27.162 +#define RDEP(x)	(1UL<<(x))
  27.163 +
  27.164 +/*
  27.165 + * context protection macros
  27.166 + * in SMP:
  27.167 + * 	- we need to protect against CPU concurrency (spin_lock)
  27.168 + * 	- we need to protect against PMU overflow interrupts (local_irq_disable)
  27.169 + * in UP:
  27.170 + * 	- we need to protect against PMU overflow interrupts (local_irq_disable)
  27.171 + *
  27.172 + * spin_lock_irqsave()/spin_lock_irqrestore():
  27.173 + * 	in SMP: local_irq_disable + spin_lock
  27.174 + * 	in UP : local_irq_disable
  27.175 + *
  27.176 + * spin_lock()/spin_lock():
  27.177 + * 	in UP : removed automatically
  27.178 + * 	in SMP: protect against context accesses from other CPU. interrupts
  27.179 + * 	        are not masked. This is useful for the PMU interrupt handler
  27.180 + * 	        because we know we will not get PMU concurrency in that code.
  27.181 + */
  27.182 +#define PROTECT_CTX(c, f) \
  27.183 +	do {  \
  27.184 +		DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, current->pid)); \
  27.185 +		spin_lock_irqsave(&(c)->ctx_lock, f); \
  27.186 +		DPRINT(("spinlocked ctx %p  by [%d]\n", c, current->pid)); \
  27.187 +	} while(0)
  27.188 +
  27.189 +#define UNPROTECT_CTX(c, f) \
  27.190 +	do { \
  27.191 +		DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, current->pid)); \
  27.192 +		spin_unlock_irqrestore(&(c)->ctx_lock, f); \
  27.193 +	} while(0)
  27.194 +
  27.195 +#define PROTECT_CTX_NOPRINT(c, f) \
  27.196 +	do {  \
  27.197 +		spin_lock_irqsave(&(c)->ctx_lock, f); \
  27.198 +	} while(0)
  27.199 +
  27.200 +
  27.201 +#define UNPROTECT_CTX_NOPRINT(c, f) \
  27.202 +	do { \
  27.203 +		spin_unlock_irqrestore(&(c)->ctx_lock, f); \
  27.204 +	} while(0)
  27.205 +
  27.206 +
  27.207 +#define PROTECT_CTX_NOIRQ(c) \
  27.208 +	do {  \
  27.209 +		spin_lock(&(c)->ctx_lock); \
  27.210 +	} while(0)
  27.211 +
  27.212 +#define UNPROTECT_CTX_NOIRQ(c) \
  27.213 +	do { \
  27.214 +		spin_unlock(&(c)->ctx_lock); \
  27.215 +	} while(0)
  27.216 +
  27.217 +
  27.218 +#ifdef CONFIG_SMP
  27.219 +
  27.220 +#define GET_ACTIVATION()	pfm_get_cpu_var(pmu_activation_number)
  27.221 +#define INC_ACTIVATION()	pfm_get_cpu_var(pmu_activation_number)++
  27.222 +#define SET_ACTIVATION(c)	(c)->ctx_last_activation = GET_ACTIVATION()
  27.223 +
  27.224 +#else /* !CONFIG_SMP */
  27.225 +#define SET_ACTIVATION(t) 	do {} while(0)
  27.226 +#define GET_ACTIVATION(t) 	do {} while(0)
  27.227 +#define INC_ACTIVATION(t) 	do {} while(0)
  27.228 +#endif /* CONFIG_SMP */
  27.229 +
  27.230 +#define SET_PMU_OWNER(t, c)	do { pfm_get_cpu_var(pmu_owner) = (t); pfm_get_cpu_var(pmu_ctx) = (c); } while(0)
  27.231 +#define GET_PMU_OWNER()		pfm_get_cpu_var(pmu_owner)
  27.232 +#define GET_PMU_CTX()		pfm_get_cpu_var(pmu_ctx)
  27.233 +
  27.234 +#define LOCK_PFS(g)	    	spin_lock_irqsave(&pfm_sessions.pfs_lock, g)
  27.235 +#define UNLOCK_PFS(g)	    	spin_unlock_irqrestore(&pfm_sessions.pfs_lock, g)
  27.236 +
  27.237 +#define PFM_REG_RETFLAG_SET(flags, val)	do { flags &= ~PFM_REG_RETFL_MASK; flags |= (val); } while(0)
  27.238 +
  27.239 +/*
  27.240 + * cmp0 must be the value of pmc0
  27.241 + */
  27.242 +#define PMC0_HAS_OVFL(cmp0)  (cmp0 & ~0x1UL)
  27.243 +
  27.244 +#define PFMFS_MAGIC 0xa0b4d889
  27.245 +
  27.246 +/*
  27.247 + * debugging
  27.248 + */
  27.249 +#define PFM_DEBUGGING 1
  27.250 +#ifdef PFM_DEBUGGING
  27.251 +#define DPRINT(a) \
  27.252 +	do { \
  27.253 +		if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \
  27.254 +	} while (0)
  27.255 +
  27.256 +#define DPRINT_ovfl(a) \
  27.257 +	do { \
  27.258 +		if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \
  27.259 +	} while (0)
  27.260 +#endif
  27.261 +
  27.262 +/*
  27.263 + * 64-bit software counter structure
  27.264 + *
  27.265 + * the next_reset_type is applied to the next call to pfm_reset_regs()
  27.266 + */
  27.267 +typedef struct {
  27.268 +	unsigned long	val;		/* virtual 64bit counter value */
  27.269 +	unsigned long	lval;		/* last reset value */
  27.270 +	unsigned long	long_reset;	/* reset value on sampling overflow */
  27.271 +	unsigned long	short_reset;    /* reset value on overflow */
  27.272 +	unsigned long	reset_pmds[4];  /* which other pmds to reset when this counter overflows */
  27.273 +	unsigned long	smpl_pmds[4];   /* which pmds are accessed when counter overflow */
  27.274 +	unsigned long	seed;		/* seed for random-number generator */
  27.275 +	unsigned long	mask;		/* mask for random-number generator */
  27.276 +	unsigned int 	flags;		/* notify/do not notify */
  27.277 +	unsigned long	eventid;	/* overflow event identifier */
  27.278 +} pfm_counter_t;
  27.279 +
  27.280 +/*
  27.281 + * context flags
  27.282 + */
  27.283 +typedef struct {
  27.284 +	unsigned int block:1;		/* when 1, task will blocked on user notifications */
  27.285 +	unsigned int system:1;		/* do system wide monitoring */
  27.286 +	unsigned int using_dbreg:1;	/* using range restrictions (debug registers) */
  27.287 +	unsigned int is_sampling:1;	/* true if using a custom format */
  27.288 +	unsigned int excl_idle:1;	/* exclude idle task in system wide session */
  27.289 +	unsigned int going_zombie:1;	/* context is zombie (MASKED+blocking) */
  27.290 +	unsigned int trap_reason:2;	/* reason for going into pfm_handle_work() */
  27.291 +	unsigned int no_msg:1;		/* no message sent on overflow */
  27.292 +	unsigned int can_restart:1;	/* allowed to issue a PFM_RESTART */
  27.293 +	unsigned int reserved:22;
  27.294 +} pfm_context_flags_t;
  27.295 +
  27.296 +#define PFM_TRAP_REASON_NONE		0x0	/* default value */
  27.297 +#define PFM_TRAP_REASON_BLOCK		0x1	/* we need to block on overflow */
  27.298 +#define PFM_TRAP_REASON_RESET		0x2	/* we need to reset PMDs */
  27.299 +
  27.300 +
  27.301 +/*
  27.302 + * perfmon context: encapsulates all the state of a monitoring session
  27.303 + */
  27.304 +
  27.305 +typedef struct pfm_context {
  27.306 +	spinlock_t		ctx_lock;		/* context protection */
  27.307 +
  27.308 +	pfm_context_flags_t	ctx_flags;		/* bitmask of flags  (block reason incl.) */
  27.309 +	unsigned int		ctx_state;		/* state: active/inactive (no bitfield) */
  27.310 +
  27.311 +	struct task_struct 	*ctx_task;		/* task to which context is attached */
  27.312 +
  27.313 +	unsigned long		ctx_ovfl_regs[4];	/* which registers overflowed (notification) */
  27.314 +
  27.315 +	struct completion	ctx_restart_done;  	/* use for blocking notification mode */
  27.316 +
  27.317 +	unsigned long		ctx_used_pmds[4];	/* bitmask of PMD used            */
  27.318 +	unsigned long		ctx_all_pmds[4];	/* bitmask of all accessible PMDs */
  27.319 +	unsigned long		ctx_reload_pmds[4];	/* bitmask of force reload PMD on ctxsw in */
  27.320 +
  27.321 +	unsigned long		ctx_all_pmcs[4];	/* bitmask of all accessible PMCs */
  27.322 +	unsigned long		ctx_reload_pmcs[4];	/* bitmask of force reload PMC on ctxsw in */
  27.323 +	unsigned long		ctx_used_monitors[4];	/* bitmask of monitor PMC being used */
  27.324 +
  27.325 +	unsigned long		ctx_pmcs[IA64_NUM_PMC_REGS];	/*  saved copies of PMC values */
  27.326 +
  27.327 +	unsigned int		ctx_used_ibrs[1];		/* bitmask of used IBR (speedup ctxsw in) */
  27.328 +	unsigned int		ctx_used_dbrs[1];		/* bitmask of used DBR (speedup ctxsw in) */
  27.329 +	unsigned long		ctx_dbrs[IA64_NUM_DBG_REGS];	/* DBR values (cache) when not loaded */
  27.330 +	unsigned long		ctx_ibrs[IA64_NUM_DBG_REGS];	/* IBR values (cache) when not loaded */
  27.331 +
  27.332 +	pfm_counter_t		ctx_pmds[IA64_NUM_PMD_REGS]; /* software state for PMDS */
  27.333 +
  27.334 +	u64			ctx_saved_psr_up;	/* only contains psr.up value */
  27.335 +
  27.336 +	unsigned long		ctx_last_activation;	/* context last activation number for last_cpu */
  27.337 +	unsigned int		ctx_last_cpu;		/* CPU id of current or last CPU used (SMP only) */
  27.338 +	unsigned int		ctx_cpu;		/* cpu to which perfmon is applied (system wide) */
  27.339 +
  27.340 +	int			ctx_fd;			/* file descriptor used my this context */
  27.341 +	pfm_ovfl_arg_t		ctx_ovfl_arg;		/* argument to custom buffer format handler */
  27.342 +
  27.343 +	pfm_buffer_fmt_t	*ctx_buf_fmt;		/* buffer format callbacks */
  27.344 +	void			*ctx_smpl_hdr;		/* points to sampling buffer header kernel vaddr */
  27.345 +	unsigned long		ctx_smpl_size;		/* size of sampling buffer */
  27.346 +	void			*ctx_smpl_vaddr;	/* user level virtual address of smpl buffer */
  27.347 +
  27.348 +	wait_queue_head_t 	ctx_msgq_wait;
  27.349 +	pfm_msg_t		ctx_msgq[PFM_MAX_MSGS];
  27.350 +	int			ctx_msgq_head;
  27.351 +	int			ctx_msgq_tail;
  27.352 +	struct fasync_struct	*ctx_async_queue;
  27.353 +
  27.354 +	wait_queue_head_t 	ctx_zombieq;		/* termination cleanup wait queue */
  27.355 +} pfm_context_t;
  27.356 +
  27.357 +/*
  27.358 + * magic number used to verify that structure is really
  27.359 + * a perfmon context
  27.360 + */
  27.361 +#define PFM_IS_FILE(f)		((f)->f_op == &pfm_file_ops)
  27.362 +
  27.363 +#define PFM_GET_CTX(t)	 	((pfm_context_t *)(t)->thread.pfm_context)
  27.364 +
  27.365 +#ifdef CONFIG_SMP
  27.366 +#define SET_LAST_CPU(ctx, v)	(ctx)->ctx_last_cpu = (v)
  27.367 +#define GET_LAST_CPU(ctx)	(ctx)->ctx_last_cpu
  27.368 +#else
  27.369 +#define SET_LAST_CPU(ctx, v)	do {} while(0)
  27.370 +#define GET_LAST_CPU(ctx)	do {} while(0)
  27.371 +#endif
  27.372 +
  27.373 +
  27.374 +#define ctx_fl_block		ctx_flags.block
  27.375 +#define ctx_fl_system		ctx_flags.system
  27.376 +#define ctx_fl_using_dbreg	ctx_flags.using_dbreg
  27.377 +#define ctx_fl_is_sampling	ctx_flags.is_sampling
  27.378 +#define ctx_fl_excl_idle	ctx_flags.excl_idle
  27.379 +#define ctx_fl_going_zombie	ctx_flags.going_zombie
  27.380 +#define ctx_fl_trap_reason	ctx_flags.trap_reason
  27.381 +#define ctx_fl_no_msg		ctx_flags.no_msg
  27.382 +#define ctx_fl_can_restart	ctx_flags.can_restart
  27.383 +
  27.384 +#define PFM_SET_WORK_PENDING(t, v)	do { (t)->thread.pfm_needs_checking = v; } while(0);
  27.385 +#define PFM_GET_WORK_PENDING(t)		(t)->thread.pfm_needs_checking
  27.386 +
  27.387 +/*
  27.388 + * global information about all sessions
  27.389 + * mostly used to synchronize between system wide and per-process
  27.390 + */
  27.391 +typedef struct {
  27.392 +	spinlock_t		pfs_lock;		   /* lock the structure */
  27.393 +
  27.394 +	unsigned int		pfs_task_sessions;	   /* number of per task sessions */
  27.395 +	unsigned int		pfs_sys_sessions;	   /* number of per system wide sessions */
  27.396 +	unsigned int		pfs_sys_use_dbregs;	   /* incremented when a system wide session uses debug regs */
  27.397 +	unsigned int		pfs_ptrace_use_dbregs;	   /* incremented when a process uses debug regs */
  27.398 +	struct task_struct	*pfs_sys_session[NR_CPUS]; /* point to task owning a system-wide session */
  27.399 +} pfm_session_t;
  27.400 +
  27.401 +/*
  27.402 + * information about a PMC or PMD.
  27.403 + * dep_pmd[]: a bitmask of dependent PMD registers
  27.404 + * dep_pmc[]: a bitmask of dependent PMC registers
  27.405 + */
  27.406 +typedef int (*pfm_reg_check_t)(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
  27.407 +typedef struct {
  27.408 +	unsigned int		type;
  27.409 +	int			pm_pos;
  27.410 +	unsigned long		default_value;	/* power-on default value */
  27.411 +	unsigned long		reserved_mask;	/* bitmask of reserved bits */
  27.412 +	pfm_reg_check_t		read_check;
  27.413 +	pfm_reg_check_t		write_check;
  27.414 +	unsigned long		dep_pmd[4];
  27.415 +	unsigned long		dep_pmc[4];
  27.416 +} pfm_reg_desc_t;
  27.417 +
  27.418 +/* assume cnum is a valid monitor */
  27.419 +#define PMC_PM(cnum, val)	(((val) >> (pmu_conf->pmc_desc[cnum].pm_pos)) & 0x1)
  27.420 +
  27.421 +/*
  27.422 + * This structure is initialized at boot time and contains
  27.423 + * a description of the PMU main characteristics.
  27.424 + *
  27.425 + * If the probe function is defined, detection is based
  27.426 + * on its return value: 
  27.427 + * 	- 0 means recognized PMU
  27.428 + * 	- anything else means not supported
  27.429 + * When the probe function is not defined, then the pmu_family field
  27.430 + * is used and it must match the host CPU family such that:
  27.431 + * 	- cpu->family & config->pmu_family != 0
  27.432 + */
  27.433 +typedef struct {
  27.434 +	unsigned long  ovfl_val;	/* overflow value for counters */
  27.435 +
  27.436 +	pfm_reg_desc_t *pmc_desc;	/* detailed PMC register dependencies descriptions */
  27.437 +	pfm_reg_desc_t *pmd_desc;	/* detailed PMD register dependencies descriptions */
  27.438 +
  27.439 +	unsigned int   num_pmcs;	/* number of PMCS: computed at init time */
  27.440 +	unsigned int   num_pmds;	/* number of PMDS: computed at init time */
  27.441 +	unsigned long  impl_pmcs[4];	/* bitmask of implemented PMCS */
  27.442 +	unsigned long  impl_pmds[4];	/* bitmask of implemented PMDS */
  27.443 +
  27.444 +	char	      *pmu_name;	/* PMU family name */
  27.445 +	unsigned int  pmu_family;	/* cpuid family pattern used to identify pmu */
  27.446 +	unsigned int  flags;		/* pmu specific flags */
  27.447 +	unsigned int  num_ibrs;		/* number of IBRS: computed at init time */
  27.448 +	unsigned int  num_dbrs;		/* number of DBRS: computed at init time */
  27.449 +	unsigned int  num_counters;	/* PMC/PMD counting pairs : computed at init time */
  27.450 +	int           (*probe)(void);   /* customized probe routine */
  27.451 +	unsigned int  use_rr_dbregs:1;	/* set if debug registers used for range restriction */
  27.452 +} pmu_config_t;
  27.453 +/*
  27.454 + * PMU specific flags
  27.455 + */
  27.456 +#define PFM_PMU_IRQ_RESEND	1	/* PMU needs explicit IRQ resend */
  27.457 +
  27.458 +/*
  27.459 + * debug register related type definitions
  27.460 + */
  27.461 +typedef struct {
  27.462 +	unsigned long ibr_mask:56;
  27.463 +	unsigned long ibr_plm:4;
  27.464 +	unsigned long ibr_ig:3;
  27.465 +	unsigned long ibr_x:1;
  27.466 +} ibr_mask_reg_t;
  27.467 +
  27.468 +typedef struct {
  27.469 +	unsigned long dbr_mask:56;
  27.470 +	unsigned long dbr_plm:4;
  27.471 +	unsigned long dbr_ig:2;
  27.472 +	unsigned long dbr_w:1;
  27.473 +	unsigned long dbr_r:1;
  27.474 +} dbr_mask_reg_t;
  27.475 +
  27.476 +typedef union {
  27.477 +	unsigned long  val;
  27.478 +	ibr_mask_reg_t ibr;
  27.479 +	dbr_mask_reg_t dbr;
  27.480 +} dbreg_t;
  27.481 +
  27.482 +
  27.483 +/*
  27.484 + * perfmon command descriptions
  27.485 + */
  27.486 +typedef struct {
  27.487 +	int		(*cmd_func)(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
  27.488 +	char		*cmd_name;
  27.489 +	int		cmd_flags;
  27.490 +	unsigned int	cmd_narg;
  27.491 +	size_t		cmd_argsize;
  27.492 +	int		(*cmd_getsize)(void *arg, size_t *sz);
  27.493 +} pfm_cmd_desc_t;
  27.494 +
  27.495 +#define PFM_CMD_FD		0x01	/* command requires a file descriptor */
  27.496 +#define PFM_CMD_ARG_READ	0x02	/* command must read argument(s) */
  27.497 +#define PFM_CMD_ARG_RW		0x04	/* command must read/write argument(s) */
  27.498 +#define PFM_CMD_STOP		0x08	/* command does not work on zombie context */
  27.499 +
  27.500 +
  27.501 +#define PFM_CMD_NAME(cmd)	pfm_cmd_tab[(cmd)].cmd_name
  27.502 +#define PFM_CMD_READ_ARG(cmd)	(pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_ARG_READ)
  27.503 +#define PFM_CMD_RW_ARG(cmd)	(pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_ARG_RW)
  27.504 +#define PFM_CMD_USE_FD(cmd)	(pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_FD)
  27.505 +#define PFM_CMD_STOPPED(cmd)	(pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_STOP)
  27.506 +
  27.507 +#define PFM_CMD_ARG_MANY	-1 /* cannot be zero */
  27.508 +
  27.509 +typedef struct {
  27.510 +	unsigned long pfm_spurious_ovfl_intr_count;	/* keep track of spurious ovfl interrupts */
  27.511 +	unsigned long pfm_replay_ovfl_intr_count;	/* keep track of replayed ovfl interrupts */
  27.512 +	unsigned long pfm_ovfl_intr_count; 		/* keep track of ovfl interrupts */
  27.513 +	unsigned long pfm_ovfl_intr_cycles;		/* cycles spent processing ovfl interrupts */
  27.514 +	unsigned long pfm_ovfl_intr_cycles_min;		/* min cycles spent processing ovfl interrupts */
  27.515 +	unsigned long pfm_ovfl_intr_cycles_max;		/* max cycles spent processing ovfl interrupts */
  27.516 +	unsigned long pfm_smpl_handler_calls;
  27.517 +	unsigned long pfm_smpl_handler_cycles;
  27.518 +	char pad[SMP_CACHE_BYTES] ____cacheline_aligned;
  27.519 +} pfm_stats_t;
  27.520 +
  27.521 +/*
  27.522 + * perfmon internal variables
  27.523 + */
  27.524 +static pfm_stats_t		pfm_stats[NR_CPUS];
  27.525 +static pfm_session_t		pfm_sessions;	/* global sessions information */
  27.526 +
  27.527 +static DEFINE_SPINLOCK(pfm_alt_install_check);
  27.528 +static pfm_intr_handler_desc_t  *pfm_alt_intr_handler;
  27.529 +
  27.530 +static struct proc_dir_entry 	*perfmon_dir;
  27.531 +static pfm_uuid_t		pfm_null_uuid = {0,};
  27.532 +
  27.533 +static spinlock_t		pfm_buffer_fmt_lock;
  27.534 +static LIST_HEAD(pfm_buffer_fmt_list);
  27.535 +
  27.536 +static pmu_config_t		*pmu_conf;
  27.537 +
  27.538 +/* sysctl() controls */
  27.539 +pfm_sysctl_t pfm_sysctl;
  27.540 +EXPORT_SYMBOL(pfm_sysctl);
  27.541 +
  27.542 +static ctl_table pfm_ctl_table[]={
  27.543 +	{1, "debug", &pfm_sysctl.debug, sizeof(int), 0666, NULL, &proc_dointvec, NULL,},
  27.544 +	{2, "debug_ovfl", &pfm_sysctl.debug_ovfl, sizeof(int), 0666, NULL, &proc_dointvec, NULL,},
  27.545 +	{3, "fastctxsw", &pfm_sysctl.fastctxsw, sizeof(int), 0600, NULL, &proc_dointvec, NULL,},
  27.546 +	{4, "expert_mode", &pfm_sysctl.expert_mode, sizeof(int), 0600, NULL, &proc_dointvec, NULL,},
  27.547 +	{ 0, },
  27.548 +};
  27.549 +static ctl_table pfm_sysctl_dir[] = {
  27.550 +	{1, "perfmon", NULL, 0, 0755, pfm_ctl_table, },
  27.551 + 	{0,},
  27.552 +};
  27.553 +static ctl_table pfm_sysctl_root[] = {
  27.554 +	{1, "kernel", NULL, 0, 0755, pfm_sysctl_dir, },
  27.555 + 	{0,},
  27.556 +};
  27.557 +static struct ctl_table_header *pfm_sysctl_header;
  27.558 +
  27.559 +static int pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
  27.560 +static int pfm_flush(struct file *filp);
  27.561 +
  27.562 +#define pfm_get_cpu_var(v)		__ia64_per_cpu_var(v)
  27.563 +#define pfm_get_cpu_data(a,b)		per_cpu(a, b)
  27.564 +
  27.565 +static inline void
  27.566 +pfm_put_task(struct task_struct *task)
  27.567 +{
  27.568 +	if (task != current) put_task_struct(task);
  27.569 +}
  27.570 +
  27.571 +static inline void
  27.572 +pfm_set_task_notify(struct task_struct *task)
  27.573 +{
  27.574 +	struct thread_info *info;
  27.575 +
  27.576 +	info = (struct thread_info *) ((char *) task + IA64_TASK_SIZE);
  27.577 +	set_bit(TIF_NOTIFY_RESUME, &info->flags);
  27.578 +}
  27.579 +
  27.580 +static inline void
  27.581 +pfm_clear_task_notify(void)
  27.582 +{
  27.583 +	clear_thread_flag(TIF_NOTIFY_RESUME);
  27.584 +}
  27.585 +
  27.586 +static inline void
  27.587 +pfm_reserve_page(unsigned long a)
  27.588 +{
  27.589 +	SetPageReserved(vmalloc_to_page((void *)a));
  27.590 +}
  27.591 +static inline void
  27.592 +pfm_unreserve_page(unsigned long a)
  27.593 +{
  27.594 +	ClearPageReserved(vmalloc_to_page((void*)a));
  27.595 +}
  27.596 +
  27.597 +static inline unsigned long
  27.598 +pfm_protect_ctx_ctxsw(pfm_context_t *x)
  27.599 +{
  27.600 +	spin_lock(&(x)->ctx_lock);
  27.601 +	return 0UL;
  27.602 +}
  27.603 +
  27.604 +static inline void
  27.605 +pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
  27.606 +{
  27.607 +	spin_unlock(&(x)->ctx_lock);
  27.608 +}
  27.609 +
  27.610 +static inline unsigned int
  27.611 +pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
  27.612 +{
  27.613 +	return do_munmap(mm, addr, len);
  27.614 +}
  27.615 +
  27.616 +static inline unsigned long 
  27.617 +pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
  27.618 +{
  27.619 +	return get_unmapped_area(file, addr, len, pgoff, flags);
  27.620 +}
  27.621 +
  27.622 +
  27.623 +static struct super_block *
  27.624 +pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
  27.625 +{
  27.626 +	return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
  27.627 +}
  27.628 +
  27.629 +static struct file_system_type pfm_fs_type = {
  27.630 +	.name     = "pfmfs",
  27.631 +	.get_sb   = pfmfs_get_sb,
  27.632 +	.kill_sb  = kill_anon_super,
  27.633 +};
  27.634 +
  27.635 +DEFINE_PER_CPU(unsigned long, pfm_syst_info);
  27.636 +DEFINE_PER_CPU(struct task_struct *, pmu_owner);
  27.637 +DEFINE_PER_CPU(pfm_context_t  *, pmu_ctx);
  27.638 +DEFINE_PER_CPU(unsigned long, pmu_activation_number);
  27.639 +EXPORT_PER_CPU_SYMBOL_GPL(pfm_syst_info);
  27.640 +
  27.641 +
  27.642 +/* forward declaration */
  27.643 +static struct file_operations pfm_file_ops;
  27.644 +
  27.645 +/*
  27.646 + * forward declarations
  27.647 + */
  27.648 +#ifndef CONFIG_SMP
  27.649 +static void pfm_lazy_save_regs (struct task_struct *ta);
  27.650 +#endif
  27.651 +
  27.652 +void dump_pmu_state(const char *);
  27.653 +static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
  27.654 +
  27.655 +#include "perfmon_itanium.h"
  27.656 +#include "perfmon_mckinley.h"
  27.657 +#include "perfmon_montecito.h"
  27.658 +#include "perfmon_generic.h"
  27.659 +
  27.660 +static pmu_config_t *pmu_confs[]={
  27.661 +	&pmu_conf_mont,
  27.662 +	&pmu_conf_mck,
  27.663 +	&pmu_conf_ita,
  27.664 +	&pmu_conf_gen, /* must be last */
  27.665 +	NULL
  27.666 +};
  27.667 +
  27.668 +
  27.669 +static int pfm_end_notify_user(pfm_context_t *ctx);
  27.670 +
  27.671 +static inline void
  27.672 +pfm_clear_psr_pp(void)
  27.673 +{
  27.674 +	ia64_rsm(IA64_PSR_PP);
  27.675 +	ia64_srlz_i();
  27.676 +}
  27.677 +
  27.678 +static inline void
  27.679 +pfm_set_psr_pp(void)
  27.680 +{
  27.681 +	ia64_ssm(IA64_PSR_PP);
  27.682 +	ia64_srlz_i();
  27.683 +}
  27.684 +
  27.685 +static inline void
  27.686 +pfm_clear_psr_up(void)
  27.687 +{
  27.688 +	ia64_rsm(IA64_PSR_UP);
  27.689 +	ia64_srlz_i();
  27.690 +}
  27.691 +
  27.692 +static inline void
  27.693 +pfm_set_psr_up(void)
  27.694 +{
  27.695 +	ia64_ssm(IA64_PSR_UP);
  27.696 +	ia64_srlz_i();
  27.697 +}
  27.698 +
  27.699 +static inline unsigned long
  27.700 +pfm_get_psr(void)
  27.701 +{
  27.702 +	unsigned long tmp;
  27.703 +	tmp = ia64_getreg(_IA64_REG_PSR);
  27.704 +	ia64_srlz_i();
  27.705 +	return tmp;
  27.706 +}
  27.707 +
  27.708 +static inline void
  27.709 +pfm_set_psr_l(unsigned long val)
  27.710 +{
  27.711 +	ia64_setreg(_IA64_REG_PSR_L, val);
  27.712 +	ia64_srlz_i();
  27.713 +}
  27.714 +
  27.715 +static inline void
  27.716 +pfm_freeze_pmu(void)
  27.717 +{
  27.718 +	ia64_set_pmc(0,1UL);
  27.719 +	ia64_srlz_d();
  27.720 +}
  27.721 +
  27.722 +static inline void
  27.723 +pfm_unfreeze_pmu(void)
  27.724 +{
  27.725 +	ia64_set_pmc(0,0UL);
  27.726 +	ia64_srlz_d();
  27.727 +}
  27.728 +
  27.729 +static inline void
  27.730 +pfm_restore_ibrs(unsigned long *ibrs, unsigned int nibrs)
  27.731 +{
  27.732 +	int i;
  27.733 +
  27.734 +	for (i=0; i < nibrs; i++) {
  27.735 +		ia64_set_ibr(i, ibrs[i]);
  27.736 +		ia64_dv_serialize_instruction();
  27.737 +	}
  27.738 +	ia64_srlz_i();
  27.739 +}
  27.740 +
  27.741 +static inline void
  27.742 +pfm_restore_dbrs(unsigned long *dbrs, unsigned int ndbrs)
  27.743 +{
  27.744 +	int i;
  27.745 +
  27.746 +	for (i=0; i < ndbrs; i++) {
  27.747 +		ia64_set_dbr(i, dbrs[i]);
  27.748 +		ia64_dv_serialize_data();
  27.749 +	}
  27.750 +	ia64_srlz_d();
  27.751 +}
  27.752 +
  27.753 +/*
  27.754 + * PMD[i] must be a counter. no check is made
  27.755 + */
  27.756 +static inline unsigned long
  27.757 +pfm_read_soft_counter(pfm_context_t *ctx, int i)
  27.758 +{
  27.759 +	return ctx->ctx_pmds[i].val + (ia64_get_pmd(i) & pmu_conf->ovfl_val);
  27.760 +}
  27.761 +
  27.762 +/*
  27.763 + * PMD[i] must be a counter. no check is made
  27.764 + */
  27.765 +static inline void
  27.766 +pfm_write_soft_counter(pfm_context_t *ctx, int i, unsigned long val)
  27.767 +{
  27.768 +	unsigned long ovfl_val = pmu_conf->ovfl_val;
  27.769 +
  27.770 +	ctx->ctx_pmds[i].val = val  & ~ovfl_val;
  27.771 +	/*
  27.772 +	 * writing to unimplemented part is ignore, so we do not need to
  27.773 +	 * mask off top part
  27.774 +	 */
  27.775 +	ia64_set_pmd(i, val & ovfl_val);
  27.776 +}
  27.777 +
  27.778 +static pfm_msg_t *
  27.779 +pfm_get_new_msg(pfm_context_t *ctx)
  27.780 +{
  27.781 +	int idx, next;
  27.782 +
  27.783 +	next = (ctx->ctx_msgq_tail+1) % PFM_MAX_MSGS;
  27.784 +
  27.785 +	DPRINT(("ctx_fd=%p head=%d tail=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
  27.786 +	if (next == ctx->ctx_msgq_head) return NULL;
  27.787 +
  27.788 + 	idx = 	ctx->ctx_msgq_tail;
  27.789 +	ctx->ctx_msgq_tail = next;
  27.790 +
  27.791 +	DPRINT(("ctx=%p head=%d tail=%d msg=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail, idx));
  27.792 +
  27.793 +	return ctx->ctx_msgq+idx;
  27.794 +}
  27.795 +
  27.796 +static pfm_msg_t *
  27.797 +pfm_get_next_msg(pfm_context_t *ctx)
  27.798 +{
  27.799 +	pfm_msg_t *msg;
  27.800 +
  27.801 +	DPRINT(("ctx=%p head=%d tail=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
  27.802 +
  27.803 +	if (PFM_CTXQ_EMPTY(ctx)) return NULL;
  27.804 +
  27.805 +	/*
  27.806 +	 * get oldest message
  27.807 +	 */
  27.808 +	msg = ctx->ctx_msgq+ctx->ctx_msgq_head;
  27.809 +
  27.810 +	/*
  27.811 +	 * and move forward
  27.812 +	 */
  27.813 +	ctx->ctx_msgq_head = (ctx->ctx_msgq_head+1) % PFM_MAX_MSGS;
  27.814 +
  27.815 +	DPRINT(("ctx=%p head=%d tail=%d type=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail, msg->pfm_gen_msg.msg_type));
  27.816 +
  27.817 +	return msg;
  27.818 +}
  27.819 +
  27.820 +static void
  27.821 +pfm_reset_msgq(pfm_context_t *ctx)
  27.822 +{
  27.823 +	ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
  27.824 +	DPRINT(("ctx=%p msgq reset\n", ctx));
  27.825 +}
  27.826 +
  27.827 +static void *
  27.828 +pfm_rvmalloc(unsigned long size)
  27.829 +{
  27.830 +	void *mem;
  27.831 +	unsigned long addr;
  27.832 +
  27.833 +	size = PAGE_ALIGN(size);
  27.834 +	mem  = vmalloc(size);
  27.835 +	if (mem) {
  27.836 +		//printk("perfmon: CPU%d pfm_rvmalloc(%ld)=%p\n", smp_processor_id(), size, mem);
  27.837 +		memset(mem, 0, size);
  27.838 +		addr = (unsigned long)mem;
  27.839 +		while (size > 0) {
  27.840 +			pfm_reserve_page(addr);
  27.841 +			addr+=PAGE_SIZE;
  27.842 +			size-=PAGE_SIZE;
  27.843 +		}
  27.844 +	}
  27.845 +	return mem;
  27.846 +}
  27.847 +
  27.848 +static void
  27.849 +pfm_rvfree(void *mem, unsigned long size)
  27.850 +{
  27.851 +	unsigned long addr;
  27.852 +
  27.853 +	if (mem) {
  27.854 +		DPRINT(("freeing physical buffer @%p size=%lu\n", mem, size));
  27.855 +		addr = (unsigned long) mem;
  27.856 +		while ((long) size > 0) {
  27.857 +			pfm_unreserve_page(addr);
  27.858 +			addr+=PAGE_SIZE;
  27.859 +			size-=PAGE_SIZE;
  27.860 +		}
  27.861 +		vfree(mem);
  27.862 +	}
  27.863 +	return;
  27.864 +}
  27.865 +
  27.866 +static pfm_context_t *
  27.867 +pfm_context_alloc(void)
  27.868 +{
  27.869 +	pfm_context_t *ctx;
  27.870 +
  27.871 +	/* 
  27.872 +	 * allocate context descriptor 
  27.873 +	 * must be able to free with interrupts disabled
  27.874 +	 */
  27.875 +	ctx = kmalloc(sizeof(pfm_context_t), GFP_KERNEL);
  27.876 +	if (ctx) {
  27.877 +		memset(ctx, 0, sizeof(pfm_context_t));
  27.878 +		DPRINT(("alloc ctx @%p\n", ctx));
  27.879 +	}
  27.880 +	return ctx;
  27.881 +}
  27.882 +
  27.883 +static void
  27.884 +pfm_context_free(pfm_context_t *ctx)
  27.885 +{
  27.886 +	if (ctx) {
  27.887 +		DPRINT(("free ctx @%p\n", ctx));
  27.888 +		kfree(ctx);
  27.889 +	}
  27.890 +}
  27.891 +
  27.892 +static void
  27.893 +pfm_mask_monitoring(struct task_struct *task)
  27.894 +{
  27.895 +	pfm_context_t *ctx = PFM_GET_CTX(task);
  27.896 +	struct thread_struct *th = &task->thread;
  27.897 +	unsigned long mask, val, ovfl_mask;
  27.898 +	int i;
  27.899 +
  27.900 +	DPRINT_ovfl(("masking monitoring for [%d]\n", task->pid));
  27.901 +
  27.902 +	ovfl_mask = pmu_conf->ovfl_val;
  27.903 +	/*
  27.904 +	 * monitoring can only be masked as a result of a valid
  27.905 +	 * counter overflow. In UP, it means that the PMU still
  27.906 +	 * has an owner. Note that the owner can be different
  27.907 +	 * from the current task. However the PMU state belongs
  27.908 +	 * to the owner.
  27.909 +	 * In SMP, a valid overflow only happens when task is
  27.910 +	 * current. Therefore if we come here, we know that
  27.911 +	 * the PMU state belongs to the current task, therefore
  27.912 +	 * we can access the live registers.
  27.913 +	 *
  27.914 +	 * So in both cases, the live register contains the owner's
  27.915 +	 * state. We can ONLY touch the PMU registers and NOT the PSR.
  27.916 +	 *
  27.917 +	 * As a consequence to this call, the thread->pmds[] array
  27.918 +	 * contains stale information which must be ignored
  27.919 +	 * when context is reloaded AND monitoring is active (see
  27.920 +	 * pfm_restart).
  27.921 +	 */
  27.922 +	mask = ctx->ctx_used_pmds[0];
  27.923 +	for (i = 0; mask; i++, mask>>=1) {
  27.924 +		/* skip non used pmds */
  27.925 +		if ((mask & 0x1) == 0) continue;
  27.926 +		val = ia64_get_pmd(i);
  27.927 +
  27.928 +		if (PMD_IS_COUNTING(i)) {
  27.929 +			/*
  27.930 +		 	 * we rebuild the full 64 bit value of the counter
  27.931 +		 	 */
  27.932 +			ctx->ctx_pmds[i].val += (val & ovfl_mask);
  27.933 +		} else {
  27.934 +			ctx->ctx_pmds[i].val = val;
  27.935 +		}
  27.936 +		DPRINT_ovfl(("pmd[%d]=0x%lx hw_pmd=0x%lx\n",
  27.937 +			i,
  27.938 +			ctx->ctx_pmds[i].val,
  27.939 +			val & ovfl_mask));
  27.940 +	}
  27.941 +	/*
  27.942 +	 * mask monitoring by setting the privilege level to 0
  27.943 +	 * we cannot use psr.pp/psr.up for this, it is controlled by
  27.944 +	 * the user
  27.945 +	 *
  27.946 +	 * if task is current, modify actual registers, otherwise modify
  27.947 +	 * thread save state, i.e., what will be restored in pfm_load_regs()
  27.948 +	 */
  27.949 +	mask = ctx->ctx_used_monitors[0] >> PMU_FIRST_COUNTER;
  27.950 +	for(i= PMU_FIRST_COUNTER; mask; i++, mask>>=1) {
  27.951 +		if ((mask & 0x1) == 0UL) continue;
  27.952 +		ia64_set_pmc(i, th->pmcs[i] & ~0xfUL);
  27.953 +		th->pmcs[i] &= ~0xfUL;
  27.954 +		DPRINT_ovfl(("pmc[%d]=0x%lx\n", i, th->pmcs[i]));
  27.955 +	}
  27.956 +	/*
  27.957 +	 * make all of this visible
  27.958 +	 */
  27.959 +	ia64_srlz_d();
  27.960 +}
  27.961 +
  27.962 +/*
  27.963 + * must always be done with task == current
  27.964 + *
  27.965 + * context must be in MASKED state when calling
  27.966 + */
  27.967 +static void
  27.968 +pfm_restore_monitoring(struct task_struct *task)
  27.969 +{
  27.970 +	pfm_context_t *ctx = PFM_GET_CTX(task);
  27.971 +	struct thread_struct *th = &task->thread;
  27.972 +	unsigned long mask, ovfl_mask;
  27.973 +	unsigned long psr, val;
  27.974 +	int i, is_system;
  27.975 +
  27.976 +	is_system = ctx->ctx_fl_system;
  27.977 +	ovfl_mask = pmu_conf->ovfl_val;
  27.978 +
  27.979 +	if (task != current) {
  27.980 +		printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task->pid, current->pid);
  27.981 +		return;
  27.982 +	}
  27.983 +	if (ctx->ctx_state != PFM_CTX_MASKED) {
  27.984 +		printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__,
  27.985 +			task->pid, current->pid, ctx->ctx_state);
  27.986 +		return;
  27.987 +	}
  27.988 +	psr = pfm_get_psr();
  27.989 +	/*
  27.990 +	 * monitoring is masked via the PMC.
  27.991 +	 * As we restore their value, we do not want each counter to
  27.992 +	 * restart right away. We stop monitoring using the PSR,
  27.993 +	 * restore the PMC (and PMD) and then re-establish the psr
  27.994 +	 * as it was. Note that there can be no pending overflow at
  27.995 +	 * this point, because monitoring was MASKED.
  27.996 +	 *
  27.997 +	 * system-wide session are pinned and self-monitoring
  27.998 +	 */
  27.999 +	if (is_system && (PFM_CPUINFO_GET() & PFM_CPUINFO_DCR_PP)) {
 27.1000 +		/* disable dcr pp */
 27.1001 +		ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) & ~IA64_DCR_PP);
 27.1002 +		pfm_clear_psr_pp();
 27.1003 +	} else {
 27.1004 +		pfm_clear_psr_up();
 27.1005 +	}
 27.1006 +	/*
 27.1007 +	 * first, we restore the PMD
 27.1008 +	 */
 27.1009 +	mask = ctx->ctx_used_pmds[0];
 27.1010 +	for (i = 0; mask; i++, mask>>=1) {
 27.1011 +		/* skip non used pmds */
 27.1012 +		if ((mask & 0x1) == 0) continue;
 27.1013 +
 27.1014 +		if (PMD_IS_COUNTING(i)) {
 27.1015 +			/*
 27.1016 +			 * we split the 64bit value according to
 27.1017 +			 * counter width
 27.1018 +			 */
 27.1019 +			val = ctx->ctx_pmds[i].val & ovfl_mask;
 27.1020 +			ctx->ctx_pmds[i].val &= ~ovfl_mask;
 27.1021 +		} else {
 27.1022 +			val = ctx->ctx_pmds[i].val;
 27.1023 +		}
 27.1024 +		ia64_set_pmd(i, val);
 27.1025 +
 27.1026 +		DPRINT(("pmd[%d]=0x%lx hw_pmd=0x%lx\n",
 27.1027 +			i,
 27.1028 +			ctx->ctx_pmds[i].val,
 27.1029 +			val));
 27.1030 +	}
 27.1031 +	/*
 27.1032 +	 * restore the PMCs
 27.1033 +	 */
 27.1034 +	mask = ctx->ctx_used_monitors[0] >> PMU_FIRST_COUNTER;
 27.1035 +	for(i= PMU_FIRST_COUNTER; mask; i++, mask>>=1) {
 27.1036 +		if ((mask & 0x1) == 0UL) continue;
 27.1037 +		th->pmcs[i] = ctx->ctx_pmcs[i];
 27.1038 +		ia64_set_pmc(i, th->pmcs[i]);
 27.1039 +		DPRINT(("[%d] pmc[%d]=0x%lx\n", task->pid, i, th->pmcs[i]));
 27.1040 +	}
 27.1041 +	ia64_srlz_d();
 27.1042 +
 27.1043 +	/*
 27.1044 +	 * must restore DBR/IBR because could be modified while masked
 27.1045 +	 * XXX: need to optimize 
 27.1046 +	 */
 27.1047 +	if (ctx->ctx_fl_using_dbreg) {
 27.1048 +		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
 27.1049 +		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
 27.1050 +	}
 27.1051 +
 27.1052 +	/*
 27.1053 +	 * now restore PSR
 27.1054 +	 */
 27.1055 +	if (is_system && (PFM_CPUINFO_GET() & PFM_CPUINFO_DCR_PP)) {
 27.1056 +		/* enable dcr pp */
 27.1057 +		ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) | IA64_DCR_PP);
 27.1058 +		ia64_srlz_i();
 27.1059 +	}
 27.1060 +	pfm_set_psr_l(psr);
 27.1061 +}
 27.1062 +
 27.1063 +static inline void
 27.1064 +pfm_save_pmds(unsigned long *pmds, unsigned long mask)
 27.1065 +{
 27.1066 +	int i;
 27.1067 +
 27.1068 +	ia64_srlz_d();
 27.1069 +
 27.1070 +	for (i=0; mask; i++, mask>>=1) {
 27.1071 +		if (mask & 0x1) pmds[i] = ia64_get_pmd(i);
 27.1072 +	}
 27.1073 +}
 27.1074 +
 27.1075 +/*
 27.1076 + * reload from thread state (used for ctxw only)
 27.1077 + */
 27.1078 +static inline void
 27.1079 +pfm_restore_pmds(unsigned long *pmds, unsigned long mask)
 27.1080 +{
 27.1081 +	int i;
 27.1082 +	unsigned long val, ovfl_val = pmu_conf->ovfl_val;
 27.1083 +
 27.1084 +	for (i=0; mask; i++, mask>>=1) {
 27.1085 +		if ((mask & 0x1) == 0) continue;
 27.1086 +		val = PMD_IS_COUNTING(i) ? pmds[i] & ovfl_val : pmds[i];
 27.1087 +		ia64_set_pmd(i, val);
 27.1088 +	}
 27.1089 +	ia64_srlz_d();
 27.1090 +}
 27.1091 +
 27.1092 +/*
 27.1093 + * propagate PMD from context to thread-state
 27.1094 + */
 27.1095 +static inline void
 27.1096 +pfm_copy_pmds(struct task_struct *task, pfm_context_t *ctx)
 27.1097 +{
 27.1098 +	struct thread_struct *thread = &task->thread;
 27.1099 +	unsigned long ovfl_val = pmu_conf->ovfl_val;
 27.1100 +	unsigned long mask = ctx->ctx_all_pmds[0];
 27.1101 +	unsigned long val;
 27.1102 +	int i;
 27.1103 +
 27.1104 +	DPRINT(("mask=0x%lx\n", mask));
 27.1105 +
 27.1106 +	for (i=0; mask; i++, mask>>=1) {
 27.1107 +
 27.1108 +		val = ctx->ctx_pmds[i].val;
 27.1109 +
 27.1110 +		/*
 27.1111 +		 * We break up the 64 bit value into 2 pieces
 27.1112 +		 * the lower bits go to the machine state in the
 27.1113 +		 * thread (will be reloaded on ctxsw in).
 27.1114 +		 * The upper part stays in the soft-counter.
 27.1115 +		 */
 27.1116 +		if (PMD_IS_COUNTING(i)) {
 27.1117 +			ctx->ctx_pmds[i].val = val & ~ovfl_val;
 27.1118 +			 val &= ovfl_val;
 27.1119 +		}
 27.1120 +		thread->pmds[i] = val;
 27.1121 +
 27.1122 +		DPRINT(("pmd[%d]=0x%lx soft_val=0x%lx\n",
 27.1123 +			i,
 27.1124 +			thread->pmds[i],
 27.1125 +			ctx->ctx_pmds[i].val));
 27.1126 +	}
 27.1127 +}
 27.1128 +
 27.1129 +/*
 27.1130 + * propagate PMC from context to thread-state
 27.1131 + */
 27.1132 +static inline void
 27.1133 +pfm_copy_pmcs(struct task_struct *task, pfm_context_t *ctx)
 27.1134 +{
 27.1135 +	struct thread_struct *thread = &task->thread;
 27.1136 +	unsigned long mask = ctx->ctx_all_pmcs[0];
 27.1137 +	int i;
 27.1138 +
 27.1139 +	DPRINT(("mask=0x%lx\n", mask));
 27.1140 +
 27.1141 +	for (i=0; mask; i++, mask>>=1) {
 27.1142 +		/* masking 0 with ovfl_val yields 0 */
 27.1143 +		thread->pmcs[i] = ctx->ctx_pmcs[i];
 27.1144 +		DPRINT(("pmc[%d]=0x%lx\n", i, thread->pmcs[i]));
 27.1145 +	}
 27.1146 +}
 27.1147 +
 27.1148 +
 27.1149 +
 27.1150 +static inline void
 27.1151 +pfm_restore_pmcs(unsigned long *pmcs, unsigned long mask)
 27.1152 +{
 27.1153 +	int i;
 27.1154 +
 27.1155 +	for (i=0; mask; i++, mask>>=1) {
 27.1156 +		if ((mask & 0x1) == 0) continue;
 27.1157 +		ia64_set_pmc(i, pmcs[i]);
 27.1158 +	}
 27.1159 +	ia64_srlz_d();
 27.1160 +}
 27.1161 +
 27.1162 +static inline int
 27.1163 +pfm_uuid_cmp(pfm_uuid_t a, pfm_uuid_t b)
 27.1164 +{
 27.1165 +	return memcmp(a, b, sizeof(pfm_uuid_t));
 27.1166 +}
 27.1167 +
 27.1168 +static inline int
 27.1169 +pfm_buf_fmt_exit(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, struct pt_regs *regs)
 27.1170 +{
 27.1171 +	int ret = 0;
 27.1172 +	if (fmt->fmt_exit) ret = (*fmt->fmt_exit)(task, buf, regs);
 27.1173 +	return ret;
 27.1174 +}
 27.1175 +
 27.1176 +static inline int
 27.1177 +pfm_buf_fmt_getsize(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size)
 27.1178 +{
 27.1179 +	int ret = 0;
 27.1180 +	if (fmt->fmt_getsize) ret = (*fmt->fmt_getsize)(task, flags, cpu, arg, size);
 27.1181 +	return ret;
 27.1182 +}
 27.1183 +
 27.1184 +
 27.1185 +static inline int
 27.1186 +pfm_buf_fmt_validate(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags,
 27.1187 +		     int cpu, void *arg)
 27.1188 +{
 27.1189 +	int ret = 0;
 27.1190 +	if (fmt->fmt_validate) ret = (*fmt->fmt_validate)(task, flags, cpu, arg);
 27.1191 +	return ret;
 27.1192 +}
 27.1193 +
 27.1194 +static inline int
 27.1195 +pfm_buf_fmt_init(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, unsigned int flags,
 27.1196 +		     int cpu, void *arg)
 27.1197 +{
 27.1198 +	int ret = 0;
 27.1199 +	if (fmt->fmt_init) ret = (*fmt->fmt_init)(task, buf, flags, cpu, arg);
 27.1200 +	return ret;
 27.1201 +}
 27.1202 +
 27.1203 +static inline int
 27.1204 +pfm_buf_fmt_restart(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
 27.1205 +{
 27.1206 +	int ret = 0;
 27.1207 +	if (fmt->fmt_restart) ret = (*fmt->fmt_restart)(task, ctrl, buf, regs);
 27.1208 +	return ret;
 27.1209 +}
 27.1210 +
 27.1211 +static inline int
 27.1212 +pfm_buf_fmt_restart_active(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
 27.1213 +{
 27.1214 +	int ret = 0;
 27.1215 +	if (fmt->fmt_restart_active) ret = (*fmt->fmt_restart_active)(task, ctrl, buf, regs);
 27.1216 +	return ret;
 27.1217 +}
 27.1218 +
 27.1219 +static pfm_buffer_fmt_t *
 27.1220 +__pfm_find_buffer_fmt(pfm_uuid_t uuid)
 27.1221 +{
 27.1222 +	struct list_head * pos;
 27.1223 +	pfm_buffer_fmt_t * entry;
 27.1224 +
 27.1225 +	list_for_each(pos, &pfm_buffer_fmt_list) {
 27.1226 +		entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list);
 27.1227 +		if (pfm_uuid_cmp(uuid, entry->fmt_uuid) == 0)
 27.1228 +			return entry;
 27.1229 +	}
 27.1230 +	return NULL;
 27.1231 +}
 27.1232 + 
 27.1233 +/*
 27.1234 + * find a buffer format based on its uuid
 27.1235 + */
 27.1236 +static pfm_buffer_fmt_t *
 27.1237 +pfm_find_buffer_fmt(pfm_uuid_t uuid)
 27.1238 +{
 27.1239 +	pfm_buffer_fmt_t * fmt;
 27.1240 +	spin_lock(&pfm_buffer_fmt_lock);
 27.1241 +	fmt = __pfm_find_buffer_fmt(uuid);
 27.1242 +	spin_unlock(&pfm_buffer_fmt_lock);
 27.1243 +	return fmt;
 27.1244 +}
 27.1245 + 
 27.1246 +int
 27.1247 +pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt)
 27.1248 +{
 27.1249 +	int ret = 0;
 27.1250 +
 27.1251 +	/* some sanity checks */
 27.1252 +	if (fmt == NULL || fmt->fmt_name == NULL) return -EINVAL;
 27.1253 +
 27.1254 +	/* we need at least a handler */
 27.1255 +	if (fmt->fmt_handler == NULL) return -EINVAL;
 27.1256 +
 27.1257 +	/*
 27.1258 +	 * XXX: need check validity of fmt_arg_size
 27.1259 +	 */
 27.1260 +
 27.1261 +	spin_lock(&pfm_buffer_fmt_lock);
 27.1262 +
 27.1263 +	if (__pfm_find_buffer_fmt(fmt->fmt_uuid)) {
 27.1264 +		printk(KERN_ERR "perfmon: duplicate sampling format: %s\n", fmt->fmt_name);
 27.1265 +		ret = -EBUSY;
 27.1266 +		goto out;
 27.1267 +	} 
 27.1268 +	list_add(&fmt->fmt_list, &pfm_buffer_fmt_list);
 27.1269 +	printk(KERN_INFO "perfmon: added sampling format %s\n", fmt->fmt_name);
 27.1270 +
 27.1271 +out:
 27.1272 +	spin_unlock(&pfm_buffer_fmt_lock);
 27.1273 + 	return ret;
 27.1274 +}
 27.1275 +EXPORT_SYMBOL(pfm_register_buffer_fmt);
 27.1276 +
 27.1277 +int
 27.1278 +pfm_unregister_buffer_fmt(pfm_uuid_t uuid)
 27.1279 +{
 27.1280 +	pfm_buffer_fmt_t *fmt;
 27.1281 +	int ret = 0;
 27.1282 +
 27.1283 +	spin_lock(&pfm_buffer_fmt_lock);
 27.1284 +
 27.1285 +	fmt = __pfm_find_buffer_fmt(uuid);
 27.1286 +	if (!fmt) {
 27.1287 +		printk(KERN_ERR "perfmon: cannot unregister format, not found\n");
 27.1288 +		ret = -EINVAL;
 27.1289 +		goto out;
 27.1290 +	}
 27.1291 +	list_del_init(&fmt->fmt_list);
 27.1292 +	printk(KERN_INFO "perfmon: removed sampling format: %s\n", fmt->fmt_name);
 27.1293 +
 27.1294 +out:
 27.1295 +	spin_unlock(&pfm_buffer_fmt_lock);
 27.1296 +	return ret;
 27.1297 +
 27.1298 +}
 27.1299 +EXPORT_SYMBOL(pfm_unregister_buffer_fmt);
 27.1300 +
 27.1301 +extern void update_pal_halt_status(int);
 27.1302 +
 27.1303 +static int
 27.1304 +pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
 27.1305 +{
 27.1306 +	unsigned long flags;
 27.1307 +	/*
 27.1308 +	 * validy checks on cpu_mask have been done upstream
 27.1309 +	 */
 27.1310 +	LOCK_PFS(flags);
 27.1311 +
 27.1312 +	DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
 27.1313 +		pfm_sessions.pfs_sys_sessions,
 27.1314 +		pfm_sessions.pfs_task_sessions,
 27.1315 +		pfm_sessions.pfs_sys_use_dbregs,
 27.1316 +		is_syswide,
 27.1317 +		cpu));
 27.1318 +
 27.1319 +	if (is_syswide) {
 27.1320 +		/*
 27.1321 +		 * cannot mix system wide and per-task sessions
 27.1322 +		 */
 27.1323 +		if (pfm_sessions.pfs_task_sessions > 0UL) {
 27.1324 +			DPRINT(("system wide not possible, %u conflicting task_sessions\n",
 27.1325 +			  	pfm_sessions.pfs_task_sessions));
 27.1326 +			goto abort;
 27.1327 +		}
 27.1328 +
 27.1329 +		if (pfm_sessions.pfs_sys_session[cpu]) goto error_conflict;
 27.1330 +
 27.1331 +		DPRINT(("reserving system wide session on CPU%u currently on CPU%u\n", cpu, smp_processor_id()));
 27.1332 +
 27.1333 +		pfm_sessions.pfs_sys_session[cpu] = task;
 27.1334 +
 27.1335 +		pfm_sessions.pfs_sys_sessions++ ;
 27.1336 +
 27.1337 +	} else {
 27.1338 +		if (pfm_sessions.pfs_sys_sessions) goto abort;
 27.1339 +		pfm_sessions.pfs_task_sessions++;
 27.1340 +	}
 27.1341 +
 27.1342 +	DPRINT(("out sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
 27.1343 +		pfm_sessions.pfs_sys_sessions,
 27.1344 +		pfm_sessions.pfs_task_sessions,
 27.1345 +		pfm_sessions.pfs_sys_use_dbregs,
 27.1346 +		is_syswide,
 27.1347 +		cpu));
 27.1348 +
 27.1349 +	/*
 27.1350 +	 * disable default_idle() to go to PAL_HALT
 27.1351 +	 */
 27.1352 +	update_pal_halt_status(0);
 27.1353 +
 27.1354 +	UNLOCK_PFS(flags);
 27.1355 +
 27.1356 +	return 0;
 27.1357 +
 27.1358 +error_conflict:
 27.1359 +	DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n",
 27.1360 +  		pfm_sessions.pfs_sys_session[cpu]->pid,
 27.1361 +		cpu));
 27.1362 +abort:
 27.1363 +	UNLOCK_PFS(flags);
 27.1364 +
 27.1365 +	return -EBUSY;
 27.1366 +
 27.1367 +}
 27.1368 +
 27.1369 +static int
 27.1370 +pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
 27.1371 +{
 27.1372 +	unsigned long flags;
 27.1373 +	/*
 27.1374 +	 * validy checks on cpu_mask have been done upstream
 27.1375 +	 */
 27.1376 +	LOCK_PFS(flags);
 27.1377 +
 27.1378 +	DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
 27.1379 +		pfm_sessions.pfs_sys_sessions,
 27.1380 +		pfm_sessions.pfs_task_sessions,
 27.1381 +		pfm_sessions.pfs_sys_use_dbregs,
 27.1382 +		is_syswide,
 27.1383 +		cpu));
 27.1384 +
 27.1385 +
 27.1386 +	if (is_syswide) {
 27.1387 +		pfm_sessions.pfs_sys_session[cpu] = NULL;
 27.1388 +		/*
 27.1389 +		 * would not work with perfmon+more than one bit in cpu_mask
 27.1390 +		 */
 27.1391 +		if (ctx && ctx->ctx_fl_using_dbreg) {
 27.1392 +			if (pfm_sessions.pfs_sys_use_dbregs == 0) {
 27.1393 +				printk(KERN_ERR "perfmon: invalid release for ctx %p sys_use_dbregs=0\n", ctx);
 27.1394 +			} else {
 27.1395 +				pfm_sessions.pfs_sys_use_dbregs--;
 27.1396 +			}
 27.1397 +		}
 27.1398 +		pfm_sessions.pfs_sys_sessions--;
 27.1399 +	} else {
 27.1400 +		pfm_sessions.pfs_task_sessions--;
 27.1401 +	}
 27.1402 +	DPRINT(("out sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
 27.1403 +		pfm_sessions.pfs_sys_sessions,
 27.1404 +		pfm_sessions.pfs_task_sessions,
 27.1405 +		pfm_sessions.pfs_sys_use_dbregs,
 27.1406 +		is_syswide,
 27.1407 +		cpu));
 27.1408 +
 27.1409 +	/*
 27.1410 +	 * if possible, enable default_idle() to go into PAL_HALT
 27.1411 +	 */
 27.1412 +	if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0)
 27.1413 +		update_pal_halt_status(1);
 27.1414 +
 27.1415 +	UNLOCK_PFS(flags);
 27.1416 +
 27.1417 +	return 0;
 27.1418 +}
 27.1419 +
 27.1420 +/*
 27.1421 + * removes virtual mapping of the sampling buffer.
 27.1422 + * IMPORTANT: cannot be called with interrupts disable, e.g. inside
 27.1423 + * a PROTECT_CTX() section.
 27.1424 + */
 27.1425 +static int
 27.1426 +pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size)
 27.1427 +{
 27.1428 +	int r;
 27.1429 +
 27.1430 +	/* sanity checks */
 27.1431 +	if (task->mm == NULL || size == 0UL || vaddr == NULL) {
 27.1432 +		printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task->pid, task->mm);
 27.1433 +		return -EINVAL;
 27.1434 +	}
 27.1435 +
 27.1436 +	DPRINT(("smpl_vaddr=%p size=%lu\n", vaddr, size));
 27.1437 +
 27.1438 +	/*
 27.1439 +	 * does the actual unmapping
 27.1440 +	 */
 27.1441 +	down_write(&task->mm->mmap_sem);
 27.1442 +
 27.1443 +	DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size));
 27.1444 +
 27.1445 +	r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0);
 27.1446 +
 27.1447 +	up_write(&task->mm->mmap_sem);
 27.1448 +	if (r !=0) {
 27.1449 +		printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task->pid, vaddr, size);
 27.1450 +	}
 27.1451 +
 27.1452 +	DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r));
 27.1453 +
 27.1454 +	return 0;
 27.1455 +}
 27.1456 +
 27.1457 +/*
 27.1458 + * free actual physical storage used by sampling buffer
 27.1459 + */
 27.1460 +#if 0
 27.1461 +static int
 27.1462 +pfm_free_smpl_buffer(pfm_context_t *ctx)
 27.1463 +{
 27.1464 +	pfm_buffer_fmt_t *fmt;
 27.1465 +
 27.1466 +	if (ctx->ctx_smpl_hdr == NULL) goto invalid_free;
 27.1467 +
 27.1468 +	/*
 27.1469 +	 * we won't use the buffer format anymore
 27.1470 +	 */
 27.1471 +	fmt = ctx->ctx_buf_fmt;
 27.1472 +
 27.1473 +	DPRINT(("sampling buffer @%p size %lu vaddr=%p\n",
 27.1474 +		ctx->ctx_smpl_hdr,
 27.1475 +		ctx->ctx_smpl_size,
 27.1476 +		ctx->ctx_smpl_vaddr));
 27.1477 +
 27.1478 +	pfm_buf_fmt_exit(fmt, current, NULL, NULL);
 27.1479 +
 27.1480 +	/*
 27.1481 +	 * free the buffer
 27.1482 +	 */
 27.1483 +	pfm_rvfree(ctx->ctx_smpl_hdr, ctx->ctx_smpl_size);
 27.1484 +
 27.1485 +	ctx->ctx_smpl_hdr  = NULL;
 27.1486 +	ctx->ctx_smpl_size = 0UL;
 27.1487 +
 27.1488 +	return 0;
 27.1489 +
 27.1490 +invalid_free:
 27.1491 +	printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", current->pid);
 27.1492 +	return -EINVAL;
 27.1493 +}
 27.1494 +#endif
 27.1495 +
 27.1496 +static inline void
 27.1497 +pfm_exit_smpl_buffer(pfm_buffer_fmt_t *fmt)
 27.1498 +{
 27.1499 +	if (fmt == NULL) return;
 27.1500 +
 27.1501 +	pfm_buf_fmt_exit(fmt, current, NULL, NULL);
 27.1502 +
 27.1503 +}
 27.1504 +
 27.1505 +/*
 27.1506 + * pfmfs should _never_ be mounted by userland - too much of security hassle,
 27.1507 + * no real gain from having the whole whorehouse mounted. So we don't need
 27.1508 + * any operations on the root directory. However, we need a non-trivial
 27.1509 + * d_name - pfm: will go nicely and kill the special-casing in procfs.
 27.1510 + */
 27.1511 +static struct vfsmount *pfmfs_mnt;
 27.1512 +
 27.1513 +static int __init
 27.1514 +init_pfm_fs(void)
 27.1515 +{
 27.1516 +	int err = register_filesystem(&pfm_fs_type);
 27.1517 +	if (!err) {
 27.1518 +		pfmfs_mnt = kern_mount(&pfm_fs_type);
 27.1519 +		err = PTR_ERR(pfmfs_mnt);
 27.1520 +		if (IS_ERR(pfmfs_mnt))
 27.1521 +			unregister_filesystem(&pfm_fs_type);
 27.1522 +		else
 27.1523 +			err = 0;
 27.1524 +	}
 27.1525 +	return err;
 27.1526 +}
 27.1527 +
 27.1528 +static void __exit
 27.1529 +exit_pfm_fs(void)
 27.1530 +{
 27.1531 +	unregister_filesystem(&pfm_fs_type);
 27.1532 +	mntput(pfmfs_mnt);
 27.1533 +}
 27.1534 +
 27.1535 +static ssize_t
 27.1536 +pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
 27.1537 +{
 27.1538 +	pfm_context_t *ctx;
 27.1539 +	pfm_msg_t *msg;
 27.1540 +	ssize_t ret;
 27.1541 +	unsigned long flags;
 27.1542 +  	DECLARE_WAITQUEUE(wait, current);
 27.1543 +	XEN_NOT_SUPPORTED_YET;
 27.1544 +	if (PFM_IS_FILE(filp) == 0) {
 27.1545 +		printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid);
 27.1546 +		return -EINVAL;
 27.1547 +	}
 27.1548 +
 27.1549 +	ctx = (pfm_context_t *)filp->private_data;
 27.1550 +	if (ctx == NULL) {
 27.1551 +		printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", current->pid);
 27.1552 +		return -EINVAL;
 27.1553 +	}
 27.1554 +
 27.1555 +	/*
 27.1556 +	 * check even when there is no message
 27.1557 +	 */
 27.1558 +	if (size < sizeof(pfm_msg_t)) {
 27.1559 +		DPRINT(("message is too small ctx=%p (>=%ld)\n", ctx, sizeof(pfm_msg_t)));
 27.1560 +		return -EINVAL;
 27.1561 +	}
 27.1562 +
 27.1563 +	PROTECT_CTX(ctx, flags);
 27.1564 +
 27.1565 +  	/*
 27.1566 +	 * put ourselves on the wait queue
 27.1567 +	 */
 27.1568 +  	add_wait_queue(&ctx->ctx_msgq_wait, &wait);
 27.1569 +
 27.1570 +
 27.1571 +  	for(;;) {
 27.1572 +		/*
 27.1573 +		 * check wait queue
 27.1574 +		 */
 27.1575 +
 27.1576 +  		set_current_state(TASK_INTERRUPTIBLE);
 27.1577 +
 27.1578 +		DPRINT(("head=%d tail=%d\n", ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
 27.1579 +
 27.1580 +		ret = 0;
 27.1581 +		if(PFM_CTXQ_EMPTY(ctx) == 0) break;
 27.1582 +
 27.1583 +		UNPROTECT_CTX(ctx, flags);
 27.1584 +
 27.1585 +		/*
 27.1586 +		 * check non-blocking read
 27.1587 +		 */
 27.1588 +      		ret = -EAGAIN;
 27.1589 +		if(filp->f_flags & O_NONBLOCK) break;
 27.1590 +
 27.1591 +		/*
 27.1592 +		 * check pending signals
 27.1593 +		 */
 27.1594 +		if(signal_pending(current)) {
 27.1595 +			ret = -EINTR;
 27.1596 +			break;
 27.1597 +		}
 27.1598 +      		/*
 27.1599 +		 * no message, so wait
 27.1600 +		 */
 27.1601 +      		schedule();
 27.1602 +
 27.1603 +		PROTECT_CTX(ctx, flags);
 27.1604 +	}
 27.1605 +	DPRINT(("[%d] back to running ret=%ld\n", current->pid, ret));
 27.1606 +  	set_current_state(TASK_RUNNING);
 27.1607 +	remove_wait_queue(&ctx->ctx_msgq_wait, &wait);
 27.1608 +
 27.1609 +	if (ret < 0) goto abort;
 27.1610 +
 27.1611 +	ret = -EINVAL;
 27.1612 +	msg = pfm_get_next_msg(ctx);
 27.1613 +	if (msg == NULL) {
 27.1614 +		printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, current->pid);
 27.1615 +		goto abort_locked;
 27.1616 +	}
 27.1617 +
 27.1618 +	DPRINT(("fd=%d type=%d\n", msg->pfm_gen_msg.msg_ctx_fd, msg->pfm_gen_msg.msg_type));
 27.1619 +
 27.1620 +	ret = -EFAULT;
 27.1621 +  	if(copy_to_user(buf, msg, sizeof(pfm_msg_t)) == 0) ret = sizeof(pfm_msg_t);
 27.1622 +
 27.1623 +abort_locked:
 27.1624 +	UNPROTECT_CTX(ctx, flags);
 27.1625 +abort:
 27.1626 +	return ret;
 27.1627 +}
 27.1628 +
 27.1629 +static ssize_t
 27.1630 +pfm_write(struct file *file, const char __user *ubuf,
 27.1631 +			  size_t size, loff_t *ppos)
 27.1632 +{
 27.1633 +	DPRINT(("pfm_write called\n"));
 27.1634 +	return -EINVAL;
 27.1635 +}
 27.1636 +
 27.1637 +static unsigned int
 27.1638 +pfm_poll(struct file *filp, poll_table * wait)
 27.1639 +{
 27.1640 +	pfm_context_t *ctx;
 27.1641 +	unsigned long flags;
 27.1642 +	unsigned int mask = 0;
 27.1643 +
 27.1644 +	if (PFM_IS_FILE(filp) == 0) {
 27.1645 +		printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid);
 27.1646 +		return 0;
 27.1647 +	}
 27.1648 +
 27.1649 +	ctx = (pfm_context_t *)filp->private_data;
 27.1650 +	if (ctx == NULL) {
 27.1651 +		printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", current->pid);
 27.1652 +		return 0;
 27.1653 +	}
 27.1654 +
 27.1655 +
 27.1656 +	DPRINT(("pfm_poll ctx_fd=%d before poll_wait\n", ctx->ctx_fd));
 27.1657 +
 27.1658 +	poll_wait(filp, &ctx->ctx_msgq_wait, wait);
 27.1659 +
 27.1660 +	PROTECT_CTX(ctx, flags);
 27.1661 +
 27.1662 +	if (PFM_CTXQ_EMPTY(ctx) == 0)
 27.1663 +		mask =  POLLIN | POLLRDNORM;
 27.1664 +
 27.1665 +	UNPROTECT_CTX(ctx, flags);
 27.1666 +
 27.1667 +	DPRINT(("pfm_poll ctx_fd=%d mask=0x%x\n", ctx->ctx_fd, mask));
 27.1668 +
 27.1669 +	return mask;
 27.1670 +}
 27.1671 +
 27.1672 +static int
 27.1673 +pfm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 27.1674 +{
 27.1675 +	DPRINT(("pfm_ioctl called\n"));
 27.1676 +	return -EINVAL;
 27.1677 +}
 27.1678 +
 27.1679 +/*
 27.1680 + * interrupt cannot be masked when coming here
 27.1681 + */
 27.1682 +static inline int
 27.1683 +pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on)
 27.1684 +{
 27.1685 +	int ret;
 27.1686 +
 27.1687 +	ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
 27.1688 +
 27.1689 +	DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
 27.1690 +		current->pid,
 27.1691 +		fd,
 27.1692 +		on,
 27.1693 +		ctx->ctx_async_queue, ret));
 27.1694 +
 27.1695 +	return ret;
 27.1696 +}
 27.1697 +
 27.1698 +static int
 27.1699 +pfm_fasync(int fd, struct file *filp, int on)
 27.1700 +{
 27.1701 +	pfm_context_t *ctx;
 27.1702 +	int ret;
 27.1703 +
 27.1704 +	if (PFM_IS_FILE(filp) == 0) {
 27.1705 +		printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", current->pid);
 27.1706 +		return -EBADF;
 27.1707 +	}
 27.1708 +
 27.1709 +	ctx = (pfm_context_t *)filp->private_data;
 27.1710 +	if (ctx == NULL) {
 27.1711 +		printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", current->pid);
 27.1712 +		return -EBADF;
 27.1713 +	}
 27.1714 +	/*
 27.1715 +	 * we cannot mask interrupts during this call because this may
 27.1716 +	 * may go to sleep if memory is not readily avalaible.
 27.1717 +	 *
 27.1718 +	 * We are protected from the conetxt disappearing by the get_fd()/put_fd()
 27.1719 +	 * done in caller. Serialization of this function is ensured by caller.
 27.1720 +	 */
 27.1721 +	ret = pfm_do_fasync(fd, filp, ctx, on);
 27.1722 +
 27.1723 +
 27.1724 +	DPRINT(("pfm_fasync called on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
 27.1725 +		fd,
 27.1726 +		on,
 27.1727 +		ctx->ctx_async_queue, ret));
 27.1728 +
 27.1729 +	return ret;
 27.1730 +}
 27.1731 +
 27.1732 +#ifdef CONFIG_SMP
 27.1733 +/*
 27.1734 + * this function is exclusively called from pfm_close().
 27.1735 + * The context is not protected at that time, nor are interrupts
 27.1736 + * on the remote CPU. That's necessary to avoid deadlocks.
 27.1737 + */
 27.1738 +static void
 27.1739 +pfm_syswide_force_stop(void *info)
 27.1740 +{
 27.1741 +	pfm_context_t   *ctx = (pfm_context_t *)info;
 27.1742 +	struct pt_regs *regs = task_pt_regs(current);
 27.1743 +	struct task_struct *owner;
 27.1744 +	unsigned long flags;
 27.1745 +	int ret;
 27.1746 +
 27.1747 +	if (ctx->ctx_cpu != smp_processor_id()) {
 27.1748 +		printk(KERN_ERR "perfmon: pfm_syswide_force_stop for CPU%d  but on CPU%d\n",
 27.1749 +			ctx->ctx_cpu,
 27.1750 +			smp_processor_id());
 27.1751 +		return;
 27.1752 +	}
 27.1753 +	owner = GET_PMU_OWNER();
 27.1754 +	if (owner != ctx->ctx_task) {
 27.1755 +		printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n",
 27.1756 +			smp_processor_id(),
 27.1757 +			owner->pid, ctx->ctx_task->pid);
 27.1758 +		return;
 27.1759 +	}
 27.1760 +	if (GET_PMU_CTX() != ctx) {
 27.1761 +		printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected ctx %p instead of %p\n",
 27.1762 +			smp_processor_id(),
 27.1763 +			GET_PMU_CTX(), ctx);
 27.1764 +		return;
 27.1765 +	}
 27.1766 +
 27.1767 +	DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), ctx->ctx_task->pid));	
 27.1768 +	/*
 27.1769 +	 * the context is already protected in pfm_close(), we simply
 27.1770 +	 * need to mask interrupts to avoid a PMU interrupt race on
 27.1771 +	 * this CPU
 27.1772 +	 */
 27.1773 +	local_irq_save(flags);
 27.1774 +
 27.1775 +	ret = pfm_context_unload(ctx, NULL, 0, regs);
 27.1776 +	if (ret) {
 27.1777 +		DPRINT(("context_unload returned %d\n", ret));
 27.1778 +	}
 27.1779 +
 27.1780 +	/*
 27.1781 +	 * unmask interrupts, PMU interrupts are now spurious here
 27.1782 +	 */
 27.1783 +	local_irq_restore(flags);
 27.1784 +}
 27.1785 +
 27.1786 +static void
 27.1787 +pfm_syswide_cleanup_other_cpu(pfm_context_t *ctx)
 27.1788 +{
 27.1789 +	int ret;
 27.1790 +
 27.1791 +	DPRINT(("calling CPU%d for cleanup\n", ctx->ctx_cpu));
 27.1792 +	ret = smp_call_function_single(ctx->ctx_cpu, pfm_syswide_force_stop, ctx, 0, 1);
 27.1793 +	DPRINT(("called CPU%d for cleanup ret=%d\n", ctx->ctx_cpu, ret));
 27.1794 +}
 27.1795 +#endif /* CONFIG_SMP */
 27.1796 +
 27.1797 +/*
 27.1798 + * called for each close(). Partially free resources.
 27.1799 + * When caller is self-monitoring, the context is unloaded.
 27.1800 + */
 27.1801 +static int
 27.1802 +pfm_flush(struct file *filp)
 27.1803 +{
 27.1804 +	pfm_context_t *ctx;
 27.1805 +	struct task_struct *task;
 27.1806 +	struct pt_regs *regs;
 27.1807 +	unsigned long flags;
 27.1808 +	unsigned long smpl_buf_size = 0UL;
 27.1809 +	void *smpl_buf_vaddr = NULL;
 27.1810 +	int state, is_system;
 27.1811 +
 27.1812 +	if (PFM_IS_FILE(filp) == 0) {
 27.1813 +		DPRINT(("bad magic for\n"));
 27.1814 +		return -EBADF;
 27.1815 +	}
 27.1816 +
 27.1817 +	ctx = (pfm_context_t *)filp->private_data;
 27.1818 +	if (ctx == NULL) {
 27.1819 +		printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", current->pid);
 27.1820 +		return -EBADF;
 27.1821 +	}
 27.1822 +
 27.1823 +	/*
 27.1824 +	 * remove our file from the async queue, if we use this mode.
 27.1825 +	 * This can be done without the context being protected. We come
 27.1826 +	 * here when the context has become unreacheable by other tasks.
 27.1827 +	 *
 27.1828 +	 * We may still have active monitoring at this point and we may
 27.1829 +	 * end up in pfm_overflow_handler(). However, fasync_helper()
 27.1830 +	 * operates with interrupts disabled and it cleans up the
 27.1831 +	 * queue. If the PMU handler is called prior to entering
 27.1832 +	 * fasync_helper() then it will send a signal. If it is
 27.1833 +	 * invoked after, it will find an empty queue and no
 27.1834 +	 * signal will be sent. In both case, we are safe
 27.1835 +	 */
 27.1836 +	if (filp->f_flags & FASYNC) {
 27.1837 +		DPRINT(("cleaning up async_queue=%p\n", ctx->ctx_async_queue));
 27.1838 +		pfm_do_fasync (-1, filp, ctx, 0);
 27.1839 +	}
 27.1840 +
 27.1841 +	PROTECT_CTX(ctx, flags);
 27.1842 +
 27.1843 +	state     = ctx->ctx_state;
 27.1844 +	is_system = ctx->ctx_fl_system;
 27.1845 +
 27.1846 +	task = PFM_CTX_TASK(ctx);
 27.1847 +	regs = task_pt_regs(task);
 27.1848 +
 27.1849 +	DPRINT(("ctx_state=%d is_current=%d\n",
 27.1850 +		state,
 27.1851 +		task == current ? 1 : 0));
 27.1852 +
 27.1853 +	/*
 27.1854 +	 * if state == UNLOADED, then task is NULL
 27.1855 +	 */
 27.1856 +
 27.1857 +	/*
 27.1858 +	 * we must stop and unload because we are losing access to the context.
 27.1859 +	 */
 27.1860 +	if (task == current) {
 27.1861 +#ifdef CONFIG_SMP
 27.1862 +		/*
 27.1863 +		 * the task IS the owner but it migrated to another CPU: that's bad
 27.1864 +		 * but we must handle this cleanly. Unfortunately, the kernel does
 27.1865 +		 * not provide a mechanism to block migration (while the context is loaded).
 27.1866 +		 *
 27.1867 +		 * We need to release the resource on the ORIGINAL cpu.
 27.1868 +		 */
 27.1869 +		if (is_system && ctx->ctx_cpu != smp_processor_id()) {
 27.1870 +
 27.1871 +			DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.1872 +			/*
 27.1873 +			 * keep context protected but unmask interrupt for IPI
 27.1874 +			 */
 27.1875 +			local_irq_restore(flags);
 27.1876 +
 27.1877 +			pfm_syswide_cleanup_other_cpu(ctx);
 27.1878 +
 27.1879 +			/*
 27.1880 +			 * restore interrupt masking
 27.1881 +			 */
 27.1882 +			local_irq_save(flags);
 27.1883 +
 27.1884 +			/*
 27.1885 +			 * context is unloaded at this point
 27.1886 +			 */
 27.1887 +		} else
 27.1888 +#endif /* CONFIG_SMP */
 27.1889 +		{
 27.1890 +
 27.1891 +			DPRINT(("forcing unload\n"));
 27.1892 +			/*
 27.1893 +		 	* stop and unload, returning with state UNLOADED
 27.1894 +		 	* and session unreserved.
 27.1895 +		 	*/
 27.1896 +			pfm_context_unload(ctx, NULL, 0, regs);
 27.1897 +
 27.1898 +			DPRINT(("ctx_state=%d\n", ctx->ctx_state));
 27.1899 +		}
 27.1900 +	}
 27.1901 +
 27.1902 +	/*
 27.1903 +	 * remove virtual mapping, if any, for the calling task.
 27.1904 +	 * cannot reset ctx field until last user is calling close().
 27.1905 +	 *
 27.1906 +	 * ctx_smpl_vaddr must never be cleared because it is needed
 27.1907 +	 * by every task with access to the context
 27.1908 +	 *
 27.1909 +	 * When called from do_exit(), the mm context is gone already, therefore
 27.1910 +	 * mm is NULL, i.e., the VMA is already gone  and we do not have to
 27.1911 +	 * do anything here
 27.1912 +	 */
 27.1913 +	if (ctx->ctx_smpl_vaddr && current->mm) {
 27.1914 +		smpl_buf_vaddr = ctx->ctx_smpl_vaddr;
 27.1915 +		smpl_buf_size  = ctx->ctx_smpl_size;
 27.1916 +	}
 27.1917 +
 27.1918 +	UNPROTECT_CTX(ctx, flags);
 27.1919 +
 27.1920 +	/*
 27.1921 +	 * if there was a mapping, then we systematically remove it
 27.1922 +	 * at this point. Cannot be done inside critical section
 27.1923 +	 * because some VM function reenables interrupts.
 27.1924 +	 *
 27.1925 +	 */
 27.1926 +	if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size);
 27.1927 +
 27.1928 +	return 0;
 27.1929 +}
 27.1930 +/*
 27.1931 + * called either on explicit close() or from exit_files(). 
 27.1932 + * Only the LAST user of the file gets to this point, i.e., it is
 27.1933 + * called only ONCE.
 27.1934 + *
 27.1935 + * IMPORTANT: we get called ONLY when the refcnt on the file gets to zero 
 27.1936 + * (fput()),i.e, last task to access the file. Nobody else can access the 
 27.1937 + * file at this point.
 27.1938 + *
 27.1939 + * When called from exit_files(), the VMA has been freed because exit_mm()
 27.1940 + * is executed before exit_files().
 27.1941 + *
 27.1942 + * When called from exit_files(), the current task is not yet ZOMBIE but we
 27.1943 + * flush the PMU state to the context. 
 27.1944 + */
 27.1945 +static int
 27.1946 +pfm_close(struct inode *inode, struct file *filp)
 27.1947 +{
 27.1948 +	pfm_context_t *ctx;
 27.1949 +	struct task_struct *task;
 27.1950 +	struct pt_regs *regs;
 27.1951 +  	DECLARE_WAITQUEUE(wait, current);
 27.1952 +	unsigned long flags;
 27.1953 +	unsigned long smpl_buf_size = 0UL;
 27.1954 +	void *smpl_buf_addr = NULL;
 27.1955 +	int free_possible = 1;
 27.1956 +	int state, is_system;
 27.1957 +
 27.1958 +	DPRINT(("pfm_close called private=%p\n", filp->private_data));
 27.1959 +
 27.1960 +	if (PFM_IS_FILE(filp) == 0) {
 27.1961 +		DPRINT(("bad magic\n"));
 27.1962 +		return -EBADF;
 27.1963 +	}
 27.1964 +	
 27.1965 +	ctx = (pfm_context_t *)filp->private_data;
 27.1966 +	if (ctx == NULL) {
 27.1967 +		printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", current->pid);
 27.1968 +		return -EBADF;
 27.1969 +	}
 27.1970 +
 27.1971 +	PROTECT_CTX(ctx, flags);
 27.1972 +
 27.1973 +	state     = ctx->ctx_state;
 27.1974 +	is_system = ctx->ctx_fl_system;
 27.1975 +
 27.1976 +	task = PFM_CTX_TASK(ctx);
 27.1977 +	regs = task_pt_regs(task);
 27.1978 +
 27.1979 +	DPRINT(("ctx_state=%d is_current=%d\n", 
 27.1980 +		state,
 27.1981 +		task == current ? 1 : 0));
 27.1982 +
 27.1983 +	/*
 27.1984 +	 * if task == current, then pfm_flush() unloaded the context
 27.1985 +	 */
 27.1986 +	if (state == PFM_CTX_UNLOADED) goto doit;
 27.1987 +
 27.1988 +	/*
 27.1989 +	 * context is loaded/masked and task != current, we need to
 27.1990 +	 * either force an unload or go zombie
 27.1991 +	 */
 27.1992 +
 27.1993 +	/*
 27.1994 +	 * The task is currently blocked or will block after an overflow.
 27.1995 +	 * we must force it to wakeup to get out of the
 27.1996 +	 * MASKED state and transition to the unloaded state by itself.
 27.1997 +	 *
 27.1998 +	 * This situation is only possible for per-task mode
 27.1999 +	 */
 27.2000 +	if (state == PFM_CTX_MASKED && CTX_OVFL_NOBLOCK(ctx) == 0) {
 27.2001 +
 27.2002 +		/*
 27.2003 +		 * set a "partial" zombie state to be checked
 27.2004 +		 * upon return from down() in pfm_handle_work().
 27.2005 +		 *
 27.2006 +		 * We cannot use the ZOMBIE state, because it is checked
 27.2007 +		 * by pfm_load_regs() which is called upon wakeup from down().
 27.2008 +		 * In such case, it would free the context and then we would
 27.2009 +		 * return to pfm_handle_work() which would access the
 27.2010 +		 * stale context. Instead, we set a flag invisible to pfm_load_regs()
 27.2011 +		 * but visible to pfm_handle_work().
 27.2012 +		 *
 27.2013 +		 * For some window of time, we have a zombie context with
 27.2014 +		 * ctx_state = MASKED  and not ZOMBIE
 27.2015 +		 */
 27.2016 +		ctx->ctx_fl_going_zombie = 1;
 27.2017 +
 27.2018 +		/*
 27.2019 +		 * force task to wake up from MASKED state
 27.2020 +		 */
 27.2021 +		complete(&ctx->ctx_restart_done);
 27.2022 +
 27.2023 +		DPRINT(("waking up ctx_state=%d\n", state));
 27.2024 +
 27.2025 +		/*
 27.2026 +		 * put ourself to sleep waiting for the other
 27.2027 +		 * task to report completion
 27.2028 +		 *
 27.2029 +		 * the context is protected by mutex, therefore there
 27.2030 +		 * is no risk of being notified of completion before
 27.2031 +		 * begin actually on the waitq.
 27.2032 +		 */
 27.2033 +  		set_current_state(TASK_INTERRUPTIBLE);
 27.2034 +  		add_wait_queue(&ctx->ctx_zombieq, &wait);
 27.2035 +
 27.2036 +		UNPROTECT_CTX(ctx, flags);
 27.2037 +
 27.2038 +		/*
 27.2039 +		 * XXX: check for signals :
 27.2040 +		 * 	- ok for explicit close
 27.2041 +		 * 	- not ok when coming from exit_files()
 27.2042 +		 */
 27.2043 +      		schedule();
 27.2044 +
 27.2045 +
 27.2046 +		PROTECT_CTX(ctx, flags);
 27.2047 +
 27.2048 +
 27.2049 +		remove_wait_queue(&ctx->ctx_zombieq, &wait);
 27.2050 +  		set_current_state(TASK_RUNNING);
 27.2051 +
 27.2052 +		/*
 27.2053 +		 * context is unloaded at this point
 27.2054 +		 */
 27.2055 +		DPRINT(("after zombie wakeup ctx_state=%d for\n", state));
 27.2056 +	}
 27.2057 +	else if (task != current) {
 27.2058 +#ifdef CONFIG_SMP
 27.2059 +		/*
 27.2060 +	 	 * switch context to zombie state
 27.2061 +	 	 */
 27.2062 +		ctx->ctx_state = PFM_CTX_ZOMBIE;
 27.2063 +
 27.2064 +		DPRINT(("zombie ctx for [%d]\n", task->pid));
 27.2065 +		/*
 27.2066 +		 * cannot free the context on the spot. deferred until
 27.2067 +		 * the task notices the ZOMBIE state
 27.2068 +		 */
 27.2069 +		free_possible = 0;
 27.2070 +#else
 27.2071 +		pfm_context_unload(ctx, NULL, 0, regs);
 27.2072 +#endif
 27.2073 +	}
 27.2074 +
 27.2075 +doit:
 27.2076 +	/* reload state, may have changed during  opening of critical section */
 27.2077 +	state = ctx->ctx_state;
 27.2078 +
 27.2079 +	/*
 27.2080 +	 * the context is still attached to a task (possibly current)
 27.2081 +	 * we cannot destroy it right now
 27.2082 +	 */
 27.2083 +
 27.2084 +	/*
 27.2085 +	 * we must free the sampling buffer right here because
 27.2086 +	 * we cannot rely on it being cleaned up later by the
 27.2087 +	 * monitored task. It is not possible to free vmalloc'ed
 27.2088 +	 * memory in pfm_load_regs(). Instead, we remove the buffer
 27.2089 +	 * now. should there be subsequent PMU overflow originally
 27.2090 +	 * meant for sampling, the will be converted to spurious
 27.2091 +	 * and that's fine because the monitoring tools is gone anyway.
 27.2092 +	 */
 27.2093 +	if (ctx->ctx_smpl_hdr) {
 27.2094 +		smpl_buf_addr = ctx->ctx_smpl_hdr;
 27.2095 +		smpl_buf_size = ctx->ctx_smpl_size;
 27.2096 +		/* no more sampling */
 27.2097 +		ctx->ctx_smpl_hdr = NULL;
 27.2098 +		ctx->ctx_fl_is_sampling = 0;
 27.2099 +	}
 27.2100 +
 27.2101 +	DPRINT(("ctx_state=%d free_possible=%d addr=%p size=%lu\n",
 27.2102 +		state,
 27.2103 +		free_possible,
 27.2104 +		smpl_buf_addr,
 27.2105 +		smpl_buf_size));
 27.2106 +
 27.2107 +	if (smpl_buf_addr) pfm_exit_smpl_buffer(ctx->ctx_buf_fmt);
 27.2108 +
 27.2109 +	/*
 27.2110 +	 * UNLOADED that the session has already been unreserved.
 27.2111 +	 */
 27.2112 +	if (state == PFM_CTX_ZOMBIE) {
 27.2113 +		pfm_unreserve_session(ctx, ctx->ctx_fl_system , ctx->ctx_cpu);
 27.2114 +	}
 27.2115 +
 27.2116 +	/*
 27.2117 +	 * disconnect file descriptor from context must be done
 27.2118 +	 * before we unlock.
 27.2119 +	 */
 27.2120 +	filp->private_data = NULL;
 27.2121 +
 27.2122 +	/*
 27.2123 +	 * if we free on the spot, the context is now completely unreacheable
 27.2124 +	 * from the callers side. The monitored task side is also cut, so we
 27.2125 +	 * can freely cut.
 27.2126 +	 *
 27.2127 +	 * If we have a deferred free, only the caller side is disconnected.
 27.2128 +	 */
 27.2129 +	UNPROTECT_CTX(ctx, flags);
 27.2130 +
 27.2131 +	/*
 27.2132 +	 * All memory free operations (especially for vmalloc'ed memory)
 27.2133 +	 * MUST be done with interrupts ENABLED.
 27.2134 +	 */
 27.2135 +	if (smpl_buf_addr)  pfm_rvfree(smpl_buf_addr, smpl_buf_size);
 27.2136 +
 27.2137 +	/*
 27.2138 +	 * return the memory used by the context
 27.2139 +	 */
 27.2140 +	if (free_possible) pfm_context_free(ctx);
 27.2141 +
 27.2142 +	if (is_running_on_xen()) {
 27.2143 +		if (is_xenoprof_primary()) {
 27.2144 +			int ret = HYPERVISOR_perfmon_op(PFM_DESTROY_CONTEXT,
 27.2145 +			                                NULL, 0);
 27.2146 +			if (ret)
 27.2147 +				printk("%s:%d PFM_DESTROY_CONTEXT hypercall "
 27.2148 +				       "failed\n", __func__, __LINE__);
 27.2149 +		}
 27.2150 +	}
 27.2151 +	return 0;
 27.2152 +}
 27.2153 +
 27.2154 +static int
 27.2155 +pfm_no_open(struct inode *irrelevant, struct file *dontcare)
 27.2156 +{
 27.2157 +	DPRINT(("pfm_no_open called\n"));
 27.2158 +	return -ENXIO;
 27.2159 +}
 27.2160 +
 27.2161 +
 27.2162 +
 27.2163 +static struct file_operations pfm_file_ops = {
 27.2164 +	.llseek   = no_llseek,
 27.2165 +	.read     = pfm_read,
 27.2166 +	.write    = pfm_write,
 27.2167 +	.poll     = pfm_poll,
 27.2168 +	.ioctl    = pfm_ioctl,
 27.2169 +	.open     = pfm_no_open,	/* special open code to disallow open via /proc */
 27.2170 +	.fasync   = pfm_fasync,
 27.2171 +	.release  = pfm_close,
 27.2172 +	.flush	  = pfm_flush
 27.2173 +};
 27.2174 +
 27.2175 +static int
 27.2176 +pfmfs_delete_dentry(struct dentry *dentry)
 27.2177 +{
 27.2178 +	return 1;
 27.2179 +}
 27.2180 +
 27.2181 +static struct dentry_operations pfmfs_dentry_operations = {
 27.2182 +	.d_delete = pfmfs_delete_dentry,
 27.2183 +};
 27.2184 +
 27.2185 +
 27.2186 +static int
 27.2187 +pfm_alloc_fd(struct file **cfile)
 27.2188 +{
 27.2189 +	int fd, ret = 0;
 27.2190 +	struct file *file = NULL;
 27.2191 +	struct inode * inode;
 27.2192 +	char name[32];
 27.2193 +	struct qstr this;
 27.2194 +
 27.2195 +	fd = get_unused_fd();
 27.2196 +	if (fd < 0) return -ENFILE;
 27.2197 +
 27.2198 +	ret = -ENFILE;
 27.2199 +
 27.2200 +	file = get_empty_filp();
 27.2201 +	if (!file) goto out;
 27.2202 +
 27.2203 +	/*
 27.2204 +	 * allocate a new inode
 27.2205 +	 */
 27.2206 +	inode = new_inode(pfmfs_mnt->mnt_sb);
 27.2207 +	if (!inode) goto out;
 27.2208 +
 27.2209 +	DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
 27.2210 +
 27.2211 +	inode->i_mode = S_IFCHR|S_IRUGO;
 27.2212 +	inode->i_uid  = current->fsuid;
 27.2213 +	inode->i_gid  = current->fsgid;
 27.2214 +
 27.2215 +	sprintf(name, "[%lu]", inode->i_ino);
 27.2216 +	this.name = name;
 27.2217 +	this.len  = strlen(name);
 27.2218 +	this.hash = inode->i_ino;
 27.2219 +
 27.2220 +	ret = -ENOMEM;
 27.2221 +
 27.2222 +	/*
 27.2223 +	 * allocate a new dcache entry
 27.2224 +	 */
 27.2225 +	file->f_dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
 27.2226 +	if (!file->f_dentry) goto out;
 27.2227 +
 27.2228 +	file->f_dentry->d_op = &pfmfs_dentry_operations;
 27.2229 +
 27.2230 +	d_add(file->f_dentry, inode);
 27.2231 +	file->f_vfsmnt = mntget(pfmfs_mnt);
 27.2232 +	file->f_mapping = inode->i_mapping;
 27.2233 +
 27.2234 +	file->f_op    = &pfm_file_ops;
 27.2235 +	file->f_mode  = FMODE_READ;
 27.2236 +	file->f_flags = O_RDONLY;
 27.2237 +	file->f_pos   = 0;
 27.2238 +
 27.2239 +	/*
 27.2240 +	 * may have to delay until context is attached?
 27.2241 +	 */
 27.2242 +	fd_install(fd, file);
 27.2243 +
 27.2244 +	/*
 27.2245 +	 * the file structure we will use
 27.2246 +	 */
 27.2247 +	*cfile = file;
 27.2248 +
 27.2249 +	return fd;
 27.2250 +out:
 27.2251 +	if (file) put_filp(file);
 27.2252 +	put_unused_fd(fd);
 27.2253 +	return ret;
 27.2254 +}
 27.2255 +
 27.2256 +static void
 27.2257 +pfm_free_fd(int fd, struct file *file)
 27.2258 +{
 27.2259 +	struct files_struct *files = current->files;
 27.2260 +	struct fdtable *fdt;
 27.2261 +
 27.2262 +	/* 
 27.2263 +	 * there ie no fd_uninstall(), so we do it here
 27.2264 +	 */
 27.2265 +	spin_lock(&files->file_lock);
 27.2266 +	fdt = files_fdtable(files);
 27.2267 +	rcu_assign_pointer(fdt->fd[fd], NULL);
 27.2268 +	spin_unlock(&files->file_lock);
 27.2269 +
 27.2270 +	if (file)
 27.2271 +		put_filp(file);
 27.2272 +	put_unused_fd(fd);
 27.2273 +}
 27.2274 +
 27.2275 +static int
 27.2276 +pfm_remap_buffer(struct vm_area_struct *vma, unsigned long buf, unsigned long addr, unsigned long size)
 27.2277 +{
 27.2278 +	DPRINT(("CPU%d buf=0x%lx addr=0x%lx size=%ld\n", smp_processor_id(), buf, addr, size));
 27.2279 +
 27.2280 +	while (size > 0) {
 27.2281 +		unsigned long pfn = ia64_tpa(buf) >> PAGE_SHIFT;
 27.2282 +
 27.2283 +
 27.2284 +		if (remap_pfn_range(vma, addr, pfn, PAGE_SIZE, PAGE_READONLY))
 27.2285 +			return -ENOMEM;
 27.2286 +
 27.2287 +		addr  += PAGE_SIZE;
 27.2288 +		buf   += PAGE_SIZE;
 27.2289 +		size  -= PAGE_SIZE;
 27.2290 +	}
 27.2291 +	return 0;
 27.2292 +}
 27.2293 +
 27.2294 +/*
 27.2295 + * allocate a sampling buffer and remaps it into the user address space of the task
 27.2296 + */
 27.2297 +static int
 27.2298 +pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned long rsize, void **user_vaddr)
 27.2299 +{
 27.2300 +	struct mm_struct *mm = task->mm;
 27.2301 +	struct vm_area_struct *vma = NULL;
 27.2302 +	unsigned long size;
 27.2303 +	void *smpl_buf;
 27.2304 +
 27.2305 +
 27.2306 +	/*
 27.2307 +	 * the fixed header + requested size and align to page boundary
 27.2308 +	 */
 27.2309 +	size = PAGE_ALIGN(rsize);
 27.2310 +
 27.2311 +	DPRINT(("sampling buffer rsize=%lu size=%lu bytes\n", rsize, size));
 27.2312 +
 27.2313 +	/*
 27.2314 +	 * check requested size to avoid Denial-of-service attacks
 27.2315 +	 * XXX: may have to refine this test
 27.2316 +	 * Check against address space limit.
 27.2317 +	 *
 27.2318 +	 * if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur)
 27.2319 +	 * 	return -ENOMEM;
 27.2320 +	 */
 27.2321 +	if (size > task->signal->rlim[RLIMIT_MEMLOCK].rlim_cur)
 27.2322 +		return -ENOMEM;
 27.2323 +
 27.2324 +	/*
 27.2325 +	 * We do the easy to undo allocations first.
 27.2326 + 	 *
 27.2327 +	 * pfm_rvmalloc(), clears the buffer, so there is no leak
 27.2328 +	 */
 27.2329 +	smpl_buf = pfm_rvmalloc(size);
 27.2330 +	if (smpl_buf == NULL) {
 27.2331 +		DPRINT(("Can't allocate sampling buffer\n"));
 27.2332 +		return -ENOMEM;
 27.2333 +	}
 27.2334 +
 27.2335 +	DPRINT(("smpl_buf @%p\n", smpl_buf));
 27.2336 +
 27.2337 +	/* allocate vma */
 27.2338 +	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 27.2339 +	if (!vma) {
 27.2340 +		DPRINT(("Cannot allocate vma\n"));
 27.2341 +		goto error_kmem;
 27.2342 +	}
 27.2343 +	memset(vma, 0, sizeof(*vma));
 27.2344 +
 27.2345 +	/*
 27.2346 +	 * partially initialize the vma for the sampling buffer
 27.2347 +	 */
 27.2348 +	vma->vm_mm	     = mm;
 27.2349 +	vma->vm_flags	     = VM_READ| VM_MAYREAD |VM_RESERVED;
 27.2350 +	vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */
 27.2351 +
 27.2352 +	/*
 27.2353 +	 * Now we have everything we need and we can initialize
 27.2354 +	 * and connect all the data structures
 27.2355 +	 */
 27.2356 +
 27.2357 +	ctx->ctx_smpl_hdr   = smpl_buf;
 27.2358 +	ctx->ctx_smpl_size  = size; /* aligned size */
 27.2359 +
 27.2360 +	/*
 27.2361 +	 * Let's do the difficult operations next.
 27.2362 +	 *
 27.2363 +	 * now we atomically find some area in the address space and
 27.2364 +	 * remap the buffer in it.
 27.2365 +	 */
 27.2366 +	down_write(&task->mm->mmap_sem);
 27.2367 +
 27.2368 +	/* find some free area in address space, must have mmap sem held */
 27.2369 +	vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0);
 27.2370 +	if (vma->vm_start == 0UL) {
 27.2371 +		DPRINT(("Cannot find unmapped area for size %ld\n", size));
 27.2372 +		up_write(&task->mm->mmap_sem);
 27.2373 +		goto error;
 27.2374 +	}
 27.2375 +	vma->vm_end = vma->vm_start + size;
 27.2376 +	vma->vm_pgoff = vma->vm_start >> PAGE_SHIFT;
 27.2377 +
 27.2378 +	DPRINT(("aligned size=%ld, hdr=%p mapped @0x%lx\n", size, ctx->ctx_smpl_hdr, vma->vm_start));
 27.2379 +
 27.2380 +	/* can only be applied to current task, need to have the mm semaphore held when called */
 27.2381 +	if (pfm_remap_buffer(vma, (unsigned long)smpl_buf, vma->vm_start, size)) {
 27.2382 +		DPRINT(("Can't remap buffer\n"));
 27.2383 +		up_write(&task->mm->mmap_sem);
 27.2384 +		goto error;
 27.2385 +	}
 27.2386 +
 27.2387 +	/*
 27.2388 +	 * now insert the vma in the vm list for the process, must be
 27.2389 +	 * done with mmap lock held
 27.2390 +	 */
 27.2391 +	insert_vm_struct(mm, vma);
 27.2392 +
 27.2393 +	mm->total_vm  += size >> PAGE_SHIFT;
 27.2394 +	vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
 27.2395 +							vma_pages(vma));
 27.2396 +	up_write(&task->mm->mmap_sem);
 27.2397 +
 27.2398 +	/*
 27.2399 +	 * keep track of user level virtual address
 27.2400 +	 */
 27.2401 +	ctx->ctx_smpl_vaddr = (void *)vma->vm_start;
 27.2402 +	*(unsigned long *)user_vaddr = vma->vm_start;
 27.2403 +
 27.2404 +	return 0;
 27.2405 +
 27.2406 +error:
 27.2407 +	kmem_cache_free(vm_area_cachep, vma);
 27.2408 +error_kmem:
 27.2409 +	pfm_rvfree(smpl_buf, size);
 27.2410 +
 27.2411 +	return -ENOMEM;
 27.2412 +}
 27.2413 +
 27.2414 +/*
 27.2415 + * XXX: do something better here
 27.2416 + */
 27.2417 +static int
 27.2418 +pfm_bad_permissions(struct task_struct *task)
 27.2419 +{
 27.2420 +	/* inspired by ptrace_attach() */
 27.2421 +	DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
 27.2422 +		current->uid,
 27.2423 +		current->gid,
 27.2424 +		task->euid,
 27.2425 +		task->suid,
 27.2426 +		task->uid,
 27.2427 +		task->egid,
 27.2428 +		task->sgid));
 27.2429 +
 27.2430 +	return ((current->uid != task->euid)
 27.2431 +	    || (current->uid != task->suid)
 27.2432 +	    || (current->uid != task->uid)
 27.2433 +	    || (current->gid != task->egid)
 27.2434 +	    || (current->gid != task->sgid)
 27.2435 +	    || (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE);
 27.2436 +}
 27.2437 +
 27.2438 +static int
 27.2439 +pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx)
 27.2440 +{
 27.2441 +	int ctx_flags;
 27.2442 +
 27.2443 +	/* valid signal */
 27.2444 +
 27.2445 +	ctx_flags = pfx->ctx_flags;
 27.2446 +
 27.2447 +	if (ctx_flags & PFM_FL_SYSTEM_WIDE) {
 27.2448 +
 27.2449 +		/*
 27.2450 +		 * cannot block in this mode
 27.2451 +		 */
 27.2452 +		if (ctx_flags & PFM_FL_NOTIFY_BLOCK) {
 27.2453 +			DPRINT(("cannot use blocking mode when in system wide monitoring\n"));
 27.2454 +			return -EINVAL;
 27.2455 +		}
 27.2456 +	} else {
 27.2457 +	}
 27.2458 +	/* probably more to add here */
 27.2459 +
 27.2460 +	return 0;
 27.2461 +}
 27.2462 +
 27.2463 +static int
 27.2464 +pfm_setup_buffer_fmt(struct task_struct *task, pfm_context_t *ctx, unsigned int ctx_flags,
 27.2465 +		     unsigned int cpu, pfarg_context_t *arg)
 27.2466 +{
 27.2467 +	pfm_buffer_fmt_t *fmt = NULL;
 27.2468 +	unsigned long size = 0UL;
 27.2469 +	void *uaddr = NULL;
 27.2470 +	void *fmt_arg = NULL;
 27.2471 +	int ret = 0;
 27.2472 +#define PFM_CTXARG_BUF_ARG(a)	(pfm_buffer_fmt_t *)(a+1)
 27.2473 +
 27.2474 +	/* invoke and lock buffer format, if found */
 27.2475 +	fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id);
 27.2476 +	if (fmt == NULL) {
 27.2477 +		DPRINT(("[%d] cannot find buffer format\n", task->pid));
 27.2478 +		return -EINVAL;
 27.2479 +	}
 27.2480 +
 27.2481 +	/*
 27.2482 +	 * buffer argument MUST be contiguous to pfarg_context_t
 27.2483 +	 */
 27.2484 +	if (fmt->fmt_arg_size) fmt_arg = PFM_CTXARG_BUF_ARG(arg);
 27.2485 +
 27.2486 +	ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg);
 27.2487 +
 27.2488 +	DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task->pid, ctx_flags, cpu, fmt_arg, ret));
 27.2489 +
 27.2490 +	if (ret) goto error;
 27.2491 +
 27.2492 +	/* link buffer format and context */
 27.2493 +	ctx->ctx_buf_fmt = fmt;
 27.2494 +
 27.2495 +	/*
 27.2496 +	 * check if buffer format wants to use perfmon buffer allocation/mapping service
 27.2497 +	 */
 27.2498 +	ret = pfm_buf_fmt_getsize(fmt, task, ctx_flags, cpu, fmt_arg, &size);
 27.2499 +	if (ret) goto error;
 27.2500 +
 27.2501 +	if (size) {
 27.2502 +		/*
 27.2503 +		 * buffer is always remapped into the caller's address space
 27.2504 +		 */
 27.2505 +		ret = pfm_smpl_buffer_alloc(current, ctx, size, &uaddr);
 27.2506 +		if (ret) goto error;
 27.2507 +
 27.2508 +		/* keep track of user address of buffer */
 27.2509 +		arg->ctx_smpl_vaddr = uaddr;
 27.2510 +	}
 27.2511 +	ret = pfm_buf_fmt_init(fmt, task, ctx->ctx_smpl_hdr, ctx_flags, cpu, fmt_arg);
 27.2512 +
 27.2513 +error:
 27.2514 +	return ret;
 27.2515 +}
 27.2516 +
 27.2517 +static void
 27.2518 +pfm_reset_pmu_state(pfm_context_t *ctx)
 27.2519 +{
 27.2520 +	int i;
 27.2521 +
 27.2522 +	/*
 27.2523 +	 * install reset values for PMC.
 27.2524 +	 */
 27.2525 +	for (i=1; PMC_IS_LAST(i) == 0; i++) {
 27.2526 +		if (PMC_IS_IMPL(i) == 0) continue;
 27.2527 +		ctx->ctx_pmcs[i] = PMC_DFL_VAL(i);
 27.2528 +		DPRINT(("pmc[%d]=0x%lx\n", i, ctx->ctx_pmcs[i]));
 27.2529 +	}
 27.2530 +	/*
 27.2531 +	 * PMD registers are set to 0UL when the context in memset()
 27.2532 +	 */
 27.2533 +
 27.2534 +	/*
 27.2535 +	 * On context switched restore, we must restore ALL pmc and ALL pmd even
 27.2536 +	 * when they are not actively used by the task. In UP, the incoming process
 27.2537 +	 * may otherwise pick up left over PMC, PMD state from the previous process.
 27.2538 +	 * As opposed to PMD, stale PMC can cause harm to the incoming
 27.2539 +	 * process because they may change what is being measured.
 27.2540 +	 * Therefore, we must systematically reinstall the entire
 27.2541 +	 * PMC state. In SMP, the same thing is possible on the
 27.2542 +	 * same CPU but also on between 2 CPUs.
 27.2543 +	 *
 27.2544 +	 * The problem with PMD is information leaking especially
 27.2545 +	 * to user level when psr.sp=0
 27.2546 +	 *
 27.2547 +	 * There is unfortunately no easy way to avoid this problem
 27.2548 +	 * on either UP or SMP. This definitively slows down the
 27.2549 +	 * pfm_load_regs() function.
 27.2550 +	 */
 27.2551 +
 27.2552 +	 /*
 27.2553 +	  * bitmask of all PMCs accessible to this context
 27.2554 +	  *
 27.2555 +	  * PMC0 is treated differently.
 27.2556 +	  */
 27.2557 +	ctx->ctx_all_pmcs[0] = pmu_conf->impl_pmcs[0] & ~0x1;
 27.2558 +
 27.2559 +	/*
 27.2560 +	 * bitmask of all PMDs that are accesible to this context
 27.2561 +	 */
 27.2562 +	ctx->ctx_all_pmds[0] = pmu_conf->impl_pmds[0];
 27.2563 +
 27.2564 +	DPRINT(("<%d> all_pmcs=0x%lx all_pmds=0x%lx\n", ctx->ctx_fd, ctx->ctx_all_pmcs[0],ctx->ctx_all_pmds[0]));
 27.2565 +
 27.2566 +	/*
 27.2567 +	 * useful in case of re-enable after disable
 27.2568 +	 */
 27.2569 +	ctx->ctx_used_ibrs[0] = 0UL;
 27.2570 +	ctx->ctx_used_dbrs[0] = 0UL;
 27.2571 +}
 27.2572 +
 27.2573 +static int
 27.2574 +pfm_ctx_getsize(void *arg, size_t *sz)
 27.2575 +{
 27.2576 +	pfarg_context_t *req = (pfarg_context_t *)arg;
 27.2577 +	pfm_buffer_fmt_t *fmt;
 27.2578 +
 27.2579 +	*sz = 0;
 27.2580 +
 27.2581 +	if (!pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) return 0;
 27.2582 +
 27.2583 +	fmt = pfm_find_buffer_fmt(req->ctx_smpl_buf_id);
 27.2584 +	if (fmt == NULL) {
 27.2585 +		DPRINT(("cannot find buffer format\n"));
 27.2586 +		return -EINVAL;
 27.2587 +	}
 27.2588 +	/* get just enough to copy in user parameters */
 27.2589 +	*sz = fmt->fmt_arg_size;
 27.2590 +	DPRINT(("arg_size=%lu\n", *sz));
 27.2591 +
 27.2592 +	return 0;
 27.2593 +}
 27.2594 +
 27.2595 +
 27.2596 +
 27.2597 +/*
 27.2598 + * cannot attach if :
 27.2599 + * 	- kernel task
 27.2600 + * 	- task not owned by caller
 27.2601 + * 	- task incompatible with context mode
 27.2602 + */
 27.2603 +static int
 27.2604 +pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
 27.2605 +{
 27.2606 +	/*
 27.2607 +	 * no kernel task or task not owner by caller
 27.2608 +	 */
 27.2609 +	if (task->mm == NULL) {
 27.2610 +		DPRINT(("task [%d] has not memory context (kernel thread)\n", task->pid));
 27.2611 +		return -EPERM;
 27.2612 +	}
 27.2613 +	if (pfm_bad_permissions(task)) {
 27.2614 +		DPRINT(("no permission to attach to  [%d]\n", task->pid));
 27.2615 +		return -EPERM;
 27.2616 +	}
 27.2617 +	/*
 27.2618 +	 * cannot block in self-monitoring mode
 27.2619 +	 */
 27.2620 +	if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) {
 27.2621 +		DPRINT(("cannot load a blocking context on self for [%d]\n", task->pid));
 27.2622 +		return -EINVAL;
 27.2623 +	}
 27.2624 +
 27.2625 +	if (task->exit_state == EXIT_ZOMBIE) {
 27.2626 +		DPRINT(("cannot attach to  zombie task [%d]\n", task->pid));
 27.2627 +		return -EBUSY;
 27.2628 +	}
 27.2629 +
 27.2630 +	/*
 27.2631 +	 * always ok for self
 27.2632 +	 */
 27.2633 +	if (task == current) return 0;
 27.2634 +
 27.2635 +	if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
 27.2636 +		DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task->pid, task->state));
 27.2637 +		return -EBUSY;
 27.2638 +	}
 27.2639 +	/*
 27.2640 +	 * make sure the task is off any CPU
 27.2641 +	 */
 27.2642 +	wait_task_inactive(task);
 27.2643 +
 27.2644 +	/* more to come... */
 27.2645 +
 27.2646 +	return 0;
 27.2647 +}
 27.2648 +
 27.2649 +static int
 27.2650 +pfm_get_task(pfm_context_t *ctx, pid_t pid, struct task_struct **task)
 27.2651 +{
 27.2652 +	struct task_struct *p = current;
 27.2653 +	int ret;
 27.2654 +
 27.2655 +	/* XXX: need to add more checks here */
 27.2656 +	if (pid < 2) return -EPERM;
 27.2657 +
 27.2658 +	if (pid != current->pid) {
 27.2659 +
 27.2660 +		read_lock(&tasklist_lock);
 27.2661 +
 27.2662 +		p = find_task_by_pid(pid);
 27.2663 +
 27.2664 +		/* make sure task cannot go away while we operate on it */
 27.2665 +		if (p) get_task_struct(p);
 27.2666 +
 27.2667 +		read_unlock(&tasklist_lock);
 27.2668 +
 27.2669 +		if (p == NULL) return -ESRCH;
 27.2670 +	}
 27.2671 +
 27.2672 +	ret = pfm_task_incompatible(ctx, p);
 27.2673 +	if (ret == 0) {
 27.2674 +		*task = p;
 27.2675 +	} else if (p != current) {
 27.2676 +		pfm_put_task(p);
 27.2677 +	}
 27.2678 +	return ret;
 27.2679 +}
 27.2680 +
 27.2681 +
 27.2682 +
 27.2683 +static int
 27.2684 +pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.2685 +{
 27.2686 +	pfarg_context_t *req = (pfarg_context_t *)arg;
 27.2687 +	struct file *filp;
 27.2688 +	int ctx_flags;
 27.2689 +	int ret;
 27.2690 +
 27.2691 +	/* let's check the arguments first */
 27.2692 +	ret = pfarg_is_sane(current, req);
 27.2693 +	if (ret < 0) return ret;
 27.2694 +
 27.2695 +	ctx_flags = req->ctx_flags;
 27.2696 +
 27.2697 +	ret = -ENOMEM;
 27.2698 +
 27.2699 +	ctx = pfm_context_alloc();
 27.2700 +	if (!ctx) goto error;
 27.2701 +
 27.2702 +	ret = pfm_alloc_fd(&filp);
 27.2703 +	if (ret < 0) goto error_file;
 27.2704 +
 27.2705 +	req->ctx_fd = ctx->ctx_fd = ret;
 27.2706 +
 27.2707 +	/*
 27.2708 +	 * attach context to file
 27.2709 +	 */
 27.2710 +	filp->private_data = ctx;
 27.2711 +
 27.2712 +	/*
 27.2713 +	 * does the user want to sample?
 27.2714 +	 */
 27.2715 +	if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
 27.2716 +		ret = pfm_setup_buffer_fmt(current, ctx, ctx_flags, 0, req);
 27.2717 +		if (ret) goto buffer_error;
 27.2718 +	}
 27.2719 +
 27.2720 +	/*
 27.2721 +	 * init context protection lock
 27.2722 +	 */
 27.2723 +	spin_lock_init(&ctx->ctx_lock);
 27.2724 +
 27.2725 +	/*
 27.2726 +	 * context is unloaded
 27.2727 +	 */
 27.2728 +	ctx->ctx_state = PFM_CTX_UNLOADED;
 27.2729 +
 27.2730 +	/*
 27.2731 +	 * initialization of context's flags
 27.2732 +	 */
 27.2733 +	ctx->ctx_fl_block       = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
 27.2734 +	ctx->ctx_fl_system      = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
 27.2735 +	ctx->ctx_fl_is_sampling = ctx->ctx_buf_fmt ? 1 : 0; /* assume record() is defined */
 27.2736 +	ctx->ctx_fl_no_msg      = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
 27.2737 +	/*
 27.2738 +	 * will move to set properties
 27.2739 +	 * ctx->ctx_fl_excl_idle   = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
 27.2740 +	 */
 27.2741 +
 27.2742 +	/*
 27.2743 +	 * init restart semaphore to locked
 27.2744 +	 */
 27.2745 +	init_completion(&ctx->ctx_restart_done);
 27.2746 +
 27.2747 +	/*
 27.2748 +	 * activation is used in SMP only
 27.2749 +	 */
 27.2750 +	ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
 27.2751 +	SET_LAST_CPU(ctx, -1);
 27.2752 +
 27.2753 +	/*
 27.2754 +	 * initialize notification message queue
 27.2755 +	 */
 27.2756 +	ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
 27.2757 +	init_waitqueue_head(&ctx->ctx_msgq_wait);
 27.2758 +	init_waitqueue_head(&ctx->ctx_zombieq);
 27.2759 +
 27.2760 +	DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n",
 27.2761 +		ctx,
 27.2762 +		ctx_flags,
 27.2763 +		ctx->ctx_fl_system,
 27.2764 +		ctx->ctx_fl_block,
 27.2765 +		ctx->ctx_fl_excl_idle,
 27.2766 +		ctx->ctx_fl_no_msg,
 27.2767 +		ctx->ctx_fd));
 27.2768 +
 27.2769 +	/*
 27.2770 +	 * initialize soft PMU state
 27.2771 +	 */
 27.2772 +	pfm_reset_pmu_state(ctx);
 27.2773 +
 27.2774 +	if (is_running_on_xen()) {
 27.2775 +		/*
 27.2776 +		 * kludge to get xenoprof.is_primary.
 27.2777 +		 * XENOPROF_init/ia64 is nop. so it is safe to call it here.
 27.2778 +		 */
 27.2779 +		struct xenoprof_init init;
 27.2780 +		ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init);
 27.2781 +		if (ret)
 27.2782 +			goto buffer_error;
 27.2783 +		init_xenoprof_primary(init.is_primary);
 27.2784 +
 27.2785 +		if (is_xenoprof_primary()) {
 27.2786 +			ret = HYPERVISOR_perfmon_op(PFM_CREATE_CONTEXT, arg, 0);
 27.2787 +			if (ret)
 27.2788 +				goto buffer_error;
 27.2789 +		}
 27.2790 +	}
 27.2791 +	return 0;
 27.2792 +
 27.2793 +buffer_error:
 27.2794 +	pfm_free_fd(ctx->ctx_fd, filp);
 27.2795 +
 27.2796 +	if (ctx->ctx_buf_fmt) {
 27.2797 +		pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs);
 27.2798 +	}
 27.2799 +error_file:
 27.2800 +	pfm_context_free(ctx);
 27.2801 +
 27.2802 +error:
 27.2803 +	return ret;
 27.2804 +}
 27.2805 +
 27.2806 +static inline unsigned long
 27.2807 +pfm_new_counter_value (pfm_counter_t *reg, int is_long_reset)
 27.2808 +{
 27.2809 +	unsigned long val = is_long_reset ? reg->long_reset : reg->short_reset;
 27.2810 +	unsigned long new_seed, old_seed = reg->seed, mask = reg->mask;
 27.2811 +	extern unsigned long carta_random32 (unsigned long seed);
 27.2812 +
 27.2813 +	if (reg->flags & PFM_REGFL_RANDOM) {
 27.2814 +		new_seed = carta_random32(old_seed);
 27.2815 +		val -= (old_seed & mask);	/* counter values are negative numbers! */
 27.2816 +		if ((mask >> 32) != 0)
 27.2817 +			/* construct a full 64-bit random value: */
 27.2818 +			new_seed |= carta_random32(old_seed >> 32) << 32;
 27.2819 +		reg->seed = new_seed;
 27.2820 +	}
 27.2821 +	reg->lval = val;
 27.2822 +	return val;
 27.2823 +}
 27.2824 +
 27.2825 +static void
 27.2826 +pfm_reset_regs_masked(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
 27.2827 +{
 27.2828 +	unsigned long mask = ovfl_regs[0];
 27.2829 +	unsigned long reset_others = 0UL;
 27.2830 +	unsigned long val;
 27.2831 +	int i;
 27.2832 +
 27.2833 +	/*
 27.2834 +	 * now restore reset value on sampling overflowed counters
 27.2835 +	 */
 27.2836 +	mask >>= PMU_FIRST_COUNTER;
 27.2837 +	for(i = PMU_FIRST_COUNTER; mask; i++, mask >>= 1) {
 27.2838 +
 27.2839 +		if ((mask & 0x1UL) == 0UL) continue;
 27.2840 +
 27.2841 +		ctx->ctx_pmds[i].val = val = pfm_new_counter_value(ctx->ctx_pmds+ i, is_long_reset);
 27.2842 +		reset_others        |= ctx->ctx_pmds[i].reset_pmds[0];
 27.2843 +
 27.2844 +		DPRINT_ovfl((" %s reset ctx_pmds[%d]=%lx\n", is_long_reset ? "long" : "short", i, val));
 27.2845 +	}
 27.2846 +
 27.2847 +	/*
 27.2848 +	 * Now take care of resetting the other registers
 27.2849 +	 */
 27.2850 +	for(i = 0; reset_others; i++, reset_others >>= 1) {
 27.2851 +
 27.2852 +		if ((reset_others & 0x1) == 0) continue;
 27.2853 +
 27.2854 +		ctx->ctx_pmds[i].val = val = pfm_new_counter_value(ctx->ctx_pmds + i, is_long_reset);
 27.2855 +
 27.2856 +		DPRINT_ovfl(("%s reset_others pmd[%d]=%lx\n",
 27.2857 +			  is_long_reset ? "long" : "short", i, val));
 27.2858 +	}
 27.2859 +}
 27.2860 +
 27.2861 +static void
 27.2862 +pfm_reset_regs(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
 27.2863 +{
 27.2864 +	unsigned long mask = ovfl_regs[0];
 27.2865 +	unsigned long reset_others = 0UL;
 27.2866 +	unsigned long val;
 27.2867 +	int i;
 27.2868 +
 27.2869 +	DPRINT_ovfl(("ovfl_regs=0x%lx is_long_reset=%d\n", ovfl_regs[0], is_long_reset));
 27.2870 +
 27.2871 +	if (ctx->ctx_state == PFM_CTX_MASKED) {
 27.2872 +		pfm_reset_regs_masked(ctx, ovfl_regs, is_long_reset);
 27.2873 +		return;
 27.2874 +	}
 27.2875 +
 27.2876 +	/*
 27.2877 +	 * now restore reset value on sampling overflowed counters
 27.2878 +	 */
 27.2879 +	mask >>= PMU_FIRST_COUNTER;
 27.2880 +	for(i = PMU_FIRST_COUNTER; mask; i++, mask >>= 1) {
 27.2881 +
 27.2882 +		if ((mask & 0x1UL) == 0UL) continue;
 27.2883 +
 27.2884 +		val           = pfm_new_counter_value(ctx->ctx_pmds+ i, is_long_reset);
 27.2885 +		reset_others |= ctx->ctx_pmds[i].reset_pmds[0];
 27.2886 +
 27.2887 +		DPRINT_ovfl((" %s reset ctx_pmds[%d]=%lx\n", is_long_reset ? "long" : "short", i, val));
 27.2888 +
 27.2889 +		pfm_write_soft_counter(ctx, i, val);
 27.2890 +	}
 27.2891 +
 27.2892 +	/*
 27.2893 +	 * Now take care of resetting the other registers
 27.2894 +	 */
 27.2895 +	for(i = 0; reset_others; i++, reset_others >>= 1) {
 27.2896 +
 27.2897 +		if ((reset_others & 0x1) == 0) continue;
 27.2898 +
 27.2899 +		val = pfm_new_counter_value(ctx->ctx_pmds + i, is_long_reset);
 27.2900 +
 27.2901 +		if (PMD_IS_COUNTING(i)) {
 27.2902 +			pfm_write_soft_counter(ctx, i, val);
 27.2903 +		} else {
 27.2904 +			ia64_set_pmd(i, val);
 27.2905 +		}
 27.2906 +		DPRINT_ovfl(("%s reset_others pmd[%d]=%lx\n",
 27.2907 +			  is_long_reset ? "long" : "short", i, val));
 27.2908 +	}
 27.2909 +	ia64_srlz_d();
 27.2910 +}
 27.2911 +
 27.2912 +static int
 27.2913 +pfm_write_pmcs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.2914 +{
 27.2915 +	struct thread_struct *thread = NULL;
 27.2916 +	struct task_struct *task;
 27.2917 +	pfarg_reg_t *req = (pfarg_reg_t *)arg;
 27.2918 +	unsigned long value, pmc_pm;
 27.2919 +	unsigned long smpl_pmds, reset_pmds, impl_pmds;
 27.2920 +	unsigned int cnum, reg_flags, flags, pmc_type;
 27.2921 +	int i, can_access_pmu = 0, is_loaded, is_system, expert_mode;
 27.2922 +	int is_monitor, is_counting, state;
 27.2923 +	int ret = -EINVAL;
 27.2924 +	pfm_reg_check_t	wr_func;
 27.2925 +#define PFM_CHECK_PMC_PM(x, y, z) ((x)->ctx_fl_system ^ PMC_PM(y, z))
 27.2926 +
 27.2927 +  	if (is_running_on_xen()) {
 27.2928 +		if (is_xenoprof_primary())
 27.2929 +			return HYPERVISOR_perfmon_op(PFM_WRITE_PMCS,
 27.2930 +			                             arg, count);
 27.2931 +		return 0;
 27.2932 +  	}
 27.2933 +	state     = ctx->ctx_state;
 27.2934 +	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 27.2935 +	is_system = ctx->ctx_fl_system;
 27.2936 +	task      = ctx->ctx_task;
 27.2937 +	impl_pmds = pmu_conf->impl_pmds[0];
 27.2938 +
 27.2939 +	if (state == PFM_CTX_ZOMBIE) return -EINVAL;
 27.2940 +
 27.2941 +	if (is_loaded) {
 27.2942 +		thread = &task->thread;
 27.2943 +		/*
 27.2944 +		 * In system wide and when the context is loaded, access can only happen
 27.2945 +		 * when the caller is running on the CPU being monitored by the session.
 27.2946 +		 * It does not have to be the owner (ctx_task) of the context per se.
 27.2947 +		 */
 27.2948 +		if (is_system && ctx->ctx_cpu != smp_processor_id()) {
 27.2949 +			DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.2950 +			return -EBUSY;
 27.2951 +		}
 27.2952 +		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 27.2953 +	}
 27.2954 +	expert_mode = pfm_sysctl.expert_mode; 
 27.2955 +
 27.2956 +	for (i = 0; i < count; i++, req++) {
 27.2957 +
 27.2958 +		cnum       = req->reg_num;
 27.2959 +		reg_flags  = req->reg_flags;
 27.2960 +		value      = req->reg_value;
 27.2961 +		smpl_pmds  = req->reg_smpl_pmds[0];
 27.2962 +		reset_pmds = req->reg_reset_pmds[0];
 27.2963 +		flags      = 0;
 27.2964 +
 27.2965 +
 27.2966 +		if (cnum >= PMU_MAX_PMCS) {
 27.2967 +			DPRINT(("pmc%u is invalid\n", cnum));
 27.2968 +			goto error;
 27.2969 +		}
 27.2970 +
 27.2971 +		pmc_type   = pmu_conf->pmc_desc[cnum].type;
 27.2972 +		pmc_pm     = (value >> pmu_conf->pmc_desc[cnum].pm_pos) & 0x1;
 27.2973 +		is_counting = (pmc_type & PFM_REG_COUNTING) == PFM_REG_COUNTING ? 1 : 0;
 27.2974 +		is_monitor  = (pmc_type & PFM_REG_MONITOR) == PFM_REG_MONITOR ? 1 : 0;
 27.2975 +
 27.2976 +		/*
 27.2977 +		 * we reject all non implemented PMC as well
 27.2978 +		 * as attempts to modify PMC[0-3] which are used
 27.2979 +		 * as status registers by the PMU
 27.2980 +		 */
 27.2981 +		if ((pmc_type & PFM_REG_IMPL) == 0 || (pmc_type & PFM_REG_CONTROL) == PFM_REG_CONTROL) {
 27.2982 +			DPRINT(("pmc%u is unimplemented or no-access pmc_type=%x\n", cnum, pmc_type));
 27.2983 +			goto error;
 27.2984 +		}
 27.2985 +		wr_func = pmu_conf->pmc_desc[cnum].write_check;
 27.2986 +		/*
 27.2987 +		 * If the PMC is a monitor, then if the value is not the default:
 27.2988 +		 * 	- system-wide session: PMCx.pm=1 (privileged monitor)
 27.2989 +		 * 	- per-task           : PMCx.pm=0 (user monitor)
 27.2990 +		 */
 27.2991 +		if (is_monitor && value != PMC_DFL_VAL(cnum) && is_system ^ pmc_pm) {
 27.2992 +			DPRINT(("pmc%u pmc_pm=%lu is_system=%d\n",
 27.2993 +				cnum,
 27.2994 +				pmc_pm,
 27.2995 +				is_system));
 27.2996 +			goto error;
 27.2997 +		}
 27.2998 +
 27.2999 +		if (is_counting) {
 27.3000 +			/*
 27.3001 +		 	 * enforce generation of overflow interrupt. Necessary on all
 27.3002 +		 	 * CPUs.
 27.3003 +		 	 */
 27.3004 +			value |= 1 << PMU_PMC_OI;
 27.3005 +
 27.3006 +			if (reg_flags & PFM_REGFL_OVFL_NOTIFY) {
 27.3007 +				flags |= PFM_REGFL_OVFL_NOTIFY;
 27.3008 +			}
 27.3009 +
 27.3010 +			if (reg_flags & PFM_REGFL_RANDOM) flags |= PFM_REGFL_RANDOM;
 27.3011 +
 27.3012 +			/* verify validity of smpl_pmds */
 27.3013 +			if ((smpl_pmds & impl_pmds) != smpl_pmds) {
 27.3014 +				DPRINT(("invalid smpl_pmds 0x%lx for pmc%u\n", smpl_pmds, cnum));
 27.3015 +				goto error;
 27.3016 +			}
 27.3017 +
 27.3018 +			/* verify validity of reset_pmds */
 27.3019 +			if ((reset_pmds & impl_pmds) != reset_pmds) {
 27.3020 +				DPRINT(("invalid reset_pmds 0x%lx for pmc%u\n", reset_pmds, cnum));
 27.3021 +				goto error;
 27.3022 +			}
 27.3023 +		} else {
 27.3024 +			if (reg_flags & (PFM_REGFL_OVFL_NOTIFY|PFM_REGFL_RANDOM)) {
 27.3025 +				DPRINT(("cannot set ovfl_notify or random on pmc%u\n", cnum));
 27.3026 +				goto error;
 27.3027 +			}
 27.3028 +			/* eventid on non-counting monitors are ignored */
 27.3029 +		}
 27.3030 +
 27.3031 +		/*
 27.3032 +		 * execute write checker, if any
 27.3033 +		 */
 27.3034 +		if (likely(expert_mode == 0 && wr_func)) {
 27.3035 +			ret = (*wr_func)(task, ctx, cnum, &value, regs);
 27.3036 +			if (ret) goto error;
 27.3037 +			ret = -EINVAL;
 27.3038 +		}
 27.3039 +
 27.3040 +		/*
 27.3041 +		 * no error on this register
 27.3042 +		 */
 27.3043 +		PFM_REG_RETFLAG_SET(req->reg_flags, 0);
 27.3044 +
 27.3045 +		/*
 27.3046 +		 * Now we commit the changes to the software state
 27.3047 +		 */
 27.3048 +
 27.3049 +		/*
 27.3050 +		 * update overflow information
 27.3051 +		 */
 27.3052 +		if (is_counting) {
 27.3053 +			/*
 27.3054 +		 	 * full flag update each time a register is programmed
 27.3055 +		 	 */
 27.3056 +			ctx->ctx_pmds[cnum].flags = flags;
 27.3057 +
 27.3058 +			ctx->ctx_pmds[cnum].reset_pmds[0] = reset_pmds;
 27.3059 +			ctx->ctx_pmds[cnum].smpl_pmds[0]  = smpl_pmds;
 27.3060 +			ctx->ctx_pmds[cnum].eventid       = req->reg_smpl_eventid;
 27.3061 +
 27.3062 +			/*
 27.3063 +			 * Mark all PMDS to be accessed as used.
 27.3064 +			 *
 27.3065 +			 * We do not keep track of PMC because we have to
 27.3066 +			 * systematically restore ALL of them.
 27.3067 +			 *
 27.3068 +			 * We do not update the used_monitors mask, because
 27.3069 +			 * if we have not programmed them, then will be in
 27.3070 +			 * a quiescent state, therefore we will not need to
 27.3071 +			 * mask/restore then when context is MASKED.
 27.3072 +			 */
 27.3073 +			CTX_USED_PMD(ctx, reset_pmds);
 27.3074 +			CTX_USED_PMD(ctx, smpl_pmds);
 27.3075 +			/*
 27.3076 +		 	 * make sure we do not try to reset on
 27.3077 +		 	 * restart because we have established new values
 27.3078 +		 	 */
 27.3079 +			if (state == PFM_CTX_MASKED) ctx->ctx_ovfl_regs[0] &= ~1UL << cnum;
 27.3080 +		}
 27.3081 +		/*
 27.3082 +		 * Needed in case the user does not initialize the equivalent
 27.3083 +		 * PMD. Clearing is done indirectly via pfm_reset_pmu_state() so there is no
 27.3084 +		 * possible leak here.
 27.3085 +		 */
 27.3086 +		CTX_USED_PMD(ctx, pmu_conf->pmc_desc[cnum].dep_pmd[0]);
 27.3087 +
 27.3088 +		/*
 27.3089 +		 * keep track of the monitor PMC that we are using.
 27.3090 +		 * we save the value of the pmc in ctx_pmcs[] and if
 27.3091 +		 * the monitoring is not stopped for the context we also
 27.3092 +		 * place it in the saved state area so that it will be
 27.3093 +		 * picked up later by the context switch code.
 27.3094 +		 *
 27.3095 +		 * The value in ctx_pmcs[] can only be changed in pfm_write_pmcs().
 27.3096 +		 *
 27.3097 +		 * The value in thread->pmcs[] may be modified on overflow, i.e.,  when
 27.3098 +		 * monitoring needs to be stopped.
 27.3099 +		 */
 27.3100 +		if (is_monitor) CTX_USED_MONITOR(ctx, 1UL << cnum);
 27.3101 +
 27.3102 +		/*
 27.3103 +		 * update context state
 27.3104 +		 */
 27.3105 +		ctx->ctx_pmcs[cnum] = value;
 27.3106 +
 27.3107 +		if (is_loaded) {
 27.3108 +			/*
 27.3109 +			 * write thread state
 27.3110 +			 */
 27.3111 +			if (is_system == 0) thread->pmcs[cnum] = value;
 27.3112 +
 27.3113 +			/*
 27.3114 +			 * write hardware register if we can
 27.3115 +			 */
 27.3116 +			if (can_access_pmu) {
 27.3117 +				ia64_set_pmc(cnum, value);
 27.3118 +			}
 27.3119 +#ifdef CONFIG_SMP
 27.3120 +			else {
 27.3121 +				/*
 27.3122 +				 * per-task SMP only here
 27.3123 +				 *
 27.3124 +			 	 * we are guaranteed that the task is not running on the other CPU,
 27.3125 +			 	 * we indicate that this PMD will need to be reloaded if the task
 27.3126 +			 	 * is rescheduled on the CPU it ran last on.
 27.3127 +			 	 */
 27.3128 +				ctx->ctx_reload_pmcs[0] |= 1UL << cnum;
 27.3129 +			}
 27.3130 +#endif
 27.3131 +		}
 27.3132 +
 27.3133 +		DPRINT(("pmc[%u]=0x%lx ld=%d apmu=%d flags=0x%x all_pmcs=0x%lx used_pmds=0x%lx eventid=%ld smpl_pmds=0x%lx reset_pmds=0x%lx reloads_pmcs=0x%lx used_monitors=0x%lx ovfl_regs=0x%lx\n",
 27.3134 +			  cnum,
 27.3135 +			  value,
 27.3136 +			  is_loaded,
 27.3137 +			  can_access_pmu,
 27.3138 +			  flags,
 27.3139 +			  ctx->ctx_all_pmcs[0],
 27.3140 +			  ctx->ctx_used_pmds[0],
 27.3141 +			  ctx->ctx_pmds[cnum].eventid,
 27.3142 +			  smpl_pmds,
 27.3143 +			  reset_pmds,
 27.3144 +			  ctx->ctx_reload_pmcs[0],
 27.3145 +			  ctx->ctx_used_monitors[0],
 27.3146 +			  ctx->ctx_ovfl_regs[0]));
 27.3147 +	}
 27.3148 +
 27.3149 +	/*
 27.3150 +	 * make sure the changes are visible
 27.3151 +	 */
 27.3152 +	if (can_access_pmu) ia64_srlz_d();
 27.3153 +
 27.3154 +	return 0;
 27.3155 +error:
 27.3156 +	PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
 27.3157 +	return ret;
 27.3158 +}
 27.3159 +
 27.3160 +static int
 27.3161 +pfm_write_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3162 +{
 27.3163 +	struct thread_struct *thread = NULL;
 27.3164 +	struct task_struct *task;
 27.3165 +	pfarg_reg_t *req = (pfarg_reg_t *)arg;
 27.3166 +	unsigned long value, hw_value, ovfl_mask;
 27.3167 +	unsigned int cnum;
 27.3168 +	int i, can_access_pmu = 0, state;
 27.3169 +	int is_counting, is_loaded, is_system, expert_mode;
 27.3170 +	int ret = -EINVAL;
 27.3171 +	pfm_reg_check_t wr_func;
 27.3172 +
 27.3173 +  	if (is_running_on_xen()) {
 27.3174 +		if (is_xenoprof_primary())
 27.3175 +			return HYPERVISOR_perfmon_op(PFM_WRITE_PMDS,
 27.3176 +			                             arg, count);
 27.3177 +		return 0;
 27.3178 +  	}
 27.3179 +
 27.3180 +	state     = ctx->ctx_state;
 27.3181 +	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 27.3182 +	is_system = ctx->ctx_fl_system;
 27.3183 +	ovfl_mask = pmu_conf->ovfl_val;
 27.3184 +	task      = ctx->ctx_task;
 27.3185 +
 27.3186 +	if (unlikely(state == PFM_CTX_ZOMBIE)) return -EINVAL;
 27.3187 +
 27.3188 +	/*
 27.3189 +	 * on both UP and SMP, we can only write to the PMC when the task is
 27.3190 +	 * the owner of the local PMU.
 27.3191 +	 */
 27.3192 +	if (likely(is_loaded)) {
 27.3193 +		thread = &task->thread;
 27.3194 +		/*
 27.3195 +		 * In system wide and when the context is loaded, access can only happen
 27.3196 +		 * when the caller is running on the CPU being monitored by the session.
 27.3197 +		 * It does not have to be the owner (ctx_task) of the context per se.
 27.3198 +		 */
 27.3199 +		if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
 27.3200 +			DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.3201 +			return -EBUSY;
 27.3202 +		}
 27.3203 +		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 27.3204 +	}
 27.3205 +	expert_mode = pfm_sysctl.expert_mode; 
 27.3206 +
 27.3207 +	for (i = 0; i < count; i++, req++) {
 27.3208 +
 27.3209 +		cnum  = req->reg_num;
 27.3210 +		value = req->reg_value;
 27.3211 +
 27.3212 +		if (!PMD_IS_IMPL(cnum)) {
 27.3213 +			DPRINT(("pmd[%u] is unimplemented or invalid\n", cnum));
 27.3214 +			goto abort_mission;
 27.3215 +		}
 27.3216 +		is_counting = PMD_IS_COUNTING(cnum);
 27.3217 +		wr_func     = pmu_conf->pmd_desc[cnum].write_check;
 27.3218 +
 27.3219 +		/*
 27.3220 +		 * execute write checker, if any
 27.3221 +		 */
 27.3222 +		if (unlikely(expert_mode == 0 && wr_func)) {
 27.3223 +			unsigned long v = value;
 27.3224 +
 27.3225 +			ret = (*wr_func)(task, ctx, cnum, &v, regs);
 27.3226 +			if (ret) goto abort_mission;
 27.3227 +
 27.3228 +			value = v;
 27.3229 +			ret   = -EINVAL;
 27.3230 +		}
 27.3231 +
 27.3232 +		/*
 27.3233 +		 * no error on this register
 27.3234 +		 */
 27.3235 +		PFM_REG_RETFLAG_SET(req->reg_flags, 0);
 27.3236 +
 27.3237 +		/*
 27.3238 +		 * now commit changes to software state
 27.3239 +		 */
 27.3240 +		hw_value = value;
 27.3241 +
 27.3242 +		/*
 27.3243 +		 * update virtualized (64bits) counter
 27.3244 +		 */
 27.3245 +		if (is_counting) {
 27.3246 +			/*
 27.3247 +			 * write context state
 27.3248 +			 */
 27.3249 +			ctx->ctx_pmds[cnum].lval = value;
 27.3250 +
 27.3251 +			/*
 27.3252 +			 * when context is load we use the split value
 27.3253 +			 */
 27.3254 +			if (is_loaded) {
 27.3255 +				hw_value = value &  ovfl_mask;
 27.3256 +				value    = value & ~ovfl_mask;
 27.3257 +			}
 27.3258 +		}
 27.3259 +		/*
 27.3260 +		 * update reset values (not just for counters)
 27.3261 +		 */
 27.3262 +		ctx->ctx_pmds[cnum].long_reset  = req->reg_long_reset;
 27.3263 +		ctx->ctx_pmds[cnum].short_reset = req->reg_short_reset;
 27.3264 +
 27.3265 +		/*
 27.3266 +		 * update randomization parameters (not just for counters)
 27.3267 +		 */
 27.3268 +		ctx->ctx_pmds[cnum].seed = req->reg_random_seed;
 27.3269 +		ctx->ctx_pmds[cnum].mask = req->reg_random_mask;
 27.3270 +
 27.3271 +		/*
 27.3272 +		 * update context value
 27.3273 +		 */
 27.3274 +		ctx->ctx_pmds[cnum].val  = value;
 27.3275 +
 27.3276 +		/*
 27.3277 +		 * Keep track of what we use
 27.3278 +		 *
 27.3279 +		 * We do not keep track of PMC because we have to
 27.3280 +		 * systematically restore ALL of them.
 27.3281 +		 */
 27.3282 +		CTX_USED_PMD(ctx, PMD_PMD_DEP(cnum));
 27.3283 +
 27.3284 +		/*
 27.3285 +		 * mark this PMD register used as well
 27.3286 +		 */
 27.3287 +		CTX_USED_PMD(ctx, RDEP(cnum));
 27.3288 +
 27.3289 +		/*
 27.3290 +		 * make sure we do not try to reset on
 27.3291 +		 * restart because we have established new values
 27.3292 +		 */
 27.3293 +		if (is_counting && state == PFM_CTX_MASKED) {
 27.3294 +			ctx->ctx_ovfl_regs[0] &= ~1UL << cnum;
 27.3295 +		}
 27.3296 +
 27.3297 +		if (is_loaded) {
 27.3298 +			/*
 27.3299 +		 	 * write thread state
 27.3300 +		 	 */
 27.3301 +			if (is_system == 0) thread->pmds[cnum] = hw_value;
 27.3302 +
 27.3303 +			/*
 27.3304 +			 * write hardware register if we can
 27.3305 +			 */
 27.3306 +			if (can_access_pmu) {
 27.3307 +				ia64_set_pmd(cnum, hw_value);
 27.3308 +			} else {
 27.3309 +#ifdef CONFIG_SMP
 27.3310 +				/*
 27.3311 +			 	 * we are guaranteed that the task is not running on the other CPU,
 27.3312 +			 	 * we indicate that this PMD will need to be reloaded if the task
 27.3313 +			 	 * is rescheduled on the CPU it ran last on.
 27.3314 +			 	 */
 27.3315 +				ctx->ctx_reload_pmds[0] |= 1UL << cnum;
 27.3316 +#endif
 27.3317 +			}
 27.3318 +		}
 27.3319 +
 27.3320 +		DPRINT(("pmd[%u]=0x%lx ld=%d apmu=%d, hw_value=0x%lx ctx_pmd=0x%lx  short_reset=0x%lx "
 27.3321 +			  "long_reset=0x%lx notify=%c seed=0x%lx mask=0x%lx used_pmds=0x%lx reset_pmds=0x%lx reload_pmds=0x%lx all_pmds=0x%lx ovfl_regs=0x%lx\n",
 27.3322 +			cnum,
 27.3323 +			value,
 27.3324 +			is_loaded,
 27.3325 +			can_access_pmu,
 27.3326 +			hw_value,
 27.3327 +			ctx->ctx_pmds[cnum].val,
 27.3328 +			ctx->ctx_pmds[cnum].short_reset,
 27.3329 +			ctx->ctx_pmds[cnum].long_reset,
 27.3330 +			PMC_OVFL_NOTIFY(ctx, cnum) ? 'Y':'N',
 27.3331 +			ctx->ctx_pmds[cnum].seed,
 27.3332 +			ctx->ctx_pmds[cnum].mask,
 27.3333 +			ctx->ctx_used_pmds[0],
 27.3334 +			ctx->ctx_pmds[cnum].reset_pmds[0],
 27.3335 +			ctx->ctx_reload_pmds[0],
 27.3336 +			ctx->ctx_all_pmds[0],
 27.3337 +			ctx->ctx_ovfl_regs[0]));
 27.3338 +	}
 27.3339 +
 27.3340 +	/*
 27.3341 +	 * make changes visible
 27.3342 +	 */
 27.3343 +	if (can_access_pmu) ia64_srlz_d();
 27.3344 +
 27.3345 +	return 0;
 27.3346 +
 27.3347 +abort_mission:
 27.3348 +	/*
 27.3349 +	 * for now, we have only one possibility for error
 27.3350 +	 */
 27.3351 +	PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
 27.3352 +	return ret;
 27.3353 +}
 27.3354 +
 27.3355 +/*
 27.3356 + * By the way of PROTECT_CONTEXT(), interrupts are masked while we are in this function.
 27.3357 + * Therefore we know, we do not have to worry about the PMU overflow interrupt. If an
 27.3358 + * interrupt is delivered during the call, it will be kept pending until we leave, making
 27.3359 + * it appears as if it had been generated at the UNPROTECT_CONTEXT(). At least we are
 27.3360 + * guaranteed to return consistent data to the user, it may simply be old. It is not
 27.3361 + * trivial to treat the overflow while inside the call because you may end up in
 27.3362 + * some module sampling buffer code causing deadlocks.
 27.3363 + */
 27.3364 +static int
 27.3365 +pfm_read_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3366 +{
 27.3367 +	struct thread_struct *thread = NULL;
 27.3368 +	struct task_struct *task;
 27.3369 +	unsigned long val = 0UL, lval, ovfl_mask, sval;
 27.3370 +	pfarg_reg_t *req = (pfarg_reg_t *)arg;
 27.3371 +	unsigned int cnum, reg_flags = 0;
 27.3372 +	int i, can_access_pmu = 0, state;
 27.3373 +	int is_loaded, is_system, is_counting, expert_mode;
 27.3374 +	int ret = -EINVAL;
 27.3375 +	pfm_reg_check_t rd_func;
 27.3376 +	XEN_NOT_SUPPORTED_YET;
 27.3377 +
 27.3378 +	/*
 27.3379 +	 * access is possible when loaded only for
 27.3380 +	 * self-monitoring tasks or in UP mode
 27.3381 +	 */
 27.3382 +
 27.3383 +	state     = ctx->ctx_state;
 27.3384 +	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 27.3385 +	is_system = ctx->ctx_fl_system;
 27.3386 +	ovfl_mask = pmu_conf->ovfl_val;
 27.3387 +	task      = ctx->ctx_task;
 27.3388 +
 27.3389 +	if (state == PFM_CTX_ZOMBIE) return -EINVAL;
 27.3390 +
 27.3391 +	if (likely(is_loaded)) {
 27.3392 +		thread = &task->thread;
 27.3393 +		/*
 27.3394 +		 * In system wide and when the context is loaded, access can only happen
 27.3395 +		 * when the caller is running on the CPU being monitored by the session.
 27.3396 +		 * It does not have to be the owner (ctx_task) of the context per se.
 27.3397 +		 */
 27.3398 +		if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
 27.3399 +			DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.3400 +			return -EBUSY;
 27.3401 +		}
 27.3402 +		/*
 27.3403 +		 * this can be true when not self-monitoring only in UP
 27.3404 +		 */
 27.3405 +		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 27.3406 +
 27.3407 +		if (can_access_pmu) ia64_srlz_d();
 27.3408 +	}
 27.3409 +	expert_mode = pfm_sysctl.expert_mode; 
 27.3410 +
 27.3411 +	DPRINT(("ld=%d apmu=%d ctx_state=%d\n",
 27.3412 +		is_loaded,
 27.3413 +		can_access_pmu,
 27.3414 +		state));
 27.3415 +
 27.3416 +	/*
 27.3417 +	 * on both UP and SMP, we can only read the PMD from the hardware register when
 27.3418 +	 * the task is the owner of the local PMU.
 27.3419 +	 */
 27.3420 +
 27.3421 +	for (i = 0; i < count; i++, req++) {
 27.3422 +
 27.3423 +		cnum        = req->reg_num;
 27.3424 +		reg_flags   = req->reg_flags;
 27.3425 +
 27.3426 +		if (unlikely(!PMD_IS_IMPL(cnum))) goto error;
 27.3427 +		/*
 27.3428 +		 * we can only read the register that we use. That includes
 27.3429 +		 * the one we explicitely initialize AND the one we want included
 27.3430 +		 * in the sampling buffer (smpl_regs).
 27.3431 +		 *
 27.3432 +		 * Having this restriction allows optimization in the ctxsw routine
 27.3433 +		 * without compromising security (leaks)
 27.3434 +		 */
 27.3435 +		if (unlikely(!CTX_IS_USED_PMD(ctx, cnum))) goto error;
 27.3436 +
 27.3437 +		sval        = ctx->ctx_pmds[cnum].val;
 27.3438 +		lval        = ctx->ctx_pmds[cnum].lval;
 27.3439 +		is_counting = PMD_IS_COUNTING(cnum);
 27.3440 +
 27.3441 +		/*
 27.3442 +		 * If the task is not the current one, then we check if the
 27.3443 +		 * PMU state is still in the local live register due to lazy ctxsw.
 27.3444 +		 * If true, then we read directly from the registers.
 27.3445 +		 */
 27.3446 +		if (can_access_pmu){
 27.3447 +			val = ia64_get_pmd(cnum);
 27.3448 +		} else {
 27.3449 +			/*
 27.3450 +			 * context has been saved
 27.3451 +			 * if context is zombie, then task does not exist anymore.
 27.3452 +			 * In this case, we use the full value saved in the context (pfm_flush_regs()).
 27.3453 +			 */
 27.3454 +			val = is_loaded ? thread->pmds[cnum] : 0UL;
 27.3455 +		}
 27.3456 +		rd_func = pmu_conf->pmd_desc[cnum].read_check;
 27.3457 +
 27.3458 +		if (is_counting) {
 27.3459 +			/*
 27.3460 +			 * XXX: need to check for overflow when loaded
 27.3461 +			 */
 27.3462 +			val &= ovfl_mask;
 27.3463 +			val += sval;
 27.3464 +		}
 27.3465 +
 27.3466 +		/*
 27.3467 +		 * execute read checker, if any
 27.3468 +		 */
 27.3469 +		if (unlikely(expert_mode == 0 && rd_func)) {
 27.3470 +			unsigned long v = val;
 27.3471 +			ret = (*rd_func)(ctx->ctx_task, ctx, cnum, &v, regs);
 27.3472 +			if (ret) goto error;
 27.3473 +			val = v;
 27.3474 +			ret = -EINVAL;
 27.3475 +		}
 27.3476 +
 27.3477 +		PFM_REG_RETFLAG_SET(reg_flags, 0);
 27.3478 +
 27.3479 +		DPRINT(("pmd[%u]=0x%lx\n", cnum, val));
 27.3480 +
 27.3481 +		/*
 27.3482 +		 * update register return value, abort all if problem during copy.
 27.3483 +		 * we only modify the reg_flags field. no check mode is fine because
 27.3484 +		 * access has been verified upfront in sys_perfmonctl().
 27.3485 +		 */
 27.3486 +		req->reg_value            = val;
 27.3487 +		req->reg_flags            = reg_flags;
 27.3488 +		req->reg_last_reset_val   = lval;
 27.3489 +	}
 27.3490 +
 27.3491 +	return 0;
 27.3492 +
 27.3493 +error:
 27.3494 +	PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
 27.3495 +	return ret;
 27.3496 +}
 27.3497 +
 27.3498 +int
 27.3499 +pfm_mod_write_pmcs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
 27.3500 +{
 27.3501 +	pfm_context_t *ctx;
 27.3502 +
 27.3503 +	if (req == NULL) return -EINVAL;
 27.3504 +
 27.3505 + 	ctx = GET_PMU_CTX();
 27.3506 +
 27.3507 +	if (ctx == NULL) return -EINVAL;
 27.3508 +
 27.3509 +	/*
 27.3510 +	 * for now limit to current task, which is enough when calling
 27.3511 +	 * from overflow handler
 27.3512 +	 */
 27.3513 +	if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
 27.3514 +
 27.3515 +	return pfm_write_pmcs(ctx, req, nreq, regs);
 27.3516 +}
 27.3517 +EXPORT_SYMBOL(pfm_mod_write_pmcs);
 27.3518 +
 27.3519 +int
 27.3520 +pfm_mod_read_pmds(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
 27.3521 +{
 27.3522 +	pfm_context_t *ctx;
 27.3523 +
 27.3524 +	if (req == NULL) return -EINVAL;
 27.3525 +
 27.3526 + 	ctx = GET_PMU_CTX();
 27.3527 +
 27.3528 +	if (ctx == NULL) return -EINVAL;
 27.3529 +
 27.3530 +	/*
 27.3531 +	 * for now limit to current task, which is enough when calling
 27.3532 +	 * from overflow handler
 27.3533 +	 */
 27.3534 +	if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
 27.3535 +
 27.3536 +	return pfm_read_pmds(ctx, req, nreq, regs);
 27.3537 +}
 27.3538 +EXPORT_SYMBOL(pfm_mod_read_pmds);
 27.3539 +
 27.3540 +/*
 27.3541 + * Only call this function when a process it trying to
 27.3542 + * write the debug registers (reading is always allowed)
 27.3543 + */
 27.3544 +int
 27.3545 +pfm_use_debug_registers(struct task_struct *task)
 27.3546 +{
 27.3547 +	pfm_context_t *ctx = task->thread.pfm_context;
 27.3548 +	unsigned long flags;
 27.3549 +	int ret = 0;
 27.3550 +
 27.3551 +	if (pmu_conf->use_rr_dbregs == 0) return 0;
 27.3552 +
 27.3553 +	DPRINT(("called for [%d]\n", task->pid));
 27.3554 +
 27.3555 +	/*
 27.3556 +	 * do it only once
 27.3557 +	 */
 27.3558 +	if (task->thread.flags & IA64_THREAD_DBG_VALID) return 0;
 27.3559 +
 27.3560 +	/*
 27.3561 +	 * Even on SMP, we do not need to use an atomic here because
 27.3562 +	 * the only way in is via ptrace() and this is possible only when the
 27.3563 +	 * process is stopped. Even in the case where the ctxsw out is not totally
 27.3564 +	 * completed by the time we come here, there is no way the 'stopped' process
 27.3565 +	 * could be in the middle of fiddling with the pfm_write_ibr_dbr() routine.
 27.3566 +	 * So this is always safe.
 27.3567 +	 */
 27.3568 +	if (ctx && ctx->ctx_fl_using_dbreg == 1) return -1;
 27.3569 +
 27.3570 +	LOCK_PFS(flags);
 27.3571 +
 27.3572 +	/*
 27.3573 +	 * We cannot allow setting breakpoints when system wide monitoring
 27.3574 +	 * sessions are using the debug registers.
 27.3575 +	 */
 27.3576 +	if (pfm_sessions.pfs_sys_use_dbregs> 0)
 27.3577 +		ret = -1;
 27.3578 +	else
 27.3579 +		pfm_sessions.pfs_ptrace_use_dbregs++;
 27.3580 +
 27.3581 +	DPRINT(("ptrace_use_dbregs=%u  sys_use_dbregs=%u by [%d] ret = %d\n",
 27.3582 +		  pfm_sessions.pfs_ptrace_use_dbregs,
 27.3583 +		  pfm_sessions.pfs_sys_use_dbregs,
 27.3584 +		  task->pid, ret));
 27.3585 +
 27.3586 +	UNLOCK_PFS(flags);
 27.3587 +
 27.3588 +	return ret;
 27.3589 +}
 27.3590 +
 27.3591 +/*
 27.3592 + * This function is called for every task that exits with the
 27.3593 + * IA64_THREAD_DBG_VALID set. This indicates a task which was
 27.3594 + * able to use the debug registers for debugging purposes via
 27.3595 + * ptrace(). Therefore we know it was not using them for
 27.3596 + * perfmormance monitoring, so we only decrement the number
 27.3597 + * of "ptraced" debug register users to keep the count up to date
 27.3598 + */
 27.3599 +int
 27.3600 +pfm_release_debug_registers(struct task_struct *task)
 27.3601 +{
 27.3602 +	unsigned long flags;
 27.3603 +	int ret;
 27.3604 +
 27.3605 +	if (pmu_conf->use_rr_dbregs == 0) return 0;
 27.3606 +
 27.3607 +	LOCK_PFS(flags);
 27.3608 +	if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
 27.3609 +		printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task->pid);
 27.3610 +		ret = -1;
 27.3611 +	}  else {
 27.3612 +		pfm_sessions.pfs_ptrace_use_dbregs--;
 27.3613 +		ret = 0;
 27.3614 +	}
 27.3615 +	UNLOCK_PFS(flags);
 27.3616 +
 27.3617 +	return ret;
 27.3618 +}
 27.3619 +
 27.3620 +static int
 27.3621 +pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3622 +{
 27.3623 +	struct task_struct *task;
 27.3624 +	pfm_buffer_fmt_t *fmt;
 27.3625 +	pfm_ovfl_ctrl_t rst_ctrl;
 27.3626 +	int state, is_system;
 27.3627 +	int ret = 0;
 27.3628 +	XEN_NOT_SUPPORTED_YET;
 27.3629 +
 27.3630 +	state     = ctx->ctx_state;
 27.3631 +	fmt       = ctx->ctx_buf_fmt;
 27.3632 +	is_system = ctx->ctx_fl_system;
 27.3633 +	task      = PFM_CTX_TASK(ctx);
 27.3634 +
 27.3635 +	switch(state) {
 27.3636 +		case PFM_CTX_MASKED:
 27.3637 +			break;
 27.3638 +		case PFM_CTX_LOADED: 
 27.3639 +			if (CTX_HAS_SMPL(ctx) && fmt->fmt_restart_active) break;
 27.3640 +			/* fall through */
 27.3641 +		case PFM_CTX_UNLOADED:
 27.3642 +		case PFM_CTX_ZOMBIE:
 27.3643 +			DPRINT(("invalid state=%d\n", state));
 27.3644 +			return -EBUSY;
 27.3645 +		default:
 27.3646 +			DPRINT(("state=%d, cannot operate (no active_restart handler)\n", state));
 27.3647 +			return -EINVAL;
 27.3648 +	}
 27.3649 +
 27.3650 +	/*
 27.3651 + 	 * In system wide and when the context is loaded, access can only happen
 27.3652 + 	 * when the caller is running on the CPU being monitored by the session.
 27.3653 + 	 * It does not have to be the owner (ctx_task) of the context per se.
 27.3654 + 	 */
 27.3655 +	if (is_system && ctx->ctx_cpu != smp_processor_id()) {
 27.3656 +		DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.3657 +		return -EBUSY;
 27.3658 +	}
 27.3659 +
 27.3660 +	/* sanity check */
 27.3661 +	if (unlikely(task == NULL)) {
 27.3662 +		printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", current->pid);
 27.3663 +		return -EINVAL;
 27.3664 +	}
 27.3665 +
 27.3666 +	if (task == current || is_system) {
 27.3667 +
 27.3668 +		fmt = ctx->ctx_buf_fmt;
 27.3669 +
 27.3670 +		DPRINT(("restarting self %d ovfl=0x%lx\n",
 27.3671 +			task->pid,
 27.3672 +			ctx->ctx_ovfl_regs[0]));
 27.3673 +
 27.3674 +		if (CTX_HAS_SMPL(ctx)) {
 27.3675 +
 27.3676 +			prefetch(ctx->ctx_smpl_hdr);
 27.3677 +
 27.3678 +			rst_ctrl.bits.mask_monitoring = 0;
 27.3679 +			rst_ctrl.bits.reset_ovfl_pmds = 0;
 27.3680 +
 27.3681 +			if (state == PFM_CTX_LOADED)
 27.3682 +				ret = pfm_buf_fmt_restart_active(fmt, task, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
 27.3683 +			else
 27.3684 +				ret = pfm_buf_fmt_restart(fmt, task, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
 27.3685 +		} else {
 27.3686 +			rst_ctrl.bits.mask_monitoring = 0;
 27.3687 +			rst_ctrl.bits.reset_ovfl_pmds = 1;
 27.3688 +		}
 27.3689 +
 27.3690 +		if (ret == 0) {
 27.3691 +			if (rst_ctrl.bits.reset_ovfl_pmds)
 27.3692 +				pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET);
 27.3693 +
 27.3694 +			if (rst_ctrl.bits.mask_monitoring == 0) {
 27.3695 +				DPRINT(("resuming monitoring for [%d]\n", task->pid));
 27.3696 +
 27.3697 +				if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task);
 27.3698 +			} else {
 27.3699 +				DPRINT(("keeping monitoring stopped for [%d]\n", task->pid));
 27.3700 +
 27.3701 +				// cannot use pfm_stop_monitoring(task, regs);
 27.3702 +			}
 27.3703 +		}
 27.3704 +		/*
 27.3705 +		 * clear overflowed PMD mask to remove any stale information
 27.3706 +		 */
 27.3707 +		ctx->ctx_ovfl_regs[0] = 0UL;
 27.3708 +
 27.3709 +		/*
 27.3710 +		 * back to LOADED state
 27.3711 +		 */
 27.3712 +		ctx->ctx_state = PFM_CTX_LOADED;
 27.3713 +
 27.3714 +		/*
 27.3715 +		 * XXX: not really useful for self monitoring
 27.3716 +		 */
 27.3717 +		ctx->ctx_fl_can_restart = 0;
 27.3718 +
 27.3719 +		return 0;
 27.3720 +	}
 27.3721 +
 27.3722 +	/* 
 27.3723 +	 * restart another task
 27.3724 +	 */
 27.3725 +
 27.3726 +	/*
 27.3727 +	 * When PFM_CTX_MASKED, we cannot issue a restart before the previous 
 27.3728 +	 * one is seen by the task.
 27.3729 +	 */
 27.3730 +	if (state == PFM_CTX_MASKED) {
 27.3731 +		if (ctx->ctx_fl_can_restart == 0) return -EINVAL;
 27.3732 +		/*
 27.3733 +		 * will prevent subsequent restart before this one is
 27.3734 +		 * seen by other task
 27.3735 +		 */
 27.3736 +		ctx->ctx_fl_can_restart = 0;
 27.3737 +	}
 27.3738 +
 27.3739 +	/*
 27.3740 +	 * if blocking, then post the semaphore is PFM_CTX_MASKED, i.e.
 27.3741 +	 * the task is blocked or on its way to block. That's the normal
 27.3742 +	 * restart path. If the monitoring is not masked, then the task
 27.3743 +	 * can be actively monitoring and we cannot directly intervene.
 27.3744 +	 * Therefore we use the trap mechanism to catch the task and
 27.3745 +	 * force it to reset the buffer/reset PMDs.
 27.3746 +	 *
 27.3747 +	 * if non-blocking, then we ensure that the task will go into
 27.3748 +	 * pfm_handle_work() before returning to user mode.
 27.3749 +	 *
 27.3750 +	 * We cannot explicitely reset another task, it MUST always
 27.3751 +	 * be done by the task itself. This works for system wide because
 27.3752 +	 * the tool that is controlling the session is logically doing 
 27.3753 +	 * "self-monitoring".
 27.3754 +	 */
 27.3755 +	if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
 27.3756 +		DPRINT(("unblocking [%d] \n", task->pid));
 27.3757 +		complete(&ctx->ctx_restart_done);
 27.3758 +	} else {
 27.3759 +		DPRINT(("[%d] armed exit trap\n", task->pid));
 27.3760 +
 27.3761 +		ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET;
 27.3762 +
 27.3763 +		PFM_SET_WORK_PENDING(task, 1);
 27.3764 +
 27.3765 +		pfm_set_task_notify(task);
 27.3766 +
 27.3767 +		/*
 27.3768 +		 * XXX: send reschedule if task runs on another CPU
 27.3769 +		 */
 27.3770 +	}
 27.3771 +	return 0;
 27.3772 +}
 27.3773 +
 27.3774 +static int
 27.3775 +pfm_debug(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3776 +{
 27.3777 +	unsigned int m = *(unsigned int *)arg;
 27.3778 +	XEN_NOT_SUPPORTED_YET;
 27.3779 +
 27.3780 +	pfm_sysctl.debug = m == 0 ? 0 : 1;
 27.3781 +
 27.3782 +	printk(KERN_INFO "perfmon debugging %s (timing reset)\n", pfm_sysctl.debug ? "on" : "off");
 27.3783 +
 27.3784 +	if (m == 0) {
 27.3785 +		memset(pfm_stats, 0, sizeof(pfm_stats));
 27.3786 +		for(m=0; m < NR_CPUS; m++) pfm_stats[m].pfm_ovfl_intr_cycles_min = ~0UL;
 27.3787 +	}
 27.3788 +	return 0;
 27.3789 +}
 27.3790 +
 27.3791 +/*
 27.3792 + * arg can be NULL and count can be zero for this function
 27.3793 + */
 27.3794 +static int
 27.3795 +pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3796 +{
 27.3797 +	struct thread_struct *thread = NULL;
 27.3798 +	struct task_struct *task;
 27.3799 +	pfarg_dbreg_t *req = (pfarg_dbreg_t *)arg;
 27.3800 +	unsigned long flags;
 27.3801 +	dbreg_t dbreg;
 27.3802 +	unsigned int rnum;
 27.3803 +	int first_time;
 27.3804 +	int ret = 0, state;
 27.3805 +	int i, can_access_pmu = 0;
 27.3806 +	int is_system, is_loaded;
 27.3807 +
 27.3808 +	if (pmu_conf->use_rr_dbregs == 0) return -EINVAL;
 27.3809 +
 27.3810 +	state     = ctx->ctx_state;
 27.3811 +	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 27.3812 +	is_system = ctx->ctx_fl_system;
 27.3813 +	task      = ctx->ctx_task;
 27.3814 +
 27.3815 +	if (state == PFM_CTX_ZOMBIE) return -EINVAL;
 27.3816 +
 27.3817 +	/*
 27.3818 +	 * on both UP and SMP, we can only write to the PMC when the task is
 27.3819 +	 * the owner of the local PMU.
 27.3820 +	 */
 27.3821 +	if (is_loaded) {
 27.3822 +		thread = &task->thread;
 27.3823 +		/*
 27.3824 +		 * In system wide and when the context is loaded, access can only happen
 27.3825 +		 * when the caller is running on the CPU being monitored by the session.
 27.3826 +		 * It does not have to be the owner (ctx_task) of the context per se.
 27.3827 +		 */
 27.3828 +		if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
 27.3829 +			DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.3830 +			return -EBUSY;
 27.3831 +		}
 27.3832 +		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 27.3833 +	}
 27.3834 +
 27.3835 +	/*
 27.3836 +	 * we do not need to check for ipsr.db because we do clear ibr.x, dbr.r, and dbr.w
 27.3837 +	 * ensuring that no real breakpoint can be installed via this call.
 27.3838 +	 *
 27.3839 +	 * IMPORTANT: regs can be NULL in this function
 27.3840 +	 */
 27.3841 +
 27.3842 +	first_time = ctx->ctx_fl_using_dbreg == 0;
 27.3843 +
 27.3844 +	/*
 27.3845 +	 * don't bother if we are loaded and task is being debugged
 27.3846 +	 */
 27.3847 +	if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) {
 27.3848 +		DPRINT(("debug registers already in use for [%d]\n", task->pid));
 27.3849 +		return -EBUSY;
 27.3850 +	}
 27.3851 +
 27.3852 +	/*
 27.3853 +	 * check for debug registers in system wide mode
 27.3854 +	 *
 27.3855 +	 * If though a check is done in pfm_context_load(),
 27.3856 +	 * we must repeat it here, in case the registers are
 27.3857 +	 * written after the context is loaded
 27.3858 +	 */
 27.3859 +	if (is_loaded) {
 27.3860 +		LOCK_PFS(flags);
 27.3861 +
 27.3862 +		if (first_time && is_system) {
 27.3863 +			if (pfm_sessions.pfs_ptrace_use_dbregs)
 27.3864 +				ret = -EBUSY;
 27.3865 +			else
 27.3866 +				pfm_sessions.pfs_sys_use_dbregs++;
 27.3867 +		}
 27.3868 +		UNLOCK_PFS(flags);
 27.3869 +	}
 27.3870 +
 27.3871 +	if (ret != 0) return ret;
 27.3872 +
 27.3873 +	/*
 27.3874 +	 * mark ourself as user of the debug registers for
 27.3875 +	 * perfmon purposes.
 27.3876 +	 */
 27.3877 +	ctx->ctx_fl_using_dbreg = 1;
 27.3878 +
 27.3879 +	/*
 27.3880 + 	 * clear hardware registers to make sure we don't
 27.3881 + 	 * pick up stale state.
 27.3882 +	 *
 27.3883 +	 * for a system wide session, we do not use
 27.3884 +	 * thread.dbr, thread.ibr because this process
 27.3885 +	 * never leaves the current CPU and the state
 27.3886 +	 * is shared by all processes running on it
 27.3887 + 	 */
 27.3888 +	if (first_time && can_access_pmu) {
 27.3889 +		DPRINT(("[%d] clearing ibrs, dbrs\n", task->pid));
 27.3890 +		for (i=0; i < pmu_conf->num_ibrs; i++) {
 27.3891 +			ia64_set_ibr(i, 0UL);
 27.3892 +			ia64_dv_serialize_instruction();
 27.3893 +		}
 27.3894 +		ia64_srlz_i();
 27.3895 +		for (i=0; i < pmu_conf->num_dbrs; i++) {
 27.3896 +			ia64_set_dbr(i, 0UL);
 27.3897 +			ia64_dv_serialize_data();
 27.3898 +		}
 27.3899 +		ia64_srlz_d();
 27.3900 +	}
 27.3901 +
 27.3902 +	/*
 27.3903 +	 * Now install the values into the registers
 27.3904 +	 */
 27.3905 +	for (i = 0; i < count; i++, req++) {
 27.3906 +
 27.3907 +		rnum      = req->dbreg_num;
 27.3908 +		dbreg.val = req->dbreg_value;
 27.3909 +
 27.3910 +		ret = -EINVAL;
 27.3911 +
 27.3912 +		if ((mode == PFM_CODE_RR && rnum >= PFM_NUM_IBRS) || ((mode == PFM_DATA_RR) && rnum >= PFM_NUM_DBRS)) {
 27.3913 +			DPRINT(("invalid register %u val=0x%lx mode=%d i=%d count=%d\n",
 27.3914 +				  rnum, dbreg.val, mode, i, count));
 27.3915 +
 27.3916 +			goto abort_mission;
 27.3917 +		}
 27.3918 +
 27.3919 +		/*
 27.3920 +		 * make sure we do not install enabled breakpoint
 27.3921 +		 */
 27.3922 +		if (rnum & 0x1) {
 27.3923 +			if (mode == PFM_CODE_RR)
 27.3924 +				dbreg.ibr.ibr_x = 0;
 27.3925 +			else
 27.3926 +				dbreg.dbr.dbr_r = dbreg.dbr.dbr_w = 0;
 27.3927 +		}
 27.3928 +
 27.3929 +		PFM_REG_RETFLAG_SET(req->dbreg_flags, 0);
 27.3930 +
 27.3931 +		/*
 27.3932 +		 * Debug registers, just like PMC, can only be modified
 27.3933 +		 * by a kernel call. Moreover, perfmon() access to those
 27.3934 +		 * registers are centralized in this routine. The hardware
 27.3935 +		 * does not modify the value of these registers, therefore,
 27.3936 +		 * if we save them as they are written, we can avoid having
 27.3937 +		 * to save them on context switch out. This is made possible
 27.3938 +		 * by the fact that when perfmon uses debug registers, ptrace()
 27.3939 +		 * won't be able to modify them concurrently.
 27.3940 +		 */
 27.3941 +		if (mode == PFM_CODE_RR) {
 27.3942 +			CTX_USED_IBR(ctx, rnum);
 27.3943 +
 27.3944 +			if (can_access_pmu) {
 27.3945 +				ia64_set_ibr(rnum, dbreg.val);
 27.3946 +				ia64_dv_serialize_instruction();
 27.3947 +			}
 27.3948 +
 27.3949 +			ctx->ctx_ibrs[rnum] = dbreg.val;
 27.3950 +
 27.3951 +			DPRINT(("write ibr%u=0x%lx used_ibrs=0x%x ld=%d apmu=%d\n",
 27.3952 +				rnum, dbreg.val, ctx->ctx_used_ibrs[0], is_loaded, can_access_pmu));
 27.3953 +		} else {
 27.3954 +			CTX_USED_DBR(ctx, rnum);
 27.3955 +
 27.3956 +			if (can_access_pmu) {
 27.3957 +				ia64_set_dbr(rnum, dbreg.val);
 27.3958 +				ia64_dv_serialize_data();
 27.3959 +			}
 27.3960 +			ctx->ctx_dbrs[rnum] = dbreg.val;
 27.3961 +
 27.3962 +			DPRINT(("write dbr%u=0x%lx used_dbrs=0x%x ld=%d apmu=%d\n",
 27.3963 +				rnum, dbreg.val, ctx->ctx_used_dbrs[0], is_loaded, can_access_pmu));
 27.3964 +		}
 27.3965 +	}
 27.3966 +
 27.3967 +	return 0;
 27.3968 +
 27.3969 +abort_mission:
 27.3970 +	/*
 27.3971 +	 * in case it was our first attempt, we undo the global modifications
 27.3972 +	 */
 27.3973 +	if (first_time) {
 27.3974 +		LOCK_PFS(flags);
 27.3975 +		if (ctx->ctx_fl_system) {
 27.3976 +			pfm_sessions.pfs_sys_use_dbregs--;
 27.3977 +		}
 27.3978 +		UNLOCK_PFS(flags);
 27.3979 +		ctx->ctx_fl_using_dbreg = 0;
 27.3980 +	}
 27.3981 +	/*
 27.3982 +	 * install error return flag
 27.3983 +	 */
 27.3984 +	PFM_REG_RETFLAG_SET(req->dbreg_flags, PFM_REG_RETFL_EINVAL);
 27.3985 +
 27.3986 +	return ret;
 27.3987 +}
 27.3988 +
 27.3989 +static int
 27.3990 +pfm_write_ibrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3991 +{
 27.3992 +	return pfm_write_ibr_dbr(PFM_CODE_RR, ctx, arg, count, regs);
 27.3993 +}
 27.3994 +
 27.3995 +static int
 27.3996 +pfm_write_dbrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.3997 +{
 27.3998 +	return pfm_write_ibr_dbr(PFM_DATA_RR, ctx, arg, count, regs);
 27.3999 +}
 27.4000 +
 27.4001 +int
 27.4002 +pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
 27.4003 +{
 27.4004 +	pfm_context_t *ctx;
 27.4005 +
 27.4006 +	if (req == NULL) return -EINVAL;
 27.4007 +
 27.4008 + 	ctx = GET_PMU_CTX();
 27.4009 +
 27.4010 +	if (ctx == NULL) return -EINVAL;
 27.4011 +
 27.4012 +	/*
 27.4013 +	 * for now limit to current task, which is enough when calling
 27.4014 +	 * from overflow handler
 27.4015 +	 */
 27.4016 +	if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
 27.4017 +
 27.4018 +	return pfm_write_ibrs(ctx, req, nreq, regs);
 27.4019 +}
 27.4020 +EXPORT_SYMBOL(pfm_mod_write_ibrs);
 27.4021 +
 27.4022 +int
 27.4023 +pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
 27.4024 +{
 27.4025 +	pfm_context_t *ctx;
 27.4026 +
 27.4027 +	if (req == NULL) return -EINVAL;
 27.4028 +
 27.4029 + 	ctx = GET_PMU_CTX();
 27.4030 +
 27.4031 +	if (ctx == NULL) return -EINVAL;
 27.4032 +
 27.4033 +	/*
 27.4034 +	 * for now limit to current task, which is enough when calling
 27.4035 +	 * from overflow handler
 27.4036 +	 */
 27.4037 +	if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
 27.4038 +
 27.4039 +	return pfm_write_dbrs(ctx, req, nreq, regs);
 27.4040 +}
 27.4041 +EXPORT_SYMBOL(pfm_mod_write_dbrs);
 27.4042 +
 27.4043 +
 27.4044 +static int
 27.4045 +pfm_get_features(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.4046 +{
 27.4047 +	pfarg_features_t *req = (pfarg_features_t *)arg;
 27.4048 +
 27.4049 +	if (is_running_on_xen())
 27.4050 +		return HYPERVISOR_perfmon_op(PFM_GET_FEATURES, &arg, 0);
 27.4051 +	req->ft_version = PFM_VERSION;
 27.4052 +	return 0;
 27.4053 +}
 27.4054 +
 27.4055 +static int
 27.4056 +pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.4057 +{
 27.4058 +	struct pt_regs *tregs;
 27.4059 +	struct task_struct *task = PFM_CTX_TASK(ctx);
 27.4060 +	int state, is_system;
 27.4061 +
 27.4062 +  	if (is_running_on_xen()) {
 27.4063 +		if (is_xenoprof_primary())
 27.4064 +			return HYPERVISOR_perfmon_op(PFM_STOP, NULL, 0);
 27.4065 +		return 0;
 27.4066 +  	}
 27.4067 +
 27.4068 +	state     = ctx->ctx_state;
 27.4069 +	is_system = ctx->ctx_fl_system;
 27.4070 +
 27.4071 +	/*
 27.4072 +	 * context must be attached to issue the stop command (includes LOADED,MASKED,ZOMBIE)
 27.4073 +	 */
 27.4074 +	if (state == PFM_CTX_UNLOADED) return -EINVAL;
 27.4075 +
 27.4076 +	/*
 27.4077 + 	 * In system wide and when the context is loaded, access can only happen
 27.4078 + 	 * when the caller is running on the CPU being monitored by the session.
 27.4079 + 	 * It does not have to be the owner (ctx_task) of the context per se.
 27.4080 + 	 */
 27.4081 +	if (is_system && ctx->ctx_cpu != smp_processor_id()) {
 27.4082 +		DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.4083 +		return -EBUSY;
 27.4084 +	}
 27.4085 +	DPRINT(("task [%d] ctx_state=%d is_system=%d\n",
 27.4086 +		PFM_CTX_TASK(ctx)->pid,
 27.4087 +		state,
 27.4088 +		is_system));
 27.4089 +	/*
 27.4090 +	 * in system mode, we need to update the PMU directly
 27.4091 +	 * and the user level state of the caller, which may not
 27.4092 +	 * necessarily be the creator of the context.
 27.4093 +	 */
 27.4094 +	if (is_system) {
 27.4095 +		/*
 27.4096 +		 * Update local PMU first
 27.4097 +		 *
 27.4098 +		 * disable dcr pp
 27.4099 +		 */
 27.4100 +		ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) & ~IA64_DCR_PP);
 27.4101 +		ia64_srlz_i();
 27.4102 +
 27.4103 +		/*
 27.4104 +		 * update local cpuinfo
 27.4105 +		 */
 27.4106 +		PFM_CPUINFO_CLEAR(PFM_CPUINFO_DCR_PP);
 27.4107 +
 27.4108 +		/*
 27.4109 +		 * stop monitoring, does srlz.i
 27.4110 +		 */
 27.4111 +		pfm_clear_psr_pp();
 27.4112 +
 27.4113 +		/*
 27.4114 +		 * stop monitoring in the caller
 27.4115 +		 */
 27.4116 +		ia64_psr(regs)->pp = 0;
 27.4117 +
 27.4118 +		return 0;
 27.4119 +	}
 27.4120 +	/*
 27.4121 +	 * per-task mode
 27.4122 +	 */
 27.4123 +
 27.4124 +	if (task == current) {
 27.4125 +		/* stop monitoring  at kernel level */
 27.4126 +		pfm_clear_psr_up();
 27.4127 +
 27.4128 +		/*
 27.4129 +	 	 * stop monitoring at the user level
 27.4130 +	 	 */
 27.4131 +		ia64_psr(regs)->up = 0;
 27.4132 +	} else {
 27.4133 +		tregs = task_pt_regs(task);
 27.4134 +
 27.4135 +		/*
 27.4136 +	 	 * stop monitoring at the user level
 27.4137 +	 	 */
 27.4138 +		ia64_psr(tregs)->up = 0;
 27.4139 +
 27.4140 +		/*
 27.4141 +		 * monitoring disabled in kernel at next reschedule
 27.4142 +		 */
 27.4143 +		ctx->ctx_saved_psr_up = 0;
 27.4144 +		DPRINT(("task=[%d]\n", task->pid));
 27.4145 +	}
 27.4146 +	return 0;
 27.4147 +}
 27.4148 +
 27.4149 +
 27.4150 +static int
 27.4151 +pfm_start(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.4152 +{
 27.4153 +	struct pt_regs *tregs;
 27.4154 +	int state, is_system;
 27.4155 +
 27.4156 +  	if (is_running_on_xen()) {
 27.4157 +		if (is_xenoprof_primary())
 27.4158 +			return HYPERVISOR_perfmon_op(PFM_START, NULL, 0);
 27.4159 +		return 0;
 27.4160 +  	}
 27.4161 +	state     = ctx->ctx_state;
 27.4162 +	is_system = ctx->ctx_fl_system;
 27.4163 +
 27.4164 +	if (state != PFM_CTX_LOADED) return -EINVAL;
 27.4165 +
 27.4166 +	/*
 27.4167 + 	 * In system wide and when the context is loaded, access can only happen
 27.4168 + 	 * when the caller is running on the CPU being monitored by the session.
 27.4169 + 	 * It does not have to be the owner (ctx_task) of the context per se.
 27.4170 + 	 */
 27.4171 +	if (is_system && ctx->ctx_cpu != smp_processor_id()) {
 27.4172 +		DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
 27.4173 +		return -EBUSY;
 27.4174 +	}
 27.4175 +
 27.4176 +	/*
 27.4177 +	 * in system mode, we need to update the PMU directly
 27.4178 +	 * and the user level state of the caller, which may not
 27.4179 +	 * necessarily be the creator of the context.
 27.4180 +	 */
 27.4181 +	if (is_system) {
 27.4182 +
 27.4183 +		/*
 27.4184 +		 * set user level psr.pp for the caller
 27.4185 +		 */
 27.4186 +		ia64_psr(regs)->pp = 1;
 27.4187 +
 27.4188 +		/*
 27.4189 +		 * now update the local PMU and cpuinfo
 27.4190 +		 */
 27.4191 +		PFM_CPUINFO_SET(PFM_CPUINFO_DCR_PP);
 27.4192 +
 27.4193 +		/*
 27.4194 +		 * start monitoring at kernel level
 27.4195 +		 */
 27.4196 +		pfm_set_psr_pp();
 27.4197 +
 27.4198 +		/* enable dcr pp */
 27.4199 +		ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) | IA64_DCR_PP);
 27.4200 +		ia64_srlz_i();
 27.4201 +
 27.4202 +		return 0;
 27.4203 +	}
 27.4204 +
 27.4205 +	/*
 27.4206 +	 * per-process mode
 27.4207 +	 */
 27.4208 +
 27.4209 +	if (ctx->ctx_task == current) {
 27.4210 +
 27.4211 +		/* start monitoring at kernel level */
 27.4212 +		pfm_set_psr_up();
 27.4213 +
 27.4214 +		/*
 27.4215 +		 * activate monitoring at user level
 27.4216 +		 */
 27.4217 +		ia64_psr(regs)->up = 1;
 27.4218 +
 27.4219 +	} else {
 27.4220 +		tregs = task_pt_regs(ctx->ctx_task);
 27.4221 +
 27.4222 +		/*
 27.4223 +		 * start monitoring at the kernel level the next
 27.4224 +		 * time the task is scheduled
 27.4225 +		 */
 27.4226 +		ctx->ctx_saved_psr_up = IA64_PSR_UP;
 27.4227 +
 27.4228 +		/*
 27.4229 +		 * activate monitoring at user level
 27.4230 +		 */
 27.4231 +		ia64_psr(tregs)->up = 1;
 27.4232 +	}
 27.4233 +	return 0;
 27.4234 +}
 27.4235 +
 27.4236 +static int
 27.4237 +pfm_get_pmc_reset(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.4238 +{
 27.4239 +	pfarg_reg_t *req = (pfarg_reg_t *)arg;
 27.4240 +	unsigned int cnum;
 27.4241 +	int i;
 27.4242 +	int ret = -EINVAL;
 27.4243 +	XEN_NOT_SUPPORTED_YET;
 27.4244 +
 27.4245 +	for (i = 0; i < count; i++, req++) {
 27.4246 +
 27.4247 +		cnum = req->reg_num;
 27.4248 +
 27.4249 +		if (!PMC_IS_IMPL(cnum)) goto abort_mission;
 27.4250 +
 27.4251 +		req->reg_value = PMC_DFL_VAL(cnum);
 27.4252 +
 27.4253 +		PFM_REG_RETFLAG_SET(req->reg_flags, 0);
 27.4254 +
 27.4255 +		DPRINT(("pmc_reset_val pmc[%u]=0x%lx\n", cnum, req->reg_value));
 27.4256 +	}
 27.4257 +	return 0;
 27.4258 +
 27.4259 +abort_mission:
 27.4260 +	PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
 27.4261 +	return ret;
 27.4262 +}
 27.4263 +
 27.4264 +static int
 27.4265 +pfm_check_task_exist(pfm_context_t *ctx)
 27.4266 +{
 27.4267 +	struct task_struct *g, *t;
 27.4268 +	int ret = -ESRCH;
 27.4269 +
 27.4270 +	read_lock(&tasklist_lock);
 27.4271 +
 27.4272 +	do_each_thread (g, t) {
 27.4273 +		if (t->thread.pfm_context == ctx) {
 27.4274 +			ret = 0;
 27.4275 +			break;
 27.4276 +		}
 27.4277 +	} while_each_thread (g, t);
 27.4278 +
 27.4279 +	read_unlock(&tasklist_lock);
 27.4280 +
 27.4281 +	DPRINT(("pfm_check_task_exist: ret=%d ctx=%p\n", ret, ctx));
 27.4282 +
 27.4283 +	return ret;
 27.4284 +}
 27.4285 +
 27.4286 +static int
 27.4287 +pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
 27.4288 +{
 27.4289 +	struct task_struct *task;
 27.4290 +	struct thread_struct *thread;
 27.4291 +	struct pfm_context_t *old;
 27.4292 +	unsigned long flags;
 27.4293 +#ifndef CONFIG_SMP
 27.4294 +	struct task_struct *owner_task = NULL;
 27.4295 +#endif
 27.4296 +	pfarg_load_t *req = (pfarg_load_t *)arg;
 27.4297 +	unsigned long *pmcs_source, *pmds_source;
 27.4298 +	int the_cpu;
 27.4299 +	int ret = 0;
 27.4300 +	int state, is_system, set_dbregs = 0;
 27.4301 +
 27.4302 +  	if (is_running_on_xen()) {
 27.4303 +		if (is_xenoprof_primary())
 27.4304 +			return HYPERVISOR_perfmon_op(PFM_LOAD_CONTEXT, arg, 0);
 27.4305 +		return 0;
 27.4306 +  	}
 27.4307 +	state     = ctx->ctx_state;
 27.4308 +	is_system = ctx->ctx_fl_system;
 27.4309 +	/*
 27.4310 +	 * can only load from unloaded or terminated state
 27.4311 +	 */
 27.4312 +	if (state != PFM_CTX_UNLOADED) {
 27.4313 +		DPRINT(("cannot load to [%d], invalid ctx_state=%d\n",
 27.4314 +			req->load_pid,
 27.4315 +			ctx->ctx_state));
 27.4316 +		return -EBUSY;
 27.4317 +	}
 27.4318 +
 27.4319 +	DPRINT(("load_pid [%d] using_dbreg=%d\n", req->load_pid, ctx->ctx_fl_using_dbreg));
 27.4320 +
 27.4321 +	if (CTX_OVFL_NOBLOCK(ctx) == 0 && req->load_pid == current->pid) {
 27.4322 +		DPRINT(("cannot use blocking mode on self\n"));
 27.4323 +		return -EINVAL;
 27.4324 +	}
 27.4325 +
 27.4326 +	ret = pfm_get_task(ctx, req->load_pid, &task);
 27.4327 +	if (ret) {
 27.4328 +		DPRINT(("load_pid [%d] get_task=%d\n", req->load_pid, ret));
 27.4329 +		return ret;
 27.4330 +	}
 27.4331 +
 27.4332 +	ret = -EINVAL;
 27.4333 +
 27.4334 +	/*
 27.4335 +	 * system wide is self monitoring only
 27.4336 +	 */
 27.4337 +	if (is_system && task != current) {
 27.4338 +		DPRINT(("system wide is self monitoring only load_pid=%d\n",
 27.4339 +			req->load_pid));
 27.4340 +		goto error;
 27.4341 +	}
 27.4342 +
 27.4343 +	thread = &task->thread;
 27.4344 +
 27.4345 +	ret = 0;
 27.4346 +	/*
 27.4347 +	 * cannot load a context which is using range restrictions,
 27.4348 +	 * into a task that is being debugged.
 27.4349 +	 */
 27.4350 +	if (ctx->ctx_fl_using_dbreg) {
 27.4351 +		if (thread->flags & IA64_THREAD_DBG_VALID) {
 27.4352 +			ret = -EBUSY;
 27.4353 +			DPRINT(("load_pid [%d] task is debugged, cannot load range restrictions\n", req->load_pid));
 27.4354 +			goto error;
 27.4355 +		}
 27.4356 +		LOCK_PFS(flags);
 27.4357 +
 27.4358 +		if (is_system) {
 27.4359 +			if (pfm_sessions.pfs_ptrace_use_dbregs) {
 27.4360 +				DPRINT(("cannot load [%d] dbregs in use\n", task->pid));
 27.4361 +				ret = -EBUSY;
 27.4362 +			} else {
 27.4363 +				pfm_sessions.pfs_sys_use_dbregs++;
 27.4364 +				DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task->pid, pfm_sessions.pfs_sys_use_dbregs));
 27.4365