Re: Need help understanding memory models, cpu modes and address translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mulyadi,

Good to read your posts. It has certainly been a long time and it
feels good to be back on this list!

> On Sat, Jul 16, 2011 at 10:14, Vaibhav Jain <vjoss197@xxxxxxxxx> wrote:
....
>
>> Could somebody please state the difference clearly for me and explain how
>> these two work together. I would
>> really appreciate if someone could explain the whole chain from generation
>> of addresses by compiler and then translation of
>> those addresses in case of  Segmentation working along with Paging.
>
> when you generate object code from your source code (let's say in C)
> using gcc, first your code and variables (data) are turn into Position
> Independent Code. It means, it is just an offset. If there is an
> offset, surely we need base address, right? But not at this object
> (resulting in .o) stage.
>
> Then in reach producing final ELF binary (executable). Using known
> standart ELF rule, those offset are turn into final final address. So
> let's, code are placed starting at 0x080499f0 and so on.

Very nice explanation!

>
> When that binary is loaded into memory, loader (ld.so) take that
> information and use it as a clue on where to put the code and data.
> Using standart mmap() syscall, memory area is reserved and data/code
> is loaded there. The exception is stack, where it is allocated
> dynamically (and grows down, for Intel arch) starting at the upper
> limit of user space (near 3 GiB).
>

I'm just a little troubled by this bit.

AFAIK, the kernel takes ELF executables and loads them into the
appropriate sections after parsing the ELF tables and headers. Correct
me if I'm wrong? Ofcourse, ld.so takes care of dynamic linking/loading
shared libraries into the address space.

Thanks,
Joel

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux