将处理器设置为 32 位模式

发布于 2024-08-27 19:59:37 字数 291 浏览 11 评论 0原文

似乎以下是许多关于将处理器从 16 位切换到 32 位的教程中给出的常见方法:

    mov     eax, cr0            ; set bit 0 in CR0-go to pmode
    or      eax, 1
    mov     cr0, eax

为什么我不简单地执行以下操作:

    or      cr0, 1

我缺少什么吗?可能我唯一能想到的是我不能在 cr0 寄存器上执行这样的操作。

It seems that the following is a common method given in many tutorials on switching a processor from 16-bit to 32-bit:

    mov     eax, cr0            ; set bit 0 in CR0-go to pmode
    or      eax, 1
    mov     cr0, eax

Why wouldn't I simply do the following:

    or      cr0, 1

Is there something I'm missing? Possibly the only thing I can think of is that I cannot perform an operation like this on the cr0 register.

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

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

发布评论

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

评论(3

友欢 2024-09-03 19:59:37

or 运算符没有可以访问 CR0 寄存器的操作码。 (不可能在 CR0 寄存器上执行此操作。)

这就是 mov 存在的原因:存在可以访问 CR0 寄存器的操作码。

The or operator doesn't have an op-code in which it can access the CR0 register. (It's not possible to perform this operation on the CR0 register.)

That's why the mov is there: there exists an op-code which can access the CR0 register.

农村范ル 2024-09-03 19:59:37

or 是一个比较运算符,它实际上采用两个值并创建一个解决方案。或运算完成后,解存储在eax中。或者不能使用存储寄存器,因为它是专门的操作并且受范围支配,这就是为什么最好在过程完成后立即获取其结果并立即存储新值。

详细说明关于使用或操作数的内容,它没有存储能力,它只是对已经存在的数据执行操作。想象或像计算器上的一个按钮,它具有加、减、乘或除等一项操作。代码是管理内存缓冲区的计算器;等等,并利用对其内存存储中的数据进行操作/操作的服务,并在完成时获取返回结果以进行进一步的操作或完成向用户的输出。

这里的问题是一个合乎逻辑的问题,而且代码经过深思熟虑且简洁——很好的东西。

or is a comparison operator where it actually takes two values and creates a solution. The solution is stored in eax after the or operation is completed. Or can not be used a a storage register as it is a specialized operation and is ruled by scope and that is why it is good practice to take its results and immediately store the new value right after the process completes.

Elaborating on what was said about using or with operands, it has no capacity for storage it merely performs an operation on data that id already present. Think of or like a button on a calculator where it has one operation like add, subtract, multiply or divide. The code is the calculator that manages the memory buffers; etc. and utilizes the services of an operator/operation on data within its memory stores and when finished gets the return results for further operations or finished output to the user.

The question here is a logical one as well as the code being well thought out and concise -- nice stuff.

逆光下的微笑 2024-09-03 19:59:37

试试这个并在 1 个命令中强制 1 到 cr0:

MOV cr0, 1

Try this and force 1 to cr0 in 1 command:

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