CPU为什么会有段?像cs, ds, ss等等。这个问题困扰了我很久,感觉有了段地址后把问题复杂化了,没必要这么做。
后来翻查资料后才发现,段(segment)的存在原来是有历史因素的:http://homepage.smc.edu/morgan_david/cs40/segmentation.htm
以下是摘抄和个人见解
“Vintage 1980 microcomputers used physical addressing, and confined themselves to using 4-digit hexadecimal numbers (which is the same thing as 16 bits) as addresses. The highest you can count with a 4-digit hexadecimal number is FFFF in hex, equivalent to 65535 in decimal. So no more than 65536 bytes or 64K of memory could be used. Even if you could have installed more, the computer could not have used it for lack of ability to refer to it.”
1980年的程序是只有16bit大小的内存空间的,也就是只支持64k的内存,寻址只能从0000-FFFF,也就是 汇编 里的
mov edx AFFFF
这样的指令和程序是不会被执行通过的。
The IBM PC appeared in