32位汇编指令的64位指令
我开始将一个用 C 编写的程序移植到 64 位机器上,该程序有几段用汇编语言编写的代码,其中包含 32 位机器的指令(如 ljmp)。
是否有一个地方/文档包含 32 位机器及其对应的 64 位机器的汇编说明? 如果没有,我在哪里可以找到列出 32 位和 64 位机器的所有指令的文档?
很明显,我是这种情况的新手。 让我们澄清一些要点。
我正在移植一个早期的操作系统。 它是针对 x86 机器编写的。 现在,我希望它在 x86_64 上运行。
它是在 Linux 机器上编写的,考虑到了 UNIX。 我几乎可以肯定原作者是在 Intel 机器上编写的。 我也在使用 Intel,但我也想在 AMD 上运行操作系统。
使用的编译器是gcc。
I am beginning to port a program which is written in C and have several pieces of code written in assembly with instructions for a 32 bit machine - like ljmp - to a 64 bits machine.
Is there a place/document that have the instructions, in assembly, for a 32 bit machine and its counterpart for a 64 one? If not, where can I find a document that lists all the instructions for a 32 bit and a 64 bit machine?
As it's is pretty obvious, I am a newbie for the situation. Let's clarify some points.
I am porting a OS in its very early days. It was written with a x86 machine in mind. Now, I want it to run at a x86_64.
It is written in a Linux box with UNIX in mind. I am almost sure that the original author is writing it at a Intel machine. I am also on Intel but I would like to run the OS in AMD too.
The compiler used is gcc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先阅读此内容:http://x86asm.net/文章/x86-64-tour-of-intel-manuals/index.html。
然后在此处下载指令集参考:http://developer.intel.com/产品/处理器/手册/index.htm。
Read this first: http://x86asm.net/articles/x86-64-tour-of-intel-manuals/index.html.
Then download the instruction set reference here: http://developer.intel.com/products/processor/manuals/index.htm.
您没有提供任何背景信息,甚至没有提供 CPU 的类型,但我建议您也许应该以这个 64 位端口为契机,重新考虑是否使用汇编语言。 虽然它确实有其地位,但我建议用 C++ 重新编码该例程,并对编译器的优化输出进行基准测试,看看它是否真的更慢。 在很多情况下,情况并非如此。
You haven't offered any background, or even the type of CPU, but I'm going to suggest thay maybe you should take this 64-bit port as an opportunity to reconsider having used assembly language. While it certainly has its place, I would recommend recoding the routine in C++ and benchmarking the compiler's optimized output to see if it's really any slower. In many cases, it won't be.