How many machine instructions can single memory address store?

后端 未结 1 594
囚心锁ツ
囚心锁ツ 2021-01-23 14:23

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

相关标签:
1条回答
  • 2021-01-23 15:02

    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.

    0 讨论(0)
提交回复
热议问题