2.2ver后 kernel怎么样保护它的0xC000000~0xffffffff空间?请问哪位高手!
2.2VER后
ENTRY(gdt_table)
.quad 0x0000000000000000 /* NULL descriptor */
.quad 0x0000000000000000 /* not used */
.quad 0x00cf9a000000ffff /* 0x10 kernel 4GB code at 0x00000000 */ KERNEL_CS 为 0x00000000~0xffffffff 4GB
.quad 0x00cf92000000ffff /* 0x18 kernel 4GB data at 0x00000000 */
.quad 0x00cffa000000ffff /* 0x23 user 4GB code at 0x00000000 */ USER_CS 为 0x00000000~0xffffffff 4GB
.quad 0x00cff2000000ffff /* 0x2b user 4GB data at 0x00000000 */
.quad 0x0000000000000000 /* not used */
.quad 0x0000000000000000 /* not used */
/*
KERNEL_CS 为 0x00000000~0xffffffff 4GB
USER_CS 为 0x00000000~0xffffffff 4GB
static int exec_mmap(void)
{
.
.
.
retval = new_page_tables(current);
extern __inline__ pgd_t *get_pgd_slow(void)
{
pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init;
if (ret) {
init = pgd_offset(&init_mm, 0);
memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,/*USER_PTRS_PER_PGD=768*/
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));/* clone kernel PDG(256) */
}
return ret;
}
USER 在建它的PAGEDIR时它把原KERNEL的 0xC0000000~0xffffffff页表CLONE过来
这样USER是不是也能用0xc0000000~0xffffffff? 0xc0000000~0xffffffff也就是KERNEL的?