Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  */
0006 #include <linux/export.h>
0007 #include <linux/mm.h>
0008 #include <linux/string.h>
0009 #include <asm/pgalloc.h>
0010 
0011 pgd_t *pgd_alloc(struct mm_struct *mm)
0012 {
0013     pgd_t *ret, *init;
0014 
0015     ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_TABLE_ORDER);
0016     if (ret) {
0017         init = pgd_offset(&init_mm, 0UL);
0018         pgd_init((unsigned long)ret);
0019         memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
0020                (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
0021     }
0022 
0023     return ret;
0024 }
0025 EXPORT_SYMBOL_GPL(pgd_alloc);