一个简单的 SYSENTER/SYSCALL 问题

发布于 2024-08-09 05:43:06 字数 155 浏览 1 评论 0原文

如果 Windows 可执行文件使用 SYSENTER 并在实现 AMD64 ISA 的处理器上执行,会发生什么?我对这个主题(操作系统、硬件/软件交互)既是新手又是新手,但从我读过的内容来看,我了解到 SYSCALL 是相当于 Intel SYSENTER 的 AMD64。希望这个问题有意义。

If a Windows executable makes use of SYSENTER and is executed on a processor implementing AMD64 ISA, what happens? I am both new and newbie to this topic (OSes, hardware/software interaction) but from what I've read I have understood that SYSCALL is the AMD64 equivalent to Intel's SYSENTER. Hopefully this question makes sense.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

少女的英雄梦 2024-08-16 05:43:06

如果您尝试在不支持的地方使用 SYSENTER,您可能会收到“无效操作码”异常。
请注意,这种情况并不常见 - 通常,Windows 可执行文件不直接包含进入内核模式的指令。

If you try to use SYSENTER where it is not supported, you'll probably get an "invalid opcode" exception.
Note that this situation is unusual - generally, Windows executables do not directly contain instructions to enter kernel mode.

叹沉浮 2024-08-16 05:43:06

据我所知,AM64 处理器使用不同类型的模式来处理此类问题。

SYSENTER 工作正常,但速度不是那么快。

一个非常有用的网站,可以帮助您开始了解不同的模式:
维基百科

As far as i know AM64 processors using different type of modes to handle such issues.

SYSENTER works fine but is not that fast.

A very useful site to get started about the different modes:
Wikipedia

画尸师 2024-08-16 05:43:06

他们在开发 AMD64 扩展时去掉了一堆未使用的功能。主要的变化之一是消除 cs、ds、es 和 ss 段寄存器。通常加载段寄存器是一个极其昂贵的操作(CPU 必须进行权限检查,这可能涉及多次内存访问)。进入内核模式需要加载新的段寄存器值。

SYSENTER 指令通过一组“影子寄存器”来加速这一过程,这些寄存器可以直接复制到(内部、隐藏)段描述符,而无需执行任何权限检查。仅使用几个段寄存器就失去了绝大多数好处,因此取消对指令支持的最有可能的原因是使用常规指令进行模式切换速度更快。

They got rid of a bunch of unused functionality when they developed AMD64 extensions. One of the main ones is the elimination of the cs, ds, es, and ss segment registers. Normally loading segment registers is an extremely expensive operation (the CPU has to do permission checks, which could involve multiple memory accesses). Entering kernel mode requires loading new segment register values.

The SYSENTER instruction accelerates this by having a set of "shadow registers" which is can copy directly to the (internal, hidden) segment descriptors without doing any permission checks. The vast majority of the benefit is lost with only a couple of segment registers, so most likely the reasoning for removing the support for the instructions is that using regular instructions for the mode switch is faster.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文