Ядро Linux в комментариях

       

Include/asm-i386/page.h


10786 #ifndef _I386_PAGE_H 10787 #define _I386_PAGE_H 10788 10789 /* PAGE_SHIFT determines the page size */ 10790 #define PAGE_SHIFT 12 10791 #define PAGE_SIZE (1UL << PAGE_SHIFT) 10792 #define PAGE_MASK (~(PAGE_SIZE-1)) 10793 10794 #ifdef __KERNEL__ 10795 #ifndef __ASSEMBLY__ 10796 10797 #define STRICT_MM_TYPECHECKS 10798 10799 #define clear_page(page) \ 10800 memset((void *)(page), 0, PAGE_SIZE) 10801 #define copy_page(to,from) \ 10802 memcpy((void *)(to), (void *)(from), PAGE_SIZE) 10803 10804 #ifdef STRICT_MM_TYPECHECKS 10805 /* These are used to make use of C type-checking.. */ 10806 typedef struct { unsigned long pte; } pte_t; 10807 typedef struct { unsigned long pmd; } pmd_t; 10808 typedef struct { unsigned long pgd; } pgd_t; 10809 typedef struct { unsigned long pgprot; } pgprot_t; 10810 10811 #define pte_val(x) ((x).pte) 10812 #define pmd_val(x) ((x).pmd) 10813 #define pgd_val(x) ((x).pgd) 10814 #define pgprot_val(x) ((x).pgprot) 10815 10816 #define __pte(x) ((pte_t) { (x) } ) 10817 #define __pmd(x) ((pmd_t) { (x) } ) 10818 #define __pgd(x) ((pgd_t) { (x) } ) 10819 #define __pgprot(x) ((pgprot_t) { (x) } ) 10820 10821 #else 10822 /* .. while these make it easier on the compiler */ 10823 typedef unsigned long pte_t; 10824 typedef unsigned long pmd_t; 10825 typedef unsigned long pgd_t; 10826 typedef unsigned long pgprot_t; 10827 10828 #define pte_val(x) (x) 10829 #define pmd_val(x) (x) 10830 #define pgd_val(x) (x) 10831 #define pgprot_val(x) (x) 10832 10833 #define __pte(x) (x) 10834 #define __pmd(x) (x) 10835 #define __pgd(x) (x) 10836 #define __pgprot(x) (x) 10837 10838 #endif 10839 #endif /* !__ASSEMBLY__ */ 10840 10841 /* to align the pointer to the (next) page boundary */ 10842 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) 10843 10844 /* This handles the memory map.. We could make this a 10845 * config option, but too many people screw it up, and 10846 * too few need it. 10847 * 10848 * A __PAGE_OFFSET of 0xC0000000 means that the kernel 10849 * has a virtual address space of one gigabyte, which 10850 * limits the amount of physical memory you can use to 10851 * about 950MB. If you want to use more physical memory, 10852 * change this define. 10853 * 10854 * For example, if you have 2GB worth of physical memory, 10855 * you could change this define to 0x80000000, which 10856 * gives the kernel 2GB of virtual memory (enough to most 10857 * of your physical memory as the kernel needs a bit 10858 * extra for various io-memory mappings) 10859 * 10860 * IF YOU CHANGE THIS, PLEASE ALSO CHANGE 10861 * 10862 * arch/i386/vmlinux.lds 10863 * 10864 * which has the same constant encoded.. */ 10865 #define __PAGE_OFFSET (0xC0000000) 10866 10867 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 10868 #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 10869 #define __va(x) ((void *)((unsigned long)(x) + \ 10870 PAGE_OFFSET)) 10871 #define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT) 10872 10873 #endif /* __KERNEL__ */ 10874 10875 #endif /* _I386_PAGE_H */



Содержание раздела