#asahi-re · 2022-05-19 16:52
haichenzhou[m]Sure, I will have a try.#asahi-re · 2022-05-19 16:50
haichenzhou[m]registers a syscall, thus I can simply use inline assembly to get the value of certain system register. But as you show, there is already a driver with good functionalities. Could I just used the driver in userspace? (like what perf executable does?).#asahi-re · 2022-05-19 16:50
haichenzhou[m]I still don't understand how to access the driver or use my own kernel module from userspace. (Sorry I'm really a newbie into kernel). What I want to do is fuzzing all the event_id based on whether certain code is runned (either causing loads of cache hit or no cache hit), to determine which id is related to certain event. I'm not sure if that is doable and how to do that. My initial guess was that I could make a kernel module which#asahi-re · 2022-05-19 16:50
haichenzhou[m] * Thanks, it seems that the msr name i used was ARM's and Apple does have a different name. Now I successfully read the content in my kernel module.#asahi-re · 2022-05-19 16:45
haichenzhou[m]I still don't understand how to access the driver or use my own kernel module from userspace. (Sorry I'm really a newbie into kernel). What I want to do is fuzzing all the event_id based on whether certain code is runned (either causing loads of cache hit or no cache hit), to determine which id is related to certain event. I'm not sure if that is doable and how to do that. My initial guess was that I could make a kernel module which#asahi-re · 2022-05-19 16:45
haichenzhou[m]registers a syscall, thus I can simply use inline assembly to get the value of certain system register. But as you show, there is already a driver with good functionalities. Could I just used the driver in userspace? (like perf executable do?).#asahi-re · 2022-05-19 16:45
haichenzhou[m]Thanks, it seems that the msr name i used was ARM's and Apple does have a different name. Now I successfully read the content in my kernel module. #asahi-re · 2022-05-19 15:52
haichenzhou[m]I'm currently reversing the M1 performance counters. when I execute `mrs pmuserenr_el0, 0xf` to enable user space access to performance counter, there is an illegal instruction error. I'm not sure if that is because both msr and mrs instruction can only be used under R0. So what I need to do is using a kernel module to read the performance counters? #asahi-re · 2022-05-19 15:46
haichenzhou[m]is it possible to read the performance counters from user space on M1?