summaryrefslogtreecommitdiffstats
path: root/kmod/cachepc.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-08-19 13:50:26 +0200
committerLouis Burda <quent.burda@gmail.com>2022-08-19 13:50:26 +0200
commit0a98557023804f047f54875817dedc4aa431d899 (patch)
tree14b14ee05e84a502e351ae4af0f833e300fba69c /kmod/cachepc.c
parent329e7d4740bac8b740583dd68108ab9d3d0c06b7 (diff)
downloadcachepc-0a98557023804f047f54875817dedc4aa431d899.tar.gz
cachepc-0a98557023804f047f54875817dedc4aa431d899.zip
Inline prime and probe into vmenter.S for better accuracy
Diffstat (limited to 'kmod/cachepc.c')
-rwxr-xr-xkmod/cachepc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kmod/cachepc.c b/kmod/cachepc.c
index 1dcb764..63500a5 100755
--- a/kmod/cachepc.c
+++ b/kmod/cachepc.c
@@ -16,6 +16,22 @@ static void build_randomized_list_for_cache_set(cache_ctx *ctx, cacheline **cach
static cacheline **allocate_cache_ds(cache_ctx *ctx);
static uint16_t get_virt_cache_set(cache_ctx *ctx, void *ptr);
+cacheline *cachepc_prime_cl = NULL;
+
+void
+cachepc_prime_vcall(uintptr_t ret, cacheline *cl)
+{
+ cachepc_prime(cl);
+ asm volatile ("mov %0, %%rax; jmp *%%rax" : : "r"(ret) : "rax");
+}
+
+void
+cachepc_probe_vcall(uintptr_t ret, cacheline *cl)
+{
+ cachepc_probe(cl);
+ asm volatile ("mov %0, %%rax; jmp *%%rax" : : "r"(ret) : "rax");
+}
+
void
cachepc_init_pmc(uint8_t index, uint8_t event_no, uint8_t event_mask)
{