如何从 OSX 上的用户空间写入 x86 调试寄存器?
我想在我的 OSX 用户空间程序中使用 x86 规范 (DR0-7) 中定义的调试 MSR。不幸的是,这些需要 CPL == 0(又名环 0)。我翻阅了 OSX 系统调用,除了 kernel_debug
之外,没有什么真正跳出来作为访问这些系统调用的方法。
可能情况是,它们只能通过一些更高级别的接口(如kernel_debug)使用,但我不清楚是否是这种情况,或者我只是还没有找到访问它们的魔法调用。
我的最终目标是访问这些寄存器的功能,而不是寄存器本身。有谁知道如何做设置硬件断点之类的事情?
I'd like to play around with the debug MSRs defined in the x86 spec (DR0-7) from my OSX user-space program. Unfortunately, these require CPL == 0 (aka ring 0). I've thumbed through the OSX syscalls and with the exception of kernel_debug
nothing really jumps out as a way to access these.
It may be the case that they are only available via some higher level interface like kernel_debug
, but it's unclear to me if that's the case or if I just haven't found the magic invocation to get to them.
My end goal is accessing the functionality of these registers, not the registers themselves. Does anyone have insight on how to do things like set hardware breakpoints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明
thread_get_state
/thread_set_state
就是答案。It turns out
thread_get_state
/thread_set_state
is the answer.这几乎就是ring 0 指令的要点。 它们无法从用户空间访问。
That's pretty much the point of ring 0 instructions. They are not accessible from userspace.