copy_e820_map() 函数
来源:互联网 发布:人生意义知乎 编辑:程序博客网 时间:2024/06/14 08:47
copy_e820_map() 函数
函数原型为:
static int __init sanitize_e820_map(structe820entry * biosmap, char * pnr_map)
其主要操作为:
·如果物理内存区间小于2,那肯定出错。因为BIOS至少和RAM属于不同的物理区间。
if(nr_map < 2)
return -1;
·从BIOS构成图中读出一项
do {
unsignedlong long start = biosmap->addr;
unsignedlong long size = biosmap->size;
unsignedlong long end = start + size;
unsignedlong type = biosmap->type;
·进行检查
/*Overflow in 64 bits? Ignore the memory map. */
if (start > end)
return -1;
· 一些BIOS把640K~1MB之间的区间作为RAM来用,这是不符合常规的。因为从0xA0000开始的空间用于图形卡,因此,在内存构成图中要进行修正。如果一个区的起点在0xA0000以下,而终点在1MB之上,就要将这个区间拆开成两个区间,中间跳过从0xA0000到1MB边界之间的那一部分。
/*
* Some BIOSes claim RAM in the 640k - 1M region.
* Not right. Fix it up.
*/
if (type == E820_RAM) {
if (start <0x100000ULL && end > 0xA0000ULL) {
//s1,s2 e1,e2 满足
if(start<0xA0000ULL)
add_memory_region(start,0xA0000ULL-start,type) //s1
if (end <= 0x100000ULL)//e1
continue;
start = 0x100000ULL;// e2
size = end - start;
}
}
add_memory_region(start, size, type);
} while (biosmap++,--nr_map);
- copy_e820_map() 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 百励:字符串数组
- 在flex中如何移除所容器下所有子显示对象
- SqlServer 常用字符串函数
- myeclipse中格式化代码
- 新人
- copy_e820_map() 函数
- 自定义标签详解
- 关于FILETIME的比较
- Visual Studio小贴士——加了Try-Catch也能自动定位到异常代码
- repeater嵌套
- 单向链表
- 此论坛第一条博文
- 如何解决PHP startup: Unable to load dynamic library的错误
- 快速排序