Đang chuẩn bị liên kết để tải về tài liệu:
Beginning Linux Programming Third Edition phần 10

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Đây là phiên bản cao snipped của cấu trúc, bạn có thể tìm thấy nó trong linux / mm.h. Chúng tôi sẽ bao gồm các thành viên mà chúng tôi thực sự sẽ cần sau này. vm_start và vm_end hiện sự bắt đầu và kết thúc của khu vực bộ nhớ ảo, và vm_page_prot là bảo vệ | Device Drivers Virtual Memory Areas Above the page table reside the virtual memory areas. These constitute a map of contiguous virtual memory addresses as handed out to an application. struct vm_area_struct . unsigned long vm_start unsigned long vm_end . pgprot_t vm_page_prot . struct vm_operations_struct vm_ops unsigned long vm_pgoff struct file vm_file . This is a highly snipped version of the structure you can find it in linux mm.h. We will cover the members that we will actually need later on. vm_start and vm_end represent the beginning and end of the virtual memory area and vm_page_prot is the protection attributes assigned to it whether it is shared private executable and so forth. vm_ops is similar to the file_operations structure used with character and block devices and forms an analogous abstraction to operation on virtual memory areas. Finally vm_offset is the offset into the area and vm_file is used in correlation with memory mapping of files. We ll take a much closer look at this structure when we dissect the mmap functions of schar. The mappings made by a specific process can be seen in proc PID maps. Each one corresponds to a separate vm_area_struct and the size span and protection associated with the mapping can be read from the proc entry among other things. Address Space The entire addressable area of memory 4 GB on 32-bit platforms is split into two major areas kernel space and user or application space. PAGE_OFFSET defines this split and is actually configurable in asm page.h. The kernel space is located above the offset and user space is kept below. The default for PAGE_OFFSET on the Intel platform is 0xc0000000 and thus provides the kernel with approximately 1 GB of memory leaving 3 GB for user space consumption. On the Intel platform the virtual addresses seen from the kernel are therefore a direct offset from the physical address. This isn t always the case and primitives to convert between the two must thus be used. See Figure 18-4 for a .