当前位置:网站首页>I always don't understand the high address and high position
I always don't understand the high address and high position
2022-06-13 07:07:00 【guangsu.】
High address and low address in memory address
You can think of main memory as a blank workbook , Now you have to write something down in your notebook , His page number order is
first page : 0x0000001
The second page : 0x0000002
...
The last page : 0x0000092
1 If you choose Record from front to back
( Use the first page , Use the second page , Reason by analogy ) This is to use the low address first , Use high address after .
0x0000001 -> 0x0000002-> ... -> 0x0000092
There is such a statement in the industry : When dynamically allocating memory, the heap space grows to the high address , This is the case .
To grow to a high address is to use a low address first , After the use of high address means .
2 If you choose Record from back to front
( Use the last page of your notebook first , Use the penultimate page after use , Reason by analogy ) This is to use the high address first , After using the low address
0x0000092 -> ... ->0x0000002 -> 0x0000001
Industry statements :0xbfac 5000-0xbfad a000
Stack space , The high address part stores the environment variables and command line parameters of the process , The low address part saves the function stack frame , Stack space is growing toward lower addresses .
To increase to a lower address is to use a higher address first , After the use of low address means .
This High address
And Low address
Easy to work with High position `` Low position
Create confusion .
For example, my salary this month is 1234
( One thousand two hundred thirty-four dollars ), Then the left side of this string of numbers is called the high position , The right is called low .
( This level comes from human reading habits , Numbers from left to right , From big to small )
In a computer, with int
Type to store wages , hypothesis int
Take up four bytes , The address of each byte is as follows
0x00008
0x00009
0x0000a
0x0000b
When the salary is loaded into memory , There will be two storage methods , as follows :
// Big end method
0x00008 => 1
0x00009 => 2
0x0000a => 3
0x0000b => 4
perhaps
// Small end method
0x00008 => 4
0x00009 => 3
0x0000a => 2
0x0000b => 1
The low address in the memory stores the high position in the salary. This method is called Big end method
. If the above storage mode is reversed , The high address in the memory stores the high position in the salary , It is called a Small end method little endian
.
( notes : You can use XOR to remember The low address is stored in the low end method -> Little brother
O-O).
Whether the host adopts the big end or the small end indicates that the data is generated by CPU The architecture of , If two hosts only see interactive data , But the byte order is different , Need assimilation .
How to query your own CPU Which byte order is used
Find an executable file , see ELF Header:
[[email protected] share_library]$>readelf -a libstack.so.1.0
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
// ----------> Here you are
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x660
Start of program headers: 64 (bytes into file)
Start of section headers: 8080 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 7
Size of section headers: 64 (bytes)
Number of section headers: 33
Section header string table index: 30
边栏推荐
- MongoDB系列之SQL和NoSQL的区别
- Make cer/pfx public and private key certificates and export CFCA application certificates
- What is the new business model of Taishan crowdfunding in 2022?
- How worker threads in the thread pool are recycled
- 个人js学习笔记
- FTP_ Manipulate remote files
- 号称下一代监控系统 来看看它有多牛逼
- Chain 2+1 reward, what kind of mode is beautiful everyday seconds?
- 10 Honest Facts I Want To Share With All Junior Developers
- 学习Mysql基础第一天
猜你喜欢
【马尔科夫链-蒙特卡罗】马尔科夫链-蒙特卡罗方法对先验分布进行抽样
YOLOv5解析 | 参数与性能指标
Micro isolation (MSG)
基于FPGA的ds18b20温度传感器使用
Raspberry school advanced development - "writing of IO port driver code" includes bus address, physical \u virtual address and bcm2835 chip manual knowledge
Yolov5 analysis | parameters and performance indicators
Host computer development (Architecture Design of firmware download software)
通过函数seaborn.cubehelix_palette生成顺序调色板
It's called the next generation monitoring system. Let's see how awesome it is
上位机开发(固件下载软件之详细设计)
随机推荐
MySQL系列之分库分表学习笔记
The new business outlet of beautiful Tiantian second mode will be popular in the Internet e-commerce market
【转】FPGA面试题
Vsys of Isis (virtual system)
线程池中的 工作线程如何被回收
Eureka server multi node deployment
Br backup test
Test development programmers, are you still confused? You can't define yourself as a yard farmer
FSM state machine
汇编语言基础:寄存器和寻址方式
Ticdc introduction
Ansible PlayBook的中清单变量优先级分析及清单变量如何分离总结
Issues related to C # delegation and events
我的理财产品显示清算中是什么意思?
The biggest highlight of wwdc2022: metalfx
考研英语
【RS-422与RS-485】RS-422与RS-485串行接口标准
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
微隔离(MSG)
10 Honest Facts I Want To Share With All Junior Developers