📄 pageframe.c
字号:
#include "mm.h"struct page mem_map[MAXPGFRAME];void init_mem_map(){ int i; for(i=0;i<MAXPGFRAME;i++) mem_map[i].count=0; //free frame}unsigned long get_free_pgframe(){// return the location of a free page grame int i; for(i=0;i<MAXPGFRAME;i++) if (mem_map[i].count==0) { mem_map[i].count=1; printk("get free pgframe returning free frame at %x\n",i*PGSIZE); return i*PGSIZE; } panic("no free frame\n");}void set_pgframe(unsigned long frame_loc){ int n = frame_loc/PGSIZE; mem_map[n].count++;}void free_pgframe(unsigned long frame_loc){ int n = frame_loc/PGSIZE; mem_map[n].count--;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -