* Virtual Address Space
@ 2016-09-28 5:06 Madhu K
2016-09-28 6:05 ` Arun Sudhilal
` (4 more replies)
0 siblings, 5 replies; 17+ messages in thread
From: Madhu K @ 2016-09-28 5:06 UTC (permalink / raw)
To: kernelnewbies
Hi All,
This is to understand the Virtual address space.Basically who generates the
virtual addresses CPU or GNU compiler?
Thanks
Madhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/f8312599/attachment.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Virtual Address Space 2016-09-28 5:06 Virtual Address Space Madhu K @ 2016-09-28 6:05 ` Arun Sudhilal 2016-09-28 10:11 ` Madhu K 2016-09-28 6:09 ` Greg KH ` (3 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Arun Sudhilal @ 2016-09-28 6:05 UTC (permalink / raw) To: kernelnewbies Hello Madhu, On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <madhu.sk89@gmail.com> wrote: > Hi All, > > This is to understand the Virtual address space.Basically who generates the > virtual addresses CPU or GNU compiler? I didn't really get your question. Linux kernel starts at a fixed location in virtual space. This is called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is 0xC000_0000. You can have a look at system.map file after compiling your kernel. When cpu runs with MMU on, your cpu generates virtual address. Regards, Arun > > Thanks > Madhu > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 6:05 ` Arun Sudhilal @ 2016-09-28 10:11 ` Madhu K 2016-09-28 10:59 ` Prabhunath G 0 siblings, 1 reply; 17+ messages in thread From: Madhu K @ 2016-09-28 10:11 UTC (permalink / raw) To: kernelnewbies Hi Arun, Thanks for your response. I will elaborate my question.Assume I have test.c file, I compiled test.c and generated the a.out ( Executable for linux ), when I do objdump of a.out, we can see addresses( virtual address ) associated with each instruction, these instructions are generated by whom? Thanks On Wed, Sep 28, 2016 at 11:35 AM, Arun Sudhilal <getarunks@gmail.com> wrote: > Hello Madhu, > > On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <madhu.sk89@gmail.com> wrote: > > Hi All, > > > > This is to understand the Virtual address space.Basically who generates > the > > virtual addresses CPU or GNU compiler? > > I didn't really get your question. > > Linux kernel starts at a fixed location in virtual space. This is > called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is > 0xC000_0000. You can have a look at system.map file after compiling > your kernel. > When cpu runs with MMU on, your cpu generates virtual address. > > Regards, > Arun > > > > > Thanks > > Madhu > > > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies at kernelnewbies.org > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/75626e58/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 10:11 ` Madhu K @ 2016-09-28 10:59 ` Prabhunath G 2016-09-28 13:32 ` Gadre Nayan 0 siblings, 1 reply; 17+ messages in thread From: Prabhunath G @ 2016-09-28 10:59 UTC (permalink / raw) To: kernelnewbies The virtual addresses what you see in the output of objdump is given/associated by Linker to every instruction and data symbol in the data/bss section except for symbols in the stack section. It is wrong to use generated in the context of Linker. When you initiate *$./a.out* for execution, the kernel will take your start address from the ELF header of *a.out* and place it on the PC (program counter) or IP (instruction pointer) of the CPU, thereafter CPU will start incrementing or generating virtual address for every subsequent instructions. Regards, Prabhu On Wed, Sep 28, 2016 at 3:41 PM, Madhu K <madhu.sk89@gmail.com> wrote: > Hi Arun, > > Thanks for your response. > > I will elaborate my question.Assume I have test.c file, I compiled test.c > and generated the a.out ( Executable for linux ), when I do objdump of > a.out, we can see addresses( virtual address ) associated with each > instruction, these instructions are generated by whom? > > Thanks > > On Wed, Sep 28, 2016 at 11:35 AM, Arun Sudhilal <getarunks@gmail.com> > wrote: > >> Hello Madhu, >> >> On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <madhu.sk89@gmail.com> wrote: >> > Hi All, >> > >> > This is to understand the Virtual address space.Basically who generates >> the >> > virtual addresses CPU or GNU compiler? >> >> I didn't really get your question. >> >> Linux kernel starts at a fixed location in virtual space. This is >> called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is >> 0xC000_0000. You can have a look at system.map file after compiling >> your kernel. >> When cpu runs with MMU on, your cpu generates virtual address. >> >> Regards, >> Arun >> >> > >> > Thanks >> > Madhu >> > >> > _______________________________________________ >> > Kernelnewbies mailing list >> > Kernelnewbies at kernelnewbies.org >> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> > >> > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > -- Regards, Prabhunath G Linux Trainer Bangalore -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/4d8d961a/attachment-0001.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 10:59 ` Prabhunath G @ 2016-09-28 13:32 ` Gadre Nayan 2016-09-30 16:40 ` Román Martínez 0 siblings, 1 reply; 17+ messages in thread From: Gadre Nayan @ 2016-09-28 13:32 UTC (permalink / raw) To: kernelnewbies Virtual addresses will be used only in case MMU is enabled, otherwise for a processor an address is something it can put on the bus, irrespective of physical or virtual. So when your PC increments virtual address for a MMU enabled system, they will get translated to physical. On 28 Sep 2016 4:29 p.m., "Prabhunath G" <gprabhunath@gmail.com> wrote: > The virtual addresses what you see in the output of objdump is > given/associated by Linker to every instruction and data symbol in the > data/bss section except for symbols in the stack section. It is wrong to > use generated in the context of Linker. > When you initiate *$./a.out* for execution, the kernel will take your > start address from the ELF header of *a.out* and place it on the PC > (program counter) or IP (instruction pointer) of the CPU, thereafter CPU > will start incrementing or generating virtual address for every subsequent > instructions. > > Regards, > Prabhu > > > On Wed, Sep 28, 2016 at 3:41 PM, Madhu K <madhu.sk89@gmail.com> wrote: > >> Hi Arun, >> >> Thanks for your response. >> >> I will elaborate my question.Assume I have test.c file, I compiled test.c >> and generated the a.out ( Executable for linux ), when I do objdump of >> a.out, we can see addresses( virtual address ) associated with each >> instruction, these instructions are generated by whom? >> >> Thanks >> >> On Wed, Sep 28, 2016 at 11:35 AM, Arun Sudhilal <getarunks@gmail.com> >> wrote: >> >>> Hello Madhu, >>> >>> On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <madhu.sk89@gmail.com> wrote: >>> > Hi All, >>> > >>> > This is to understand the Virtual address space.Basically who >>> generates the >>> > virtual addresses CPU or GNU compiler? >>> >>> I didn't really get your question. >>> >>> Linux kernel starts at a fixed location in virtual space. This is >>> called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is >>> 0xC000_0000. You can have a look at system.map file after compiling >>> your kernel. >>> When cpu runs with MMU on, your cpu generates virtual address. >>> >>> Regards, >>> Arun >>> >>> > >>> > Thanks >>> > Madhu >>> > >>> > _______________________________________________ >>> > Kernelnewbies mailing list >>> > Kernelnewbies at kernelnewbies.org >>> > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >>> > >>> >> >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies at kernelnewbies.org >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> >> > > > -- > Regards, > Prabhunath G > Linux Trainer > Bangalore > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/0c8efe88/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 13:32 ` Gadre Nayan @ 2016-09-30 16:40 ` Román Martínez 2016-10-02 2:52 ` Arshad Hussain 0 siblings, 1 reply; 17+ messages in thread From: Román Martínez @ 2016-09-30 16:40 UTC (permalink / raw) To: kernelnewbies Hi, I compile main.s and it generates main.o. With objdump I can see: 0000000000000000 <_start>: ???0: b8 01 00 00 00??????? mov????$0x1,%eax ???5: bb 00 00 00 00??????? mov????$0x0,%ebx ???a: cd 80???????????????? ? ? ? ? int????$0x80 After link main.o it generates main. With objdump I now can see: 0000000000400078 <_start>: ? 400078: b8 01 00 00 00??????? mov????$0x1,%eax ? 40007d: bb 00 00 00 00??????? mov????$0x0,%ebx ? 400082: cd 80???????????????? ? ? ? ? int????$0x80 So, linker generates virtual address, doesn't it? But why it starts at 400078 and not in other any location? Is there any logic here? A virtual address can start at 0? Regards. El mi?, 28-09-2016 a las 19:02 +0530, Gadre Nayan escribi?: > > > Virtual addresses will be used only in case MMU is enabled, otherwise for a processor an address is something it can put on the bus, irrespective of physical or virtual. > > So when your PC increments virtual address for a MMU enabled system, they will get translated to physical. > > > On 28 Sep 2016 4:29 p.m., "Prabhunath G" <gprabhunath@gmail.com> wrote: > > > > > > > > > > > > > > > > > > The virtual addresses what you see in the output of objdump is given/associated by Linker to every instruction and data symbol in the data/bss section except for symbols in the stack section. It is wrong to use generated in the context of Linker.?When you initiate $./a.out for execution, the kernel will take your start address from the ELF header of a.out and place it on the PC (program counter) or IP (instruction pointer) of the CPU, thereafter CPU will start incrementing or generating virtual address for every subsequent instructions.? > > Regards, > > Prabhu > > > > > > > > > > On Wed, Sep 28, 2016 at 3:41 PM, Madhu K <madhu.sk89@gmail.com> wrote: > > > Hi Arun, > > > Thanks for your response. > > > > > > > > > > > > > > > > > > I will elaborate my question.Assume I have test.c file, I compiled test.c and generated the a.out ( Executable for linux ), when I do objdump of a.out, we can see addresses( virtual address ) associated with each instruction, these instructions are generated by whom? > > > > > > Thanks > > > > > > > > > > > > On Wed, Sep 28, 2016 at 11:35 AM, Arun Sudhilal <getarunks@gmail. com> wrote: > > > > Hello Madhu, > > > > > > > > > > > > > > > > On Wed, Sep 28, 2016 at 10:36 AM, Madhu K <madhu.sk89@gmail.com > wrote: > > > > > > > > > Hi All, > > > > > > > > > > > > > > > > > > > > > > This is to understand the Virtual address space.Basically who generates the > > > > > > > > > virtual addresses CPU or GNU compiler? > > > > > > > > > > > > > > > > I didn't really get your question. > > > > > > > > > > > > > > > > > > > > Linux kernel starts at a fixed location in virtual space. This is > > > > > > > > > > > > called PAGE_OFFSET. On a kernel split of 3GB/1GB, 32 system, its is > > > > > > > > > > > > 0xC000_0000. You can have a look at system.map file after compiling > > > > > > > > your kernel. > > > > > > > > When cpu runs with MMU on, your cpu generates virtual address. > > > > > > > > > > > > > > > > Regards, > > > > > > > > Arun > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > Madhu > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > > Kernelnewbies mailing list > > > > > > > > > Kernelnewbies at kernelnewbies.org > > > > > > > > > > > > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbie s > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Kernelnewbies mailing list > > > > > > Kernelnewbies at kernelnewbies.org > > > > > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > > > > > > > > > > --? > > Regards, > > Prabhunath G > > Linux Trainer > > Bangalore > > > > > > > > > > > > > > _______________________________________________ > > > > Kernelnewbies mailing list > > > > Kernelnewbies at kernelnewbies.org > > > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160930/a0338ba2/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-30 16:40 ` Román Martínez @ 2016-10-02 2:52 ` Arshad Hussain 2016-10-03 5:12 ` Madhu K 0 siblings, 1 reply; 17+ messages in thread From: Arshad Hussain @ 2016-10-02 2:52 UTC (permalink / raw) To: kernelnewbies On 30-Sep-2016, at 10:10 pm, Rom?n Mart?nez <rgmf@riseup.net> wrote: > Hi, > > I compile main.s and it generates main.o. With objdump I can see: > > 0000000000000000 <_start>: > 0: b8 01 00 00 00 mov $0x1,%eax > 5: bb 00 00 00 00 mov $0x0,%ebx > a: cd 80 int $0x80 > > After link main.o it generates main. With objdump I now can see: > > 0000000000400078 <_start>: > 400078: b8 01 00 00 00 mov $0x1,%eax > 40007d: bb 00 00 00 00 mov $0x0,%ebx > 400082: cd 80 int $0x80 > > So, linker generates virtual address, doesn't it? But why it starts at 400078 and not in other any location? Is there any logic here? A virtual address can start at 0? > The linker script would normally leave out some area and _not_ start from 0. (although this is not an absolute necessity ). It will pick up and valid virtual address and assign start of .text,.bss and .stack. This is possible because we now have virtual memory. And every program thinks that it has _all_ the memory for itself. So, 400078 is perfectly valid virtual address space and linker has chosen this for this executable. Also note that if the address space is getting shifted by little , this is because of the KASLR (layout randomisation) - If this is disabled then the linker would generate the same virtual address for all the executable every time. <snip> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-10-02 2:52 ` Arshad Hussain @ 2016-10-03 5:12 ` Madhu K 0 siblings, 0 replies; 17+ messages in thread From: Madhu K @ 2016-10-03 5:12 UTC (permalink / raw) To: kernelnewbies Hi All, Thank you so much for all your answers. Regards, Madhu On Sun, Oct 2, 2016 at 8:22 AM, Arshad Hussain <arshad.super@gmail.com> wrote: > > On 30-Sep-2016, at 10:10 pm, Rom?n Mart?nez <rgmf@riseup.net> wrote: > > > Hi, > > > > I compile main.s and it generates main.o. With objdump I can see: > > > > 0000000000000000 <_start>: > > 0: b8 01 00 00 00 mov $0x1,%eax > > 5: bb 00 00 00 00 mov $0x0,%ebx > > a: cd 80 int $0x80 > > > > After link main.o it generates main. With objdump I now can see: > > > > 0000000000400078 <_start>: > > 400078: b8 01 00 00 00 mov $0x1,%eax > > 40007d: bb 00 00 00 00 mov $0x0,%ebx > > 400082: cd 80 int $0x80 > > > > So, linker generates virtual address, doesn't it? But why it starts at > 400078 and not in other any location? Is there any logic here? A virtual > address can start at 0? > > > The linker script would normally leave out some area and _not_ start from > 0. (although this is not > an absolute necessity ). It will pick up and valid virtual address and > assign start of .text,.bss and > .stack. This is possible because we now have virtual memory. And every > program thinks that it > has _all_ the memory for itself. So, 400078 is perfectly valid virtual > address space and linker > has chosen this for this executable. > > Also note that if the address space is getting shifted by little , this is > because of the KASLR > (layout randomisation) - If this is disabled then the linker would > generate the same virtual > address for all the executable every time. > > > > <snip> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161003/3b108c1b/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 5:06 Virtual Address Space Madhu K 2016-09-28 6:05 ` Arun Sudhilal @ 2016-09-28 6:09 ` Greg KH 2016-09-28 10:14 ` Madhu K 2016-09-28 9:14 ` Augusto Mecking Caringi ` (2 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Greg KH @ 2016-09-28 6:09 UTC (permalink / raw) To: kernelnewbies On Wed, Sep 28, 2016 at 10:36:59AM +0530, Madhu K wrote: > Hi All, > > This is to understand the Virtual address space.Basically who generates the > virtual addresses CPU or GNU compiler? CPU. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 6:09 ` Greg KH @ 2016-09-28 10:14 ` Madhu K 2016-09-28 10:29 ` Greg KH 0 siblings, 1 reply; 17+ messages in thread From: Madhu K @ 2016-09-28 10:14 UTC (permalink / raw) To: kernelnewbies Hi Greg, As I understand CPU's work is Fetch, Decode and Execute. How can CPU generate virtual address.please correct me if my understanding is wrong. Thanks Madhu On Wed, Sep 28, 2016 at 11:39 AM, Greg KH <greg@kroah.com> wrote: > On Wed, Sep 28, 2016 at 10:36:59AM +0530, Madhu K wrote: > > Hi All, > > > > This is to understand the Virtual address space.Basically who generates > the > > virtual addresses CPU or GNU compiler? > > CPU. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/d8b0b99a/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 10:14 ` Madhu K @ 2016-09-28 10:29 ` Greg KH 0 siblings, 0 replies; 17+ messages in thread From: Greg KH @ 2016-09-28 10:29 UTC (permalink / raw) To: kernelnewbies On Wed, Sep 28, 2016 at 03:44:28PM +0530, Madhu K wrote: > Hi Greg, > > As I understand CPU's work is Fetch, Decode and Execute. How can CPU generate > virtual address.please correct me if my understanding is wrong. What exactly do you mean by "generate virtual address"? Is this a homework assignment? greg k-h ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 5:06 Virtual Address Space Madhu K 2016-09-28 6:05 ` Arun Sudhilal 2016-09-28 6:09 ` Greg KH @ 2016-09-28 9:14 ` Augusto Mecking Caringi 2016-09-28 10:21 ` Madhu K 2016-09-28 10:37 ` Alexander Kapshuk 2016-09-29 7:25 ` arshad hussain 4 siblings, 1 reply; 17+ messages in thread From: Augusto Mecking Caringi @ 2016-09-28 9:14 UTC (permalink / raw) To: kernelnewbies On Wed, Sep 28, 2016 at 6:06 AM, Madhu K <madhu.sk89@gmail.com> wrote: > Hi All, > > This is to understand the Virtual address space.Basically who generates the > virtual addresses CPU or GNU compiler? Hi, In my view, the linker. The compiler normally generates absolute addresses (starting from 0), creating object code. Then the linker generates an executable by combining different object files together and assigning virtual addresses. Finally, is CPU (MMU) job (with the kernel helping) to translate these virtual addresses to physical ones. Best regards, -- Augusto Mecking Caringi ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 9:14 ` Augusto Mecking Caringi @ 2016-09-28 10:21 ` Madhu K 0 siblings, 0 replies; 17+ messages in thread From: Madhu K @ 2016-09-28 10:21 UTC (permalink / raw) To: kernelnewbies Hi, Even I read somewhere, during compilation, compiler will take the linker script as input and it will generate the virtual addresses. Thanks, Madhu On Wed, Sep 28, 2016 at 2:44 PM, Augusto Mecking Caringi < augustocaringi@gmail.com> wrote: > On Wed, Sep 28, 2016 at 6:06 AM, Madhu K <madhu.sk89@gmail.com> wrote: > > Hi All, > > > > This is to understand the Virtual address space.Basically who generates > the > > virtual addresses CPU or GNU compiler? > > Hi, > > In my view, the linker. > > The compiler normally generates absolute addresses (starting from > 0), creating object code. > > Then the linker generates an executable by combining different > object files together and assigning virtual addresses. > > Finally, is CPU (MMU) job (with the kernel helping) to translate > these virtual addresses to physical ones. > > Best regards, > > -- > Augusto Mecking Caringi > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160928/71cf4b92/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 5:06 Virtual Address Space Madhu K ` (2 preceding siblings ...) 2016-09-28 9:14 ` Augusto Mecking Caringi @ 2016-09-28 10:37 ` Alexander Kapshuk 2016-09-29 7:25 ` arshad hussain 4 siblings, 0 replies; 17+ messages in thread From: Alexander Kapshuk @ 2016-09-28 10:37 UTC (permalink / raw) To: kernelnewbies On Wed, Sep 28, 2016 at 8:06 AM, Madhu K <madhu.sk89@gmail.com> wrote: > Hi All, > > This is to understand the Virtual address space.Basically who generates the > virtual addresses CPU or GNU compiler? > > Thanks > Madhu > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > In no way does this response claim to be based on personal expert knowledge, but if my understanding of Chapter 2 (Page tables) of https://pdos.csail.mit.edu/6.828/2016/xv6/book-rev9.pdf is correct, it is the hardware that performs the mapping of physical memory, RAM, to virtual addresses on x86: Quote: As a reminder, x86 instructions (both user and kernel) manipulate virtual addresses. The machine?s RAM, or physical memory, is indexed with physical addresses. The x86 page table hardware connects these two kinds of addresses, by mapping each virtual address to a physical address. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-28 5:06 Virtual Address Space Madhu K ` (3 preceding siblings ...) 2016-09-28 10:37 ` Alexander Kapshuk @ 2016-09-29 7:25 ` arshad hussain 2016-09-30 17:09 ` roman at mailoo.org 4 siblings, 1 reply; 17+ messages in thread From: arshad hussain @ 2016-09-29 7:25 UTC (permalink / raw) To: kernelnewbies > On 28-Sep-2016, at 10:36 am, Madhu K <madhu.sk89@gmail.com> wrote: > > Hi All, The support comes right through from the architecture. Linear address: Also virtual address. This is Address CPU can address. This is 0 - 4GB under 32bit architecture. Physical address: This are actual memory installed in your system. Linear address have to be converted to physical address eventually. MMU translate linear address with the help of paging to physical address. > > This is to understand the Virtual address space.Basically who generates the virtual addresses CPU or GNU compiler? A program image generated by compiler & linker uses Virtual Address . During execution of the program CPU + MMU translates or maps each virtual address to physical address. Net-net this is architecture dependent and would highly recommend reading Intel?s Architecture Manual for your reference. > > Thanks > Madhu > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-29 7:25 ` arshad hussain @ 2016-09-30 17:09 ` roman at mailoo.org 2016-10-01 18:02 ` piyush moghe 0 siblings, 1 reply; 17+ messages in thread From: roman at mailoo.org @ 2016-09-30 17:09 UTC (permalink / raw) To: kernelnewbies Hi, I COMPILE MAIN.S and it generates MAIN.O. With objdump I can see: 0000000000000000 <_start>: 0: b8 01 00 00 00 mov $0x1,%eax 5: bb 00 00 00 00 mov $0x0,%ebx a: cd 80 int $0x80 After LINK MAIN.O it generates MAIN. With objdump I now can see: 0000000000400078 <_start>: 400078: b8 01 00 00 00 mov $0x1,%eax 40007d: bb 00 00 00 00 mov $0x0,%ebx 400082: cd 80 int $0x80 So, linker generates virtual address, doesn't it? But why it starts at 400078 and not in other any location? Is there any logic here? A virtual address can start at 0? Regards. El 29.09.2016 09:25, arshad hussain escribi?: >> On 28-Sep-2016, at 10:36 am, Madhu K <madhu.sk89@gmail.com> wrote: >> >> Hi All, > > The support comes right through from the architecture. > > Linear address: Also virtual address. This is Address CPU can address. This is 0 - 4GB under 32bit architecture. > Physical address: This are actual memory installed in your system. Linear address have to be converted to > physical address eventually. MMU translate linear address with the help of paging to physical address. > >> This is to understand the Virtual address space.Basically who generates the virtual addresses CPU or GNU compiler? > > A program image generated by compiler & linker uses Virtual Address . During execution of the program CPU + MMU > translates or maps each virtual address to physical address. > > Net-net this is architecture dependent and would highly recommend reading Intel's Architecture Manual for your reference. > >> Thanks >> Madhu >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies at kernelnewbies.org >> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160930/485177b8/attachment.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Virtual Address Space 2016-09-30 17:09 ` roman at mailoo.org @ 2016-10-01 18:02 ` piyush moghe 0 siblings, 0 replies; 17+ messages in thread From: piyush moghe @ 2016-10-01 18:02 UTC (permalink / raw) To: kernelnewbies Please refer to following links, I hope this will help in understanding of linker generated address and virtual process address space: http://www.linuxjournal.com/article/6463?page=0,0 http://www.tenouk.com/ModuleW.html Regards. Piyush On Fri, Sep 30, 2016 at 10:39 PM, <roman@mailoo.org> wrote: > Hi, > > I compile main.s and it generates main.o. With objdump I can see: > > 0000000000000000 <_start>: > 0: b8 01 00 00 00 mov $0x1,%eax > 5: bb 00 00 00 00 mov $0x0,%ebx > a: cd 80 int $0x80 > > After link main.o it generates main. With objdump I now can see: > > 0000000000400078 <_start>: > 400078: b8 01 00 00 00 mov $0x1,%eax > 40007d: bb 00 00 00 00 mov $0x0,%ebx > 400082: cd 80 int $0x80 > > So, linker generates virtual address, doesn't it? But why it starts at > 400078 and not in other any location? Is there any logic here? A virtual > address can start at 0? > > Regards. > > El 29.09.2016 09:25, arshad hussain escribi?: > > > On 28-Sep-2016, at 10:36 am, Madhu K <madhu.sk89@gmail.com> wrote: > > Hi All, > > > The support comes right through from the architecture. > > Linear address: Also virtual address. This is Address CPU can address. This > is 0 - 4GB under 32bit architecture. > Physical address: This are actual memory installed in your system. Linear > address have to be converted to > physical address eventually. MMU translate linear address with the help of > paging to physical address. > > > > This is to understand the Virtual address space.Basically who generates the > virtual addresses CPU or GNU compiler? > > > A program image generated by compiler & linker uses Virtual Address . During > execution of the program CPU + MMU > translates or maps each virtual address to physical address. > > Net-net this is architecture dependent and would highly recommend reading > Intel's Architecture Manual for your reference. > > > Thanks > Madhu > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2016-10-03 5:12 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-28 5:06 Virtual Address Space Madhu K 2016-09-28 6:05 ` Arun Sudhilal 2016-09-28 10:11 ` Madhu K 2016-09-28 10:59 ` Prabhunath G 2016-09-28 13:32 ` Gadre Nayan 2016-09-30 16:40 ` Román Martínez 2016-10-02 2:52 ` Arshad Hussain 2016-10-03 5:12 ` Madhu K 2016-09-28 6:09 ` Greg KH 2016-09-28 10:14 ` Madhu K 2016-09-28 10:29 ` Greg KH 2016-09-28 9:14 ` Augusto Mecking Caringi 2016-09-28 10:21 ` Madhu K 2016-09-28 10:37 ` Alexander Kapshuk 2016-09-29 7:25 ` arshad hussain 2016-09-30 17:09 ` roman at mailoo.org 2016-10-01 18:02 ` piyush moghe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).