在64位应用程序的内存中的布局 [英] Layout in memory of 64-bit applications

查看:232
本文介绍了在64位应用程序的内存中的布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

64位OS 是指通用寄存器的位宽.能够一次处理64位(数据+运算).

64-bit OS refers to the bit width of the general purpose registers. It's able to process 64 bits (data + operations) at a time.

我们知道,为了使64位系统真正有用,程序员需要编写64位应​​用程序.

We know that in order for the 64-bit system to be truly useful, programmers need to write 64-bit applications.

但是,我想知道32位应用程序和64位应用程序之间有什么区别?我不是问编译64位应用程序需要进行哪些配置更改;相反,我想知道内存中两个应用程序的结构差异.

However, I wonder what the difference is between a 32-bit application and a 64-bit application? I'm not asking what configuration changes I need to make to compile a 64-bit application; instead, I'd like to know the structural differences of the two applications in memory.

例如,Linux上的C程序通常在内存中看起来像这样:

For example, a C program on Linux would typically look like this in memory:

  1. 文本段
  2. 初始化的数据段
  3. 未初始化的数据段
  4. 堆栈

我想64位应用程序在内存中的布局结构上看起来是一样的,只是每个字节的地址(假定字节可寻址系统)具有更多位.如果是这样,那么64位意味着什么?只是更大的可寻址内存空间?

I'd imagine the 64-bit application would look the same in terms of layout structure in memory, except that the address for each byte (assuming byte addressable system) has more bits. If that's true, what does the 64-bit imply? simply larger addressable memory space?

另外,当编译64位应用程序时,我们假设源代码中的一条指令被编译为汇编代码中的add MIPS指令:

Also, when a 64-bit application is compiled, let's assume one instruction in the source code is compiled into the add MIPS instruction in assembly code:

add $1 $2 $1 // $1 += $2;

每条MIPS指令均精确地以32位编码.因此,这里的问题是,如果将应用程序配置为编译为64位应用程序,则add指令将是什么样?它仍然有32位还是扩展到64位而违反了MIPS规则?如果仍然是32位,我看不出64位应用程序有什么区别,因此它使64位操作系统完全发挥作用".

Each MIPS instruction is encoded in exactly 32 bits. So here's the question, if an application is configured to be compiled as a 64-bit app, what would the add instruction look like? does it still have 32 bits or is it extended to 64 bit which breaks the MIPS rule? If it's still 32 bits, I don't see what difference a 64-bit app make so that it "brings 64 bit OS into full play".

请赐教.

推荐答案

首先,您用MIPS标记了问题,但提出了一个一般性问题. MIPS中64位应用程序的布局与其他64位体系结构不同.但是布局是事物在内存中的排列方式,而不是像您所说的那样.这些段只是内存的区域",几乎所有架构都在可执行文件中包含这些段

First, you tagged the question with MIPS but the ask a general question. The layout of 64-bit apps in MIPS aren't like in other 64-bit architectures. But layouts are how things are arranged in memory, not the segments like you said. Those segments are just memory "zones" and almost all architectures have those segments in their executables

64位体系结构不仅是可寻址内存的扩展范围",而且还提供了新的指令集.由于某些旧指令不适用于64位数据,因此它们必须创建新指令来进行处理.

64-bit architectures are not simply an "extend range" of addressable memory but also provide a new instruction set. Because some of the old instructions don't work with 64-bit data so they must create new instructions to deal with.

关于指令,MIPS 64位仍使用32位指令.如果将其扩展到64位,那么它将在添加的32位中包含什么,而其他32位已经足够(如果不是有点多余)来表示所有参数.但是,当然有许多关于64位数字的新指令(例如,移位超过31位或加载/存储双字...).顺便说一句,如果没有,

About instructions, MIPS 64-bit still use 32-bit instruction. If it was extend to 64-bit then what would it contain in the added 32 bits while the other 32-bit was already enough (if not somewhat redundant) to represent all the arguments. But of course there were many new instructions for 64-bit numbers (such as shifting more than 31 or load/store double word...). And btw, the instruction is not correct without ,

这篇关于在64位应用程序的内存中的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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