近指针的隐式段寄存器是如何确定的?

发布于 2024-09-02 11:41:52 字数 583 浏览 4 评论 0原文

英特尔 64® 和 IA-32 架构软件开发人员手册的第 4.3 节中。第一卷:基础架构,它说:

近指针是段内的 32 位偏移量。近指针用于平面内存模型中的所有内存引用或分段模型中的引用,其中隐含了正在访问的段的标识。

这让我想知道:隐含的段寄存器是如何确定的?

我知道 (%eip) 和移位的 (%eip) (例如 -4(%eip))地址使用 %cs 默认情况下,(%esp) 和移位的 (%esp) 地址使用 %ss,但是 又如何呢? >(%eax)(%edx)(%edi)(%ebp) 等,并且可以隐式段寄存器还取决于内存地址操作数出现的指令?

In section 4.3 of Intel 64® and IA-32 Architectures Software Developer's Manual. Volume 1: Basic Architecture, it says:

A near pointer is a 32-bit offset ... within a segment. Near pointers are used for all memory references in a flat memory model or for references in a segmented model where the identity of the segment being accessed is implied.

This leads me to wondering: how is the implied segment register determined?

I know that (%eip) and displaced (%eip) (e.g. -4(%eip)) addresses use %cs by default, and that (%esp) and displaced (%esp) addresses use %ss, but what about (%eax), (%edx), (%edi), (%ebp) etc., and can the implicit segment register depend also on the instruction that the memory address operand appears in?

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

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

发布评论

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

评论(1

柒七 2024-09-09 11:41:52

除了您提到的 CSSS 寄存器访问之外,大多数其他访问都将使用 DS 段寄存器。我记得有几个例外:

  • 面向字符串的指令将使用 ES 进行“目标”(由 EDI 寄存器隐式寻址)段寄存器
  • 内存访问,使用EBP 寄存器作为“基地址”寄存器将使用SS 段寄存器。但是,如果将EBP寄存器用作缩放索引寄存器,则使用的段将为DS(除非基址寄存器为ESP

Other than CS and SS register accesses that you mentioned, most other accesses will use the DS segment register. A couple exceptions that I can recall:

  • the string-oriented instructions will use the ES for the 'destination' (implicitly addressed by the EDI register) segment register
  • memory accesses using the EBP register as a 'base address' register will use the SS segment register. However, if the EBP register is used as a scaled index register, the segment used will be DS (unless the base address register is ESP)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文