你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux0.11的内存管理函数memory.c学习注释

[日期:2007-05-24] 来源:Linux公社  作者:Linux [字体:大 中 小]
给linux0.11的内存管理函数memory.c作了个注释,现在还没时间和能力分析2。6内核下的,不过linux早期版本的东西,对于想写自己内核的来说,真的是个宝藏。

/*
* linux/mm/memory.c
*
* (C) 1991 Linus Torvalds
*/

/*
* demand-loading started 01.12.91 - seems it is high on the list of
* things wanted, and it should be easy to implement. - Linus
*/

/*
* Ok, demand-loading was easy, shared pages a little bit tricker. Shared
* pages started 02.12.91, seems to work. - Linus.
*
* Tested sharing by executing about 30 /bin/sh: under the old kernel it
* would have taken more than the 6M I have free, but it worked well as
* far as I could see.
*
* Also corrected some "invalidate()"s - I wasn't doing enough of them.
*/

#include

#include

#include
#include
#include

volatile void do_exit(long code);

static inline volatile void oom(void)
{
printk("out of memory\n\r");
do_exit(SIGSEGV);
}

/* 刷新页变换高速缓冲,cr3指向页目录表的基地址
为了获得最大的地址转换效率,处理器把最近使用的页表数据存储在一个芯片内的缓存中。
只有当所要的地址转换信息没有在缓存中时,才有访问两级页表的必要。
*/
#define invalidate() \
__asm__("movl %%eax,%%cr3"::"a" (0))

/* 下面的宏定义要与head.s配合使用,改变他们的大小也一定要改变head.s中相关变量大小 */linux
【内容导航】
第1页:Linux0.11的内存管理函数memory.c学习注释 第2页:Linux0.11的内存管理函数memory.c学习注释
相关资讯       linux0.11  内存管理函数  memory.c 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款