Created
June 25, 2020 07:33
-
-
Save nhoriguchi/885e50425e5fac205f306425f710d4d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env stap | |
# Usage: ./get_dev_mem.stp -g <pfn> | |
%{ | |
#include "../../../arch/x86/include/asm/page_64.h" | |
#include "../../../arch/x86/include/asm/io.h" | |
%} | |
function get_dev_mem (addr:long) %{ | |
unsigned long addr = (unsigned long)STAP_ARG_addr << 12; | |
unsigned long virt; | |
unsigned long tmp = 0; | |
virt = (unsigned long)phys_to_virt(addr); | |
for (; tmp < 4096; tmp = tmp + 32) { | |
_stp_printf("0x%lx %lx %lx %lx %lx\n", addr + tmp, | |
*(unsigned long *)(virt + tmp), | |
*(unsigned long *)(virt + tmp + 8), | |
*(unsigned long *)(virt + tmp + 16), | |
*(unsigned long*)(virt + tmp + 24)); | |
} | |
%} | |
probe begin { | |
get_dev_mem($1) | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment