⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vm.c.svn-base

📁 RT-Thread是发展中的下一代微内核嵌入式实时操作系统
💻 SVN-BASE
字号:
/*
 * File      : vm.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006, RT-Thread Develop Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://openlab.rt-thread.com/license/LICENSE
 *
 * Change Logs:
 * Date           Author       Notes
 * 2007-01-31     Bernard      the first version
 */

#include <rtthread.h>

#include "kservice.h"

#ifdef RT_USING_VM
/**
 * @addtogroup VM
 */

/*@{*/

static rt_list_t rt_pagetable_list;

/**
 * This function will init page table in VM.
 */
void rt_pagetable_system_init()
{
	/* init page table list */
	rt_list_init(&rt_pagetable_list);
}

/**
 * This function will lookup the special physical address in page table.
 * 
 * @param pa the physical address
 *
 * @return the corresponding virtual address if found, otherwise RT_NULL.
 */
rt_addr_t rt_pagetable_lookup(rt_addr_t pa)
{
	rt_pv_addr_t* pv;
	struct rt_list_node* node;

	/* search in list */
	for (node = rt_pagetable_list.next; node != &rt_pagetable_list; 
		node = node->next)
	{
		pv = rt_list_entry(node, struct rt_pv_addr, list);
		if (pv->pv_pa == pa) return (pv->pv_va);
	}

	return (rt_addr_t)RT_NULL;
}

/*@}*/

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -