本文介绍了64位Linux,汇编语言,问题是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前是在学习汇编语言的过程。我使用天然气上的(32位)。使用本手册:从地上爬起来 编程。

我正在使用的机器有一个 AMD炫龙64位处理器,但我敢限制为2 GB的RAM。我想升级我的Linux安装64位版本的Linux Mint的的,但我很担心,因为这本书是针对32位x86架构的code的例子是行不通的。

于是两个问题:

  1. 有可能是与code样?
  2. 任何问题
  3. 有没有人在这里注意到,在一般的任何利益使用64位Linux超过32位(我见过的堆栈溢出有关这方面的一些主题,但他们大多是关联到Windows Vista与Windows XP中。)
解决方案

您code例子应该都还在工作。 64位处理器和操作系统仍然可以在一种兼容模式运行32位code。你组装的例子并没有什么不同。您可能必须提供组装或两个(如.BITS 32)的一个额外的行,但仅此而已。

在一般情况下,使用的是64位操作系统会比使用32位操作系统更快。 x86_64的拥有比i386的更多的寄存器。既然你正在处理组件,你已经知道什么寄存器用于...有更多的人意味着更少的东西有开启和关闭堆栈(和其他临时内存)被移动从而你的程序花费更少的时间管理数据和更多的时间在这些数据。

修改:要使用煤气,你只需要使用命令行参数--32,编制在64位Linux 32位code中的

I'm currently in the process of learning assembly language.I'm using Gas on Linux Mint (32-bit). Using this book:Programming from the Ground Up.

The machine I'm using has an AMD Turion 64 bit processor, but I'm limited to 2 GB of RAM.I'm thinking of upgrading my Linux installation to the 64-bit version of Linux Mint, but I'm worried that because the book is targeted at 32-bit x86 architecture that the code examples won't work.

So two questions:

  1. Is there likely to be any problems with the code samples?
  2. Has anyone here noticed any benefits in general in using 64-bit Linux over 32-bit (I've seen some threads on Stack Overflow about this but they are mostly related to Windows Vista vs. Windows XP.)
解决方案

Your code examples should all still work. 64-bit processors and operating systems can still run 32-bit code in a sort of "compatability mode". Your assembly examples are no different. You may have to provide an extra line of assembly or two (such as .BITS 32) but that's all.

In general, using a 64-bit OS will be faster than using a 32-bit OS. x86_64 has more registers than i386. Since you're working on assembly, you already know what registers are used for... Having more of them means less stuff has to be moved on and off the stack (and other temporary memory) thus your program spends less time managing data and more time working on that data.

Edit: To compile 32-bit code on 64-bit linux using gas, you just use the commandline argument "--32", as noted in the GAS manual

这篇关于64位Linux,汇编语言,问题是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:37