+ = next-addr;} while (pgd++, addr = Next, addr! = end);}
Create address mappings be familiar with the address space, different processes have different address space, struct mm_struct is the virtual address space describing a process, of course, our scenario here is to create an address map for the kernel virtual address space, so the parameters passed is init_mm. The starting virtual address where the address mapping needs to be created is virt, the descriptor in the
+ pgd_idx;for (; (Pgd_idx +------------------------------+| PGD | PUD | PMD | PTE | PAGE |+------------------------------+Each level corresponds to the offset of the virtual address, plus a mask to calculate the corresponding level of valuePgdir_shift 22Pud_shift 22Pmd_shift 22Page_shift 12The number of digits in the virtual address corresponding to the corresponding levelPGD PUD, PMD PTE PAGE10, 0, 0, 10,
Analysis of physical address re ing functions in vmalloc
Figure 1: vmalloc Areas
Figure 2: map three consecutive physical pages to a continuous virtual address
Note: The image goes to professional Linux kernel architecture
Function call relationship:
1) vmap_page_range (unsigned long start, unsigned long end,Pgprot_t Prot, struct page ** pages)
2) Static int vmap_page_range_noflush (unsigned long start, unsigned long end,Pgprot_t Prot, struct page ** pages)
3) Static int vmap_pud_range (pgd_t
Recently, I made a software program for a cost company, which requires the integration of the traffic system. The rest is not feasible because the seller did not provide the dynamic link library interface, you have to write the code to implement the operations related to the hardware interaction. First, let's take a look at what we use.
1. At command
Second: serial communication, I use C #, which has class support
Among them, the AT command is the most troublesome. If the details are not good, I
address that causes an exception.Write_access: If tsk tries to write data to address, it is set to 1 (in our case). If tsk tries to read or execute data in address, it is set to 0.
Static inline int handle_mm_fault (struct mm_struct * mm,Struct vm_area_struct * VMA, unsigned long address,Int write_access){Return _ handle_mm_fault (mm, VMA, address, write_access )(~ Vm_fault_write );}/** By the time we get here, we already hold the MM semaphore*/Int _ handle_mm_fault (struct mm_struct * Mm, stru
managementIn principle, Linux only needs to allocate the required data structure for each process, put in memory, and then in the scheduling process, the switch register CR3, the rest of the hardware to complete (hehe, in fact, much more complex, but I only analyze the most basic process). It says I386 's two-level page management architecture, but some CPUs, there are three levels, or even four-tier architectures, and Linux provides a unified interface for each CPU in order to provide a higher
This is the 100 best fonts ever selected by the German fontshop website.Based on three criteriaSales volume (weight 40%), historical value (weight 30%), and aesthetic value (30%). At the same time, all fonts that participate in the selection are commercial fonts and do not contain free fonts, OS built-in font, and thatFonts used in some standard software (Arial, verdana, etc ). For a list of detailed results, see German version 100 Best fonts (PDF ).
Top 30 optimal Fonts
100 Best fonts (includin
-, three-, and four-level management architecture CPUs. These four levels are:Page Global directory PGD (corresponding to the page directory just now)Page Parent Directory PUD (newly introduced)Page Intermediate Catalog PMD (also on newly introduced)Page Table pt (corresponds to the page table just now).The whole conversion is based on the principle of hardware conversion, just two more times the index of the array, such as:So, for hardware that uses
a higher level of the image, for each CPU to provide a unified interface. Provides a four-layer page management architecture that is compatible with these two-, three-, and four-level management architecture CPUs. These four levels are:Page Global folder PGD (corresponding to the page folder just now)Page parent folder PUD (newly introduced)Page Intermediate folder PMD (also newly introduced)Page Table pt (corresponding to the page table just now).Th
Global directory PGD (corresponding to the page directory just now)Page Parent Directory PUD (newly introduced)Page Intermediate Catalog PMD (also on newly introduced)Page Table pt (corresponds to the page table just now).The whole conversion is based on the principle of hardware conversion, just two more times the index of the array, such as:So, for hardware that uses level two management architecture 32 bits, and now the four-level conversion, how
Solemn statement: Without my permission, not for commercial or non-commercial reprint and use, if necessary, please contact: yrj1978@hotmail.com
Actions for page table entries
In the case of the X86 architecture, in the Include/asm-x86/pgtable.h file, several macros that define the values in the "precipitate" or "Check" page table entries (in the 2.6.24 version of the kernel, which may be distributed in several related header files due to the architectural relationships).
Through 4 macros, a l
(haha, in fact it is much more complicated, but I only analyze the most basic process ).
I mentioned above the i386 second-level page management architecture. However, some CPUs have third-level or even fourth-level architecture. Linux provides a unified interface for each CPU to provide images at a higher level. Provides a layer-4 page management architecture to be compatible with the CPU of these level-2, level-3, and level-4 Management architectures. The four levels are:
Page global director
pointing to a pointer array. the pointer to the pointer array points to the page Descriptor (therefore, structpage *** is used as the Data Type !).
The function first allocates the starting and ending linear addresses of the memory area to the local variables address and end respectively:Address = Area-> ADDR;End = address + (area-> size-page_size );
Remember that area-> size stores the actual address of the memory area and the security interval between 4 kb memory. Then the function uses the p
function will also check whether it is readable or executable.
Default and case2 (write = 1): If the access to this linear zone is limited to the access type that causes exceptions to match, call the handle_mm_fault () function to allocate a new page box (keep ve code segment):
Key:Handle_mm_fault () function
/* By the time we get here, we already hold the mm semaphore */int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct * vma,unsigned long address, int write_access){pgd_t *pgd;pud
above the i386 second-level page management architecture. However, some CPUs have third-level or even fourth-level architecture. Linux provides a unified interface for each CPU to provide images at a higher level. Provides a layer-4 page management architecture to be compatible with the CPU of these level-2, level-3, and level-4 Management architectures. The four levels are:
Page global directory PGD (corresponding to the page Directory just now)Page parent directory
higher level of the image, for each CPU to provide a unified interface. Provides a four-layer page management architecture that is compatible with these two-, three-, and four-level management architecture CPUs. These four levels are:Page Global folder PGD (corresponding to the page folder just now)Page parent folder PUD (newly introduced)Page Intermediate folder PMD (also newly introduced)Page Table pt (corresponding to the page table just now).The
Memory Management1.listvmastatic void Mtest_dump_vma_list (void){struct Task_struct *task = current; Get the task_struct of the current processstruct Mm_struct *mm = task->mm;struct Vm_area_struct *vma; Get the VMA area of the current processint count = 0; The number of VMADown_read (mm->mmap_sem);for (VMA = mm->mmap; vma; VMA = vma->vm_next){count++;PRINTK ("%d:0x%lx 0x%lx", Count, Vma->vm_start, vma->vm_end);if (Vma->vm_flags Vm_read)PRINTK ("R");ElsePRINTK ("-");if (Vma->vm_flags Vm_write)P
think?
Fonts used: Brandon Grotesque
5. Basics09
As the website says in the title introduction, it aims to "provide fonts (Benton Sans) for basic web design and printing." Frankly speaking, Benton Sans is indeed a very simple and not liner, a slight adjustment can create a sense of hierarchy. The website and the font are good, very nice.
Fonts used: Ben
to be compatible with the CPU of these level-2, level-3, and level-4 Management architectures. The four levels are:
Page global directory PGD (corresponding to the page Directory just now)Page parent directory pud (new)Page center Directory (new)Page table Pt (corresponding to the page table just now ).
Based on the hardware conversion principle, the entire conversion only requires secondary array indexes, such:So how can I coordinate the 32-bit hard
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.