Context switch in kernel module?

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

Context switch in kernel module?

Postby pwnorz » Mon Oct 14, 2019 3:13 am

I'd like to develop and kernel extensions on mac OS. But I have no idea how to get notified when a context switch happened in the specified task, without modification of the kernel source code.

Since all I need is to store/restore the Mode Specific Registers when a context switch happened.

Does anyone have an idea?
pwnorz
 
Posts: 1
Joined: Tue Sep 10, 2019 4:18 am

Re: Context switch in kernel module?

Postby morpheus » Mon Oct 14, 2019 7:36 pm

Sorry to disappoint you, but it's not really feasible, primarily because if you yourself get context switched you won't know about it. That said, the best way which springs to mind to get notifications without modifying the kernel directly, is listen on kdebug (MACH_SCHED) notifications.
morpheus
Site Admin
 
Posts: 731
Joined: Thu Apr 11, 2013 6:24 pm


Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 4 guests