Re: relocatable modules' symbols
what linear address is the virtual address 0xc000 respondable to ? the highest 10 bits 0x300 is pde , which means the 0x300th entry of the page dir. As I know ,at boot stage , that pde has not been ever filles . then how does the kernel code been addressed? 2013/3/1 Prabhu nath : > In principle, the linker will associate the kernel code/data to the Kernel > virtual address space i.e. between 0xC000_ to 0x_ and > the same linker will associate the Application's code/data to the user > virtual address space i.e. between 0x_ to 0xBFFF_. > > Linker itself cannot distinguish between the kernel code/data and user > code/data but it is the linker script that will guide the linker to > associate the code/data to the respective addresses. > > What you are seeing is the linker script provided to the linker with -T > option when building the kernel. > > To build the user application the linker uses its default linker script > which you get it by executing > $ ld --verbose. > > To compare between the two just juxtapose the readelf output of both kernel > executable (vmlinux) and any user application executable (a.out) > > $ readelf -a vmlinux > $ readelf -a a.out > > Just inspect the section header and program header of both the outputs you > will get the difference. > > Regards, > Prabhu > > > > On Fri, Mar 1, 2013 at 11:07 AM, Arun KS wrote: >> >> Hi Horseriver, >> >> On Sun, Feb 24, 2013 at 7:26 AM, horseriver wrote: >> > On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote: >> >> On Sat, Feb 23, 2013 at 6:45 AM, horseriver >> >> wrote: >> >> > hi: >> >> > >> >> > I have built vmlinux at the top dir of kernel source ,then I use >> >> > objdump to look into >> >> > its section information.I find the statup_32 which is the start >> >> > routine of kernel , >> >> > locats at 0xc010. I know the 0x10 is the defined address >> >> > for locating >> >> > protect-mode code .But which I can not understand is the 0xc prefix >> >> > .where does it come from? >> >> >> >> If my guess is right, that's because kernel mode code start at >> >> 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine >> > >> > I have find this answer . >> > It is defined in lds script file . >> > >> > here is the code : >> > SECTIONS >> > { >> > . = 0xC000 + 0x10; >> > /* read-only */ >> > _text = .;/* Text and read-only data */ >> > >> > >> > why use 0xC000 as its start ? why not just use 0x10 only ? >> > if use 0xC000,every linked symbole will be prefixed by 0xc , what >> > is the purpose ? >> >> Usually, user kernel space split is 3G:1G. >> ie 1G for kernel space. And this starts from 0xC000_ till 0x_ >> >> All the address below 0xC000_(ie 3G from 0x0 to 0xBFFF_) is >> used for user space. >> >> Thanks, >> Arun >> > >> > thanks! >> > >> > >> > >> > -- >> >> regards, >> >> >> >> Mulyadi Santosa >> >> Freelance Linux trainer and consultant >> >> >> >> blog: the-hydra.blogspot.com >> >> training: mulyaditraining.blogspot.com >> > >> > ___ >> > Kernelnewbies mailing list >> > Kernelnewbies@kernelnewbies.org >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> >> ___ >> Kernelnewbies mailing list >> Kernelnewbies@kernelnewbies.org >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: relocatable modules' symbols
In principle, the linker will associate the kernel code/data to the Kernel virtual address space i.e. between 0xC000_ to 0x_ and the same linker will associate the Application's code/data to the user virtual address space i.e. between 0x_ to 0xBFFF_. Linker itself cannot distinguish between the kernel code/data and user code/data but it is the linker script that will guide the linker to associate the code/data to the respective addresses. What you are seeing is the linker script provided to the linker with -T option when building the kernel. To build the user application the linker uses its default linker script which you get it by executing $ ld --verbose. To compare between the two just juxtapose the readelf output of both kernel executable (vmlinux) and any user application executable (a.out) $ readelf -a vmlinux $ readelf -a a.out Just inspect the section header and program header of both the outputs you will get the difference. Regards, Prabhu On Fri, Mar 1, 2013 at 11:07 AM, Arun KS wrote: > Hi Horseriver, > > On Sun, Feb 24, 2013 at 7:26 AM, horseriver wrote: > > On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote: > >> On Sat, Feb 23, 2013 at 6:45 AM, horseriver > wrote: > >> > hi: > >> > > >> > I have built vmlinux at the top dir of kernel source ,then I use > objdump to look into > >> > its section information.I find the statup_32 which is the start > routine of kernel , > >> > locats at 0xc010. I know the 0x10 is the defined address > for locating > >> > protect-mode code .But which I can not understand is the 0xc prefix > .where does it come from? > >> > >> If my guess is right, that's because kernel mode code start at > >> 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine > > > > I have find this answer . > > It is defined in lds script file . > > > > here is the code : > > SECTIONS > > { > > . = 0xC000 + 0x10; > > /* read-only */ > > _text = .;/* Text and read-only data */ > > > > > > why use 0xC000 as its start ? why not just use 0x10 only ? > > if use 0xC000,every linked symbole will be prefixed by 0xc , what > is the purpose ? > > Usually, user kernel space split is 3G:1G. > ie 1G for kernel space. And this starts from 0xC000_ till 0x_ > > All the address below 0xC000_(ie 3G from 0x0 to 0xBFFF_) is > used for user space. > > Thanks, > Arun > > > > thanks! > > > > > > > > -- > >> regards, > >> > >> Mulyadi Santosa > >> Freelance Linux trainer and consultant > >> > >> blog: the-hydra.blogspot.com > >> training: mulyaditraining.blogspot.com > > > > ___ > > Kernelnewbies mailing list > > Kernelnewbies@kernelnewbies.org > > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: relocatable modules' symbols
Hi Horseriver, On Sun, Feb 24, 2013 at 7:26 AM, horseriver wrote: > On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote: >> On Sat, Feb 23, 2013 at 6:45 AM, horseriver wrote: >> > hi: >> > >> > I have built vmlinux at the top dir of kernel source ,then I use objdump >> > to look into >> > its section information.I find the statup_32 which is the start routine >> > of kernel , >> > locats at 0xc010. I know the 0x10 is the defined address for >> > locating >> > protect-mode code .But which I can not understand is the 0xc prefix >> > .where does it come from? >> >> If my guess is right, that's because kernel mode code start at >> 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine > > I have find this answer . > It is defined in lds script file . > > here is the code : > SECTIONS > { > . = 0xC000 + 0x10; > /* read-only */ > _text = .;/* Text and read-only data */ > > > why use 0xC000 as its start ? why not just use 0x10 only ? > if use 0xC000,every linked symbole will be prefixed by 0xc , what is > the purpose ? Usually, user kernel space split is 3G:1G. ie 1G for kernel space. And this starts from 0xC000_ till 0x_ All the address below 0xC000_(ie 3G from 0x0 to 0xBFFF_) is used for user space. Thanks, Arun > > thanks! > > > > -- >> regards, >> >> Mulyadi Santosa >> Freelance Linux trainer and consultant >> >> blog: the-hydra.blogspot.com >> training: mulyaditraining.blogspot.com > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: relocatable modules' symbols
Hi... On Sun, Feb 24, 2013 at 8:56 AM, horseriver wrote: > I have find this answer . > It is defined in lds script file . > > here is the code : > SECTIONS > { > . = 0xC000 + 0x10; > /* read-only */ > _text = .;/* Text and read-only data */ > > > why use 0xC000 as its start ? why not just use 0x10 only ? > if use 0xC000,every linked symbole will be prefixed by 0xc , what is > the purpose ? maybe because some symbols are object of relocation, so their address don't need to be incremented with 0xc000 . Different situation with startup_32. AFAIK it's doing many thing during early protected mode initialization, so its address must be set to certain number. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: relocatable modules' symbols
On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote: > On Sat, Feb 23, 2013 at 6:45 AM, horseriver wrote: > > hi: > > > > I have built vmlinux at the top dir of kernel source ,then I use objdump > > to look into > > its section information.I find the statup_32 which is the start routine > > of kernel , > > locats at 0xc010. I know the 0x10 is the defined address for > > locating > > protect-mode code .But which I can not understand is the 0xc prefix > > .where does it come from? > > If my guess is right, that's because kernel mode code start at > 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine I have find this answer . It is defined in lds script file . here is the code : SECTIONS { . = 0xC000 + 0x10; /* read-only */ _text = .;/* Text and read-only data */ why use 0xC000 as its start ? why not just use 0x10 only ? if use 0xC000,every linked symbole will be prefixed by 0xc , what is the purpose ? thanks! -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com > training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: relocatable modules' symbols
On Sat, Feb 23, 2013 at 6:45 AM, horseriver wrote: > hi: > > I have built vmlinux at the top dir of kernel source ,then I use objdump to > look into > its section information.I find the statup_32 which is the start routine of > kernel , > locats at 0xc010. I know the 0x10 is the defined address for > locating > protect-mode code .But which I can not understand is the 0xc prefix .where > does it come from? If my guess is right, that's because kernel mode code start at 0xc00 a.k.a a bit above 3 GiB on x86 32 bit machine -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies