如何直接改掉页的读写属性,大家说说
alloc_page得到一个页,之后pgd_offset (init_mm 或 mm->pgd) , pud_offset, pmd_offset, pte_offset_kernel最后得到此页的pte,
然后设置set_pte_atomic设置读写属性不生效,大家知道是什么原因吗,是不是还要做其他的?
在x86和mips上都试了,都不生效,谁知道,来说说,感谢ing。。。 不明白你是怎么判断不生效的.如果是设置不能写.然后去写却没发现异常.
那么可能是你没刷新TLB 就是去写来测试的,已经flush_tlb了,呵呵 UP 回复 1# unbutun
用change_page_attr 不行么? 找了一下,好像只有x86和powerpc架构提供这个函数
我很想知道arm下怎么修改页属性
回复unbutun
用change_page_attr 不行么?
fxtian 发表于 2010-09-03 15:13 http://linux.chinaunix.net/bbs/images/common/back.gif 回复 6# seamountain82
看了下代码,__pgprot_modify应该可以 change_page_attr 在x86上可以,在ppc上不行,我想知道的是如果不用这个,自己写怎么写 回复 7# fxtian
page结构里面有关于页属性的。pte里面也有关于页属性的相关位。 回复fxtian
page结构里面有关于页属性的。pte里面也有关于页属性的相关位。
omycle 发表于 2010-09-04 20:05 http://linux.chinaunix.net/bbs/images/common/back.gif
struct page里没有表示页属性的东西,只有表示页状态的东西
struct page {
unsigned long flags;
atomic_t _count;
union {
atomic_t _mapcount;
unsigned int inuse;
};
union {
struct {
unsigned long private;
struct address_space *mapping;
};
struct kmem_cache *slab; /* SLUB: Pointer to slab */
struct page *first_page; /* Compound tail pages */
};
union {
pgoff_t index; /* Our offset within mapping. */
void *freelist; /* SLUB: freelist req. slab lock */
};
struct list_head lru;
#if defined(WANT_PAGE_VIRTUAL) void *virtual;
#endif };
union
这个flags只是表示状态用的,如PG_slab PG_dirty,要想改变页读写执行属性只能改变pte
页:
[1]
2