Blame doc/man/pt_iscache_read.3.md

Packit b1f7ae
% PT_ISCACHE_READ(3)
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
 ! Copyright (c) 2015-2017, Intel Corporation
Packit b1f7ae
 !
Packit b1f7ae
 ! Redistribution and use in source and binary forms, with or without
Packit b1f7ae
 ! modification, are permitted provided that the following conditions are met:
Packit b1f7ae
 !
Packit b1f7ae
 !  * Redistributions of source code must retain the above copyright notice,
Packit b1f7ae
 !    this list of conditions and the following disclaimer.
Packit b1f7ae
 !  * Redistributions in binary form must reproduce the above copyright notice,
Packit b1f7ae
 !    this list of conditions and the following disclaimer in the documentation
Packit b1f7ae
 !    and/or other materials provided with the distribution.
Packit b1f7ae
 !  * Neither the name of Intel Corporation nor the names of its contributors
Packit b1f7ae
 !    may be used to endorse or promote products derived from this software
Packit b1f7ae
 !    without specific prior written permission.
Packit b1f7ae
 !
Packit b1f7ae
 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit b1f7ae
 ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit b1f7ae
 ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit b1f7ae
 ! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
Packit b1f7ae
 ! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Packit b1f7ae
 ! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Packit b1f7ae
 ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit b1f7ae
 ! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Packit b1f7ae
 ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Packit b1f7ae
 ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Packit b1f7ae
 ! POSSIBILITY OF SUCH DAMAGE.
Packit b1f7ae
 !-->
Packit b1f7ae
Packit b1f7ae
# NAME
Packit b1f7ae
Packit b1f7ae
pt_iscache_read - read memory from a cached file section
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
# SYNOPSIS
Packit b1f7ae
Packit b1f7ae
| **\#include `<intel-pt.h>`**
Packit b1f7ae
|
Packit b1f7ae
| **int pt_iscache_read(struct pt_image_section_cache \**iscache*,**
Packit b1f7ae
|                     **uint8_t \**buffer*, uint64_t *size*, int *isid*,**
Packit b1f7ae
|                     **uint64_t *vaddr*);**
Packit b1f7ae
Packit b1f7ae
Link with *-lipt*.
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
# DESCRIPTION
Packit b1f7ae
Packit b1f7ae
**pt_iscache_read**() reads memory from a cached file section.  The file section
Packit b1f7ae
must have previously been added by a call to **pt_iscache_add**(3).  The
Packit b1f7ae
*iscache* argument points to the *pt_image_section_cache* object.  It must be
Packit b1f7ae
the same that was used in the corresponding **pt_iscache_add**(3) call.  The
Packit b1f7ae
*buffer* argument must point to a memory buffer of at least *size* bytes.  The
Packit b1f7ae
*isid* argument identifies the file section from which memory is read.  It must
Packit b1f7ae
be the same identifier that was returned from the corresponding
Packit b1f7ae
**pt_iscache_add**(3) call that added the file section to the cache.  The *vaddr*
Packit b1f7ae
argument gives the virtual address from which *size* bytes of memory shall be
Packit b1f7ae
read.
Packit b1f7ae
Packit b1f7ae
On success, **pt_iscache_read**() copies at most *size* bytes of memory from the
Packit b1f7ae
cached file section identified by *isid* in *iscache* starting at virtual
Packit b1f7ae
address *vaddr* into *buffer* and returns the number of bytes that were copied.
Packit b1f7ae
Packit b1f7ae
Multiple calls to **pt_iscache_read**() may be necessary if *size* is bigger
Packit b1f7ae
than 4Kbyte or if the read crosses a section boundary.
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
# RETURN VALUE
Packit b1f7ae
Packit b1f7ae
**pt_iscache_read**() returns the number of bytes that were read on success
Packit b1f7ae
or a negative *pt_error_code* enumeration constant in case of an error.
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
# ERRORS
Packit b1f7ae
Packit b1f7ae
pte_invalid
Packit b1f7ae
:   The *iscache* or *buffer* argument is NULL or the *size* argument is zero.
Packit b1f7ae
Packit b1f7ae
pte_bad_image
Packit b1f7ae
:   The *iscache* does not contain a section identified by *isid*.
Packit b1f7ae
Packit b1f7ae
pte_nomap
Packit b1f7ae
:   The *vaddr* argument lies outside of the virtual address range of the cached
Packit b1f7ae
    section.
Packit b1f7ae
Packit b1f7ae
Packit b1f7ae
# SEE ALSO
Packit b1f7ae
Packit b1f7ae
**pt_iscache_alloc**(3), **pt_iscache_free**(3), **pt_iscache_add**(3)