注册 登录
编程论坛 汇编论坛

存储器指针起什么作用?

THthen 发布于 2012-03-04 10:53, 926 次点击
对偏移起作用?
菜鸟表示很苦B……
17 回复
#2
THthen2012-03-04 11:06
有么的人啥?……
#3
zaixuexi2012-03-04 11:18
不知道你在说什么
指针就是指向一个有效地址,用来寻址
存储器就是内存
综上,存储器指针=>内存中指向有效地址的变量,和偏移有鸟关系?
#4
THthen2012-03-04 12:11
回复 3楼 zaixuexi
恩,还是迷迷糊糊
#5
zklhp2012-03-04 12:24
你说的这个存储器指针就是8086里的ip 用于存放下一条指令的地址

对于8086 存的就是下一条指令的偏移量 因为段由cs寄存器指示
#6
zklhp2012-03-04 12:25
我理解的这个存储器指针就是指令指针 就是ip 不知道你打哪看的这玩意 如果觉得我说的不会欢迎提供上下文信息~
#7
THthen2012-03-04 12:32
回复 6楼 zklhp
书上写的SI、DI、BP、BX寄存器的主要用途中,都包括了一条:存储器指针。
#8
zklhp2012-03-04 12:43
我知道啥意思了 但这个意思好复杂啊 开始学不要管这个。。。

如果想知道详细信息看intel手册中如下部分及相关内容

你可能会说看不懂 那就不要管这个概念了 记住寄存器的用法就好了

The special uses of general-purpose registers by instructions are described in
Chapter 5, “Instruction Set Summary,” in this volume. See also: Chapter 3 and
Chapter 4 of Intel® 64 and IA-32 Architectures Software Developer’s Manual,
Volumes 2A & 2B. The following is a summary of special uses:
• EAX — Accumulator for operands and results data
• EBX — Pointer to data in the DS segment
• ECX — Counter for string and loop operations
• EDX — I/O pointer
• ESI — Pointer to data in the segment pointed to by the DS register; source
pointer for string operations
• EDI — Pointer to data (or destination) in the segment pointed to by the ES
register; destination pointer for string operations
• ESP — Stack pointer (in the SS segment)
• EBP — Pointer to data on the stack (in the SS segment)
As shown in Figure 3-5, the lower 16 bits of the general-purpose registers map
directly to the register set found in the 8086 and Intel 286 processors and can be
referenced with the names AX, BX, CX, DX, BP, SI, DI, and SP. Each of the lower two
bytes of the EAX, EBX, ECX, and EDX registers can be referenced by the names AH,
BH, CH, and DH (high bytes) and AL, BL, CL, and DL (low bytes).
#9
zklhp2012-03-04 12:45
Pointer to data in the DS segment

Pointer to data in the segment pointed to by the DS register

你说的那个就是这些英语的翻译 不过我觉得翻译的真不好
#10
THthen2012-03-04 12:50
回复 9楼 zklhp
没有翻译啊!还是英文……
#11
zklhp2012-03-04 12:51
你没看到这段中文么

你可能会说看不懂 那就不要管这个概念了 记住寄存器的用法就好了
#12
zklhp2012-03-04 12:57
多说几句 为啥我不解释呢

1 这个问题挺复杂 至少我认为是这样 要解释为啥这样牵扯CPU架构 我没法简单告诉你为什么是这样 我只能让你记住

2 我提供了延伸信息 也就是扩展阅读 你要看不懂 说明你不具备扩展研究的能力 那样不如不研究

3 开始 先记住用法 之后再提高 这样学东西快

现在你就知道 【这几个寄存器能用作C语言中的指针 而且有相对固定的用法】 就可以了

对了 为什么你会和偏移搞混呢 因为8086中的内存管理模式是段:偏移量模式 笼统的讲 所有的内存操作都基于这个机制 指针操作的是内存中的东西 所有也用这个东西

但本质上讲两者不同 寄存器用法是CPU 内存管理是北桥罢 最起码以前是、、


[ 本帖最后由 zklhp 于 2012-3-4 13:04 编辑 ]
#13
THthen2012-03-04 13:00
回复 12楼 zklhp
恩……
#14
zaixuexi2012-03-05 21:18
内存管理在南桥还是北桥,看谁离CPU近,否则得插多少Tw来等
#15
zklhp2012-03-06 11:45
以下是引用zaixuexi在2012-3-5 21:18:41的发言:

内存管理在南桥还是北桥,看谁离CPU近,否则得插多少Tw来等

貌似现在内存控制器都集成到CPU了
#16
zaixuexi2012-03-06 13:36
#17
lopped2012-03-17 21:20
其实很多时候概念要回过头来细理解
#18
张峰程序2012-03-18 13:56
ip好像只是单一的偏移地址啊
1