TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Does (E)IP Wrap Around in 16-bit Segments?

14 点作者 diffuse_l超过 2 年前

1 comment

rep_lodsb超过 2 年前
The stack pointer wraparound isn&#x27;t a compatibility hack. In 16-bit mode PUSH&#x2F;POP only affect SP (low 16 bits of ESP), just like string instructions only affect SI&#x2F;DI.<p>An exception only occurs if there is wraparound <i>during</i> a memory access, like a 16 bit word at [FFFFh]. I suspect that EIP never actually becomes 10000h either, but that the prefetch unit sets a special tag bit to indicate that the next instruction is beyond the segment limit, same as it would if it ran off the end of a segment smaller than 64K.<p>Would be easy to check by looking at the register information from that dialog, maybe it also depends on what CPU the code is run on.<p>The 80186 didn&#x27;t have segment limits (or the #GP exception), but behaved differently from the original in that a word access at [FFFFh] would in fact access the high byte at [10000h], because the increment is done on the 20 bit internal address instead of just the offset.