memory.c revision bcbe91555f717d9e65cf05794295dfe172334908
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* i86pc memory routines
*
* This file contains memory management routines to provide
* functionality found in proms on Sparc machines
*/
#include <sys/sysmacros.h>
#include "standalloc.h"
#include "util.h"
#include "machine.h"
#include "debug.h"
#include "cpu_id.h"
/* These are the various memory lists in boot.c */
*vfreelistp, /* virtmem available */
*pinstalledp, /* physmem installed */
*pbooterp, /* booter occupied */
*pramdiskp; /* ramdisk memory */
extern uint_t magic_phys;
extern int use_align;
extern void start_paging(void);
static int global_pages;
static void fiximp(void);
void
init_paging(void)
{
int mode;
fiximp(); /* figure out cpu capabilities */
/* allocate boot page table directory */
prom_panic("init_paging dir");
}
/* map in scratch memory */
/* map in booter occupied memory */
while (entry) {
}
/* map in ramdisk memory: disallow write */
while (entry) {
}
start_paging();
if (verbosemode)
printf("start paging\n");
}
static int
{
return (-1); /* already mapped */
/* don't set global flag for Pentium or earlier */
if (global_pages)
return (0);
}
static int
{
while (v < vaddr_end) {
} else {
/* allocate a new page table */
MMU_PAGESIZE, 0, 0);
}
/* as long as we are on this page table */
/*
* If we are already mapped, panic!
* This should not happen under the
* current memory allocation scheme
* where physmem is either mapped 1:1
* or mapped above kernelbase.
*/
printf("remapping page at 0x%x\n", v);
prom_panic("remapping unsupported in booter");
} else {
}
paddr += MMU_PAGESIZE;
v += MMU_PAGESIZE;
}
}
return (0);
}
int
{
return (-1);
if (mode == 0)
}
static void
fiximp(void)
{
/* need to support at least standard cpuid level 1 to continue */
(void) enable_cpuid();
if (max_std_cpuid_level < 1)
return;
if (use_align) {
(void) enable_large_pages();
global_pages = global_bit();
}
if (global_pages)
(void) enable_global_pages();
}