mmu.c

来自「PXA250上的XBOOT」· C语言 代码 · 共 55 行

C
55
字号
/*  * $Id: mmu.c,v 1.1 2002/12/05 22:20:38 telka Exp $ * * Copyright (C) 2001, 2002 ETC s.r.o. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Written by Marcel Telka <marcel@telka.sk>, 2001, 2002. * * These functions are used from start.s without MMU enabled. * They cannot use global variables or virtual addresses. * */#include <stdint.h>#include "atable.h"voidCreatePageTables( uint32_t *FLD, struct AddressTable *MemoryMap ){	/* FLD = Address of first level descriptors (size = 4096) */	uint32_t i;	/* clearing all first level descriptors */	for (i = 0; i < 4096; i++)		FLD[i] = 0;	/* mapping from MemoryMap */	for (; MemoryMap->Size; MemoryMap++) {		uint32_t VA = (MemoryMap->VirtAddress & 0x1FF00000) >> 20;		uint32_t PA = MemoryMap->PhysAddress & 0xFFF00000;		for (i = 0; i < MemoryMap->Size; i++) {			FLD[VA | 0x800] = PA | 0x40E;			FLD[VA | 0xA00] = PA | 0x402;			VA++;			PA += 0x100000;		}	}}

⌨️ 快捷键说明

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