Commit a0db8722 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig

Cleanup

parent db2a76b4
......@@ -150,39 +150,3 @@ struct panwrap_mapped_memory *panwrap_find_mapped_mem(void *addr)
return NULL;
}
struct panwrap_mapped_memory *panwrap_find_mapped_mem_containing(void *addr)
{
struct panwrap_mapped_memory *pos;
list_for_each_entry(pos, &mmaps, node) {
if (addr >= pos->addr && addr < pos->addr + pos->length)
return pos;
}
return NULL;
}
struct panwrap_mapped_memory *panwrap_find_mapped_gpu_mem(mali_ptr addr)
{
struct panwrap_mapped_memory *pos;
list_for_each_entry(pos, &mmaps, node) {
if (pos->gpu_va == addr)
return pos;
}
return NULL;
}
struct panwrap_mapped_memory *panwrap_find_mapped_gpu_mem_containing(mali_ptr addr)
{
struct panwrap_mapped_memory *pos;
list_for_each_entry(pos, &mmaps, node) {
if (addr >= pos->gpu_va && addr < pos->gpu_va + pos->length)
return pos;
}
return NULL;
}
......@@ -41,65 +41,16 @@ struct panwrap_mapped_memory {
int allocation_number;
char name[32];
bool* touched;
struct list node;
};
void replay_memory();
void replay_memory_specific(struct panwrap_mapped_memory *pos, int offset, int len);
char *pointer_as_memory_reference(mali_ptr ptr);
void panwrap_track_allocation(mali_ptr gpu_va, int flags, int number, size_t length);
void panwrap_track_mmap(mali_ptr gpu_va, void *addr, size_t length,
int prot, int flags);
void panwrap_track_munmap(void *addr);
struct panwrap_mapped_memory *panwrap_find_mapped_mem(void *addr);
struct panwrap_mapped_memory *panwrap_find_mapped_mem_containing(void *addr);
struct panwrap_mapped_memory *panwrap_find_mapped_gpu_mem(mali_ptr addr);
struct panwrap_mapped_memory *panwrap_find_mapped_gpu_mem_containing(mali_ptr addr);
void panwrap_assert_gpu_same(const struct panwrap_mapped_memory *mem,
mali_ptr gpu_va, size_t size,
const unsigned char *data);
void panwrap_assert_gpu_mem_zero(const struct panwrap_mapped_memory *mem,
mali_ptr gpu_va, size_t size);
void __attribute__((noreturn))
__panwrap_fetch_mem_err(const struct panwrap_mapped_memory *mem,
mali_ptr gpu_va, size_t size,
int line, const char *filename);
static inline void *
__panwrap_fetch_gpu_mem(const struct panwrap_mapped_memory *mem,
mali_ptr gpu_va, size_t size,
int line, const char *filename)
{
if (!mem)
mem = panwrap_find_mapped_gpu_mem_containing(gpu_va);
if (!mem ||
size + (gpu_va - mem->gpu_va) > mem->length ||
!(mem->prot & MALI_MEM_PROT_CPU_RD))
__panwrap_fetch_mem_err(mem, gpu_va, size, line, filename);
return mem->addr + gpu_va - mem->gpu_va;
}
#define panwrap_fetch_gpu_mem(mem, gpu_va, size) \
__panwrap_fetch_gpu_mem(mem, gpu_va, size, __LINE__, __FILE__)
/* Returns a validated pointer to mapped GPU memory with the given pointer type,
* size automatically determined from the pointer type
*/
#define PANWRAP_PTR(mem, gpu_va, type) \
((type*)(__panwrap_fetch_gpu_mem(mem, gpu_va, sizeof(type), \
__LINE__, __FILE__)))
/* Usage: <variable type> PANWRAP_PTR_VAR(name, mem, gpu_va) */
#define PANWRAP_PTR_VAR(name, mem, gpu_va) \
name = __panwrap_fetch_gpu_mem(mem, gpu_va, sizeof(*name), \
__LINE__, __FILE__)
void replay_memory(void);
#endif /* __MMAP_TRACE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment