单个内存地址存储有多少条机器指令? [英] How many machine instructions can single memory address store?

查看:247
本文介绍了单个内存地址存储有多少条机器指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GDB的新成员,目前正试图检查内存。我想标题说明了一切。基本上我编译了一些C代码并设置了主要的断点。当我键入 x / x $ eip 时,它会返回一些机器指令 0xd02404c7

第二次尝试 x / 5x $ eip
它会返回
0x8048426< main + 9>:0xd02404c7 0xe8080484 0xfffffebe 0x9066c3c9
0x8048436:0x90669066


所以我在这里有点困惑。 addreses 0x8048426--0x8048436之间的空格等于10.所以,事实证明,四条指令占用了10个地址。我的问题是:
内存地址最多可以存储4条机器指令?

为什么需要10个地址存储4条机器指令?

是否有任何关系
抱歉,如果问题听起来很愚蠢。

解决方案


地址0x8048426--0x8048436之间的空格等于10.所以事实证明,四条指令占用了10个地址


不完全相同,它等于0x10,它是一个十六进制数字,等于十进制的16。
所以这些指令需要16个字节。

lockquote

内存地址最多可以存储4条机器指令吗?


地址的粒度为1个字节。也就是说,一个地址恰好指向一个字节。

机器指令可以占用1个或更多字节。因此,单个内存地址(单个字节)最多可以存储1条机器指令,至少在x86上。


为什么要花费10个地址来存储4条机器指令?

你看到的每个数字都不是指令。你看到的4个数字称为单词,是你的CPU通常使用的。


在proccesor有多少位之间有任何关系以及单个内存地址存储可以有多少个机器单元?

不是。一个内存地址最多可以存储一条指令。因为指令的长度至少为1个字节(对于x86)。

但是proccesor有多少位可以表示您的处理器可以访问扩展或不同的指令设置。


I'm new in GDB and currently trying to examine memory. I guess title says everything. Basically I compiled some c code and set break point to main. When I type x/x $eip it give me back some machine instruction 0xd02404c7.
On the second try x/5x $eip
it gives back
0x8048426 <main+9>: 0xd02404c7 0xe8080484 0xfffffebe 0x9066c3c9 0x8048436: 0x90669066
So i got little confused here. The space between addreses 0x8048426--0x8048436 is equal to 10. So it turns out that four instructions took "10 addresses". My questions are:
Can Memory address store maximum of 4 machine instructions?
Why does it took "10 addresses" to store 4 machine instructions?
Is there any relationship between how much bits does proccesor have and how many machine insturction can single memory address store?
Sorry if the question sounds silly.

解决方案

The space between addreses 0x8048426--0x8048436 is equal to 10. So it turns out that four instructions took "10 addresses"

Not quite, it's equal to 0x10, which is an hexadecimal number, and equal to 16 in decimal. So those instructions are taking 16 bytes.

Can Memory address store maximum of 4 machine instructions?

Addresses have a granularity of 1 byte. That is, one address refers to exactly one byte.

Machine instructions can take 1 or more byte. So a single memory address, a single byte, can store a maximum of 1 machine instruction, at least on x86.

Why does it took "10 addresses" to store 4 machine instructions?

Each of the numbers you see is not an instruction. The 4 numbers you see are called words and are what your CPU usually works with.

Is there any relationship between how much bits does proccesor have and how many machine insturction can single memory address store?

Not really. A single memory address can store at most one instruction. Because instructions are at lest 1 byte long (for x86).

But "how much bits does proccesor have" can indicate that your processor has access to an extended or different instruction set.

这篇关于单个内存地址存储有多少条机器指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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