PT_ISCACHE_READ(3)
π PT_ISCACHE_READ(3) π
okay bestie, gather round, because we're reading memory out of a cached file section and it's actually so much fun, no cap. this is pt_iscache_read, section 3 of the manual (the library-calls girlies), from the intel-pt headers. let's get into it π¦
β¨ NAME β¨
pt_iscache_read β read memory from a cached file section π
πΈ SYNOPSIS πΈ
#include <intel-pt.h>
int pt_iscache_read(struct pt_image_section_cache *iscache,
uint8_t *buffer, uint64_t size, int isid,
uint64_t vaddr);
Link with -lipt.
π DESCRIPTION π
so pt_iscache_read() reads memory from a cached file section. and like, the file section has to have been added beforehand by a call to pt_iscache_add(3) β you can't just roll up and read a section that isn't in the cache, that's not the vibe. π«
here's the cast of characters, lowkey iconic each one:
- the
iscacheargument points to thept_image_section_cacheobject. it has to be the same one that was used in the correspondingpt_iscache_add(3)call. same cache, same energy, periodt. - the
bufferargument must point to a memory buffer of at leastsizebytes. big enough or don't bother bestie. - the
isidargument identifies the file section we're reading memory from. it must be the same identifier that was returned from the correspondingpt_iscache_add(3)call that added the file section to the cache. matching IDs only, it's giving loyalty. π - the
vaddrargument gives the virtual address from whichsizebytes of memory shall be read.
on success, pt_iscache_read() copies at most size bytes of memory from the cached file section identified by isid in iscache, starting at virtual address vaddr, into buffer β and then it returns the number of bytes that were actually copied. at most, bestie. remember that word, it comes back around. π
and heads up: multiple calls topt_iscache_read()may be necessary ifsizeis bigger than4Kbyteor if the read crosses a section boundary. so if your size is giving huge, you're gonna need to loop it. one call is not gonna eat the whole thing, iykyk. π
π RETURN VALUE π
pt_iscache_read() returns the number of bytes that were read on success π, or a negative pt_error_code enumeration constant in case of an error π.
π₯ ERRORS π₯
pte_invalidβ theiscacheorbufferargument isNULL, or thesizeargument is zero. basically: null pointers and zero-size reads are not invited to the function. πpte_bad_imageβ theiscachedoes not contain a section identified byisid. that ID? not in this cache. ghosted fr fr.pte_nomapβ thevaddrargument lies outside of the virtual address range of the cached section. you asked for an address that section doesn't cover, bestie, it's simply not there. π
π SEE ALSO π
pt_iscache_alloc(3)pt_iscache_free(3)pt_iscache_add(3)
and that's the whole page, mwah π β this was PT_ISCACHE_READ(3) from the intel-pt library docs, section 3, and yes she's iconic for a reason. go forth and read your cached sections, you absolute main character π«Άβ¨
π¦ where this page comes from
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms