Re: confused!

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

 



Hello prasanna,

Sunday, April 11, 2004, 8:21:50 PM, you wrote:

pw> hi,
pw> this  part of the kernel is tricky,i'm confused,abt
pw> linux kernel,
as VA=>>LA as flat memory mode
pw> and LA is then mapped to PA by paging
pw> but why to do one to one  mapping,
pw> might be coz,before paging is turned on
pw> every VA generated by processor are  same as  
pw> linear address,
pw> and to PA
pw> say byte at PA x is actually at processor generated
pw> address  0xc0000000+x,
pw> but when segmenattion is turned off(base address 0)
pw> and paging turned on,
pw> to maintain the mapping of 
(0xc0000000 +y)=>>    0+y       here 1-1 map=>     0+y
pw>  processor va     due to segmentaion     PA
pw>                   otherwise would be
pw>                  0xc0000000+y
pw> but for first few LA=>PA first few page table entries 
pw> must 1 to 1 map with PA
I.E LA=>>PA
pw> or i'm totally confused

I didnt understand the last few sentences so excuse me if I repeat whay you say...

Linux, in standard, uses 3GB(user)/1GB(kernel). So when kernel is compiled and linked, all symbols is mapped starting
from 0xC010_0000.(2.4.19 -> arch/i386/vmlinux.lds; 2.6.1 ->arch/i386/kernel/vmlinux.lds) But as
phys, kernel is loaded starting from 0x0010_0000. Well, how do you map? It is not done magically. It
is done by the page tables...

Besides, I think It provides: 1) caching -> TLB, 2) you can access vmlinux related kernel phys addresses directly
instead of through expensive page tables...

If I understand you correctly, you might be confusing the provisional page tables with the ending page
tables or at least some jargon. one-to-one mapping is generally used for provisional page tables.

movl %eax,%cr0          /* ..and set paging (PG) bit */
jmp 1f                  /* flush the prefetch-queue */
1:
movl $1f,%eax
jmp *%eax               /* make sure eip is relocated */
1:

Its purpose is to load the new value into EIP. Before jump, EIP contains 0x0010_XXXX, so to fetch
the address of MOV instruction from memory, CPU leaves the address of it to address bus, which have
to pass MMU. This is also requires linear addresses the same as with the physical ones, which
swapper_pd_dir does it. Besides, during booting, some provisional tables(gdt, idt) is setup to be taken into
consideration pyhsical addreses.(Because setup.S works in real mode) The mapping also solves this
problem. After jump, EIP is 0xC010_XXXX.

Later in booting actual page tables is setup by paging_init() function...

-- 
Bora Sahin
borasahin.port5.com


--
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