Example #1
0
File: vmm.c Project: ZZJC1306/VMM
void do_page_fault(Ptr_PageTableItem ptr_pageTabIt)
{
	unsigned int i;
	printf("产生缺页中断,开始进行调页...\n");
	for (i = 0; i < BLOCK_SUM; i++)
	{
		if (!blockStatus[i])
		{
			/* 读辅存内容,写入到实存 */
			do_page_in(ptr_pageTabIt, i);
			/* 更新页表内容 */
			ptr_pageTabIt->blockNum = i;
			ptr_pageTabIt->filled = TRUE;
			ptr_pageTabIt->edited = FALSE;
			ptr_pageTabIt->count = 0;
			blockStatus[i] = TRUE;
		LRU_ChangeAdd(i);
			return;
		}
	}
	/* 没有空闲物理块,进行页面替换 */
	//do_LFU(ptr_pageTabIt);
	do_LRU(ptr_pageTabIt);

}
Example #2
0
/* 处理缺页中断 */
void do_page_fault(Ptr_PageTableItem ptr_pageTabIt)
{
	unsigned int i;
	printf("产生缺页中断,开始进行调页...\n");
	for (i = 0; i < BLOCK_SUM; i++)
	{
		if (!blockStatus[i])
		{
			/* 读辅存内容,写入到实存 */
			do_page_in(ptr_pageTabIt, i);

			/* 更新页表内容 */
			ptr_pageTabIt->blockNum = i;
			ptr_pageTabIt->filled = TRUE;
			ptr_pageTabIt->edited = FALSE;
			ptr_pageTabIt->count = 0;
		//	ptr_pageTabIt->progressNum=ptr_memAccReq->FromProgress;

			blockStatus[i] = TRUE;
			return;
		}
	}
	/* 没有空闲物理块,进行页面替换 */
	do_LRU(ptr_pageTabIt);
}