Disassembling an ELF binary on a Ubuntu x86 system I couldn't help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused.
This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer dereferences. The latter case looks like it can be fixed by using a single page instead of leaving a 128MB gap.
So my question is this - is there a definitive answer to why the layout has been fixed to these values or is it just an arbitrary choice?
●In a large memory situation, the kernel virtual address area is smaller, because there is more physical memory. ●An interesting case, where more memory means lessspace for kernel virtual addresses.
●The virtual address is valid, but swapped out. –This is a software condition Kernel Virtual Memory Kernel Virtual Memory ●In Linux, the kernel uses virtual addresses, as user space processes do. ●This is not true of all OS's ●Virtual address space is split. ●The upper part is used for the kernel ●The lower part is used for user space
●For 32-bit large-memorysystems (more than ~1GB RAM), not all of the physical RAM can be mapped into the kernel's address space. ●Kernel address space is the top 1GB of virtual address space, by default. ●Further, ~104 MB is reserved at the top of the kernel's memory space for non-contiguous allocations –See vmalloc() described later
●Virtual Memoryis a system that uses an address mapping ●Maps virtualaddress space to physicaladdress space –Maps virtual addresses to physical RAM –Maps virtual addresses to hardware devices ●PCI devices ●GPU RAM ●On-SoC IP blocks What is Virtual Memory? ●Advantages ●Each processes can have a different memory mapping
From the Linkers and loaders book:
On 386 systems, the text base address is 0x08048000, which permits a reasonably large stack below the text while still staying above address 0x08000000, permitting most programs to use a single second-level page table. (Recall that on the 386, each second-level table maps 0x00400000 addresses.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With