64 位 linux,汇编语言,问题? [英] 64-bit linux, Assembly Language, Issues?

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

问题描述

我目前正在学习汇编语言.我在 Gas/wiki/Linux_Mint" rel="nofollow noreferrer">Linux Mint(32 位).使用本书:从头开始编程.

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.

我使用的机器有 AMD Turion 64 位 处理器,但我'm 限制为 2 GB 的 RAM.我正在考虑将我的 Linux 安装升级到 64 位版本的 Linux Mint,但我担心因为这本书是针对 32 位 x86 架构的,代码示例将无法运行.

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.

所以两个问题:

  1. 代码示例是否可能有任何问题?
  2. 这里有没有人注意到使用 64 位 Linux 比使用 32 位 Linux 有任何好处(我在 Stack Overflow 上看到了一些关于此的主题,但它们主要与 Windows Vista 与 Windows XP 相关.)

推荐答案

您的代码示例都应该仍然有效.64 位处理器和操作系统仍然可以在某种兼容模式"下运行 32 位代码.您的装配示例也不例外.您可能需要提供一两条额外的汇编代码(例如 .BITS 32),但仅此而已.

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.

一般来说,使用 64 位操作系统会比使用 32 位操作系统更快.x86_64 比 i386 有更多的寄存器.由于您正在处理汇编,因此您已经知道寄存器的用途......拥有更多意味着更少的东西必须移入和移出堆栈(和其他临时内存),因此您的程序花费更少的时间来管理数据和有更多时间处理这些数据.

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.

编辑:要使用 gas 在 64 位 linux 上编译 32 位代码,您只需使用命令行参数--32",如 GAS 手册

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,汇编语言,问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆