Re: zImage code and position independence

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

 



This means that all the call and jmp's are relative
as well as the data read/write access instructions.

Lets say code will load the address of the string "Linux" which is at the
0x0010'th byte of the image and EIP is at 0x0220'th byte of the image, so
we will load the value of EIP and substract 0x0210 from that value and we
get 0x0010. So, regardless of the image base,  we load the correct
address...

The same process applies to the call & jmp instructions. For jmp it is easy
because there are relative jmp instructions. For the call we have to
calculate the offset as explained above or there may exist relative
call instructions too depending on the CPU (less likely)...
e.g : SO/DLL is compiled as PIC , so it can be loaded at any address.

"Deepak Joshi" <deepak_cins@xxxxxxxxxxx> wrote in message 
news:20051210160008.50404.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I read that the "The zImage code is Position
> Independent Code (PIC) so may be loaded anywhere
> within the available
> address space." can anybody explain me what does this
> mean or any-links on this plz.
>
> Thanks in advance,
>
> Deepak Joshi.
>
>
>
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new 
> Yahoo! Security Centre. http://uk.security.yahoo.com
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
> 




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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