hat_i86.h revision 977046508bbcbc7faa3e0cc7a3c7bf15c2e5dc57
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _VM_HAT_I86_H
#define _VM_HAT_I86_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* VM - Hardware Address Translation management.
*
* This file describes the contents of the x86_64 HAT data structures.
*/
#include <sys/vm_machparam.h>
/*
* The essential data types involved:
*
* htable_t - There is one of these for each page table and it is used
* by the HAT to manage the page table.
*
* hment_t - Links together multiple PTEs to a single page.
*/
/*
* VLP processes have a 32 bit address range, so their top level is 2 and
* with only 4 PTEs in that table.
*/
#define VLP_LEVEL (2)
#define VLP_NUM_PTES (4)
}
/*
* The hat struct exists for each address space.
*/
struct hat {
};
/*
* Flags for the hat_flags field
*
* HAT_FREEING - set when HAT is being destroyed - mostly used to detect that
* demap()s can be avoided.
*
* HAT_VLP - indicates a 32 bit process has a virtual address range less than
* the hardware's physical address range. (VLP->Virtual Less-than Physical)
*
* HAT_VICTIM - This is set while a hat is being examined for page table
* stealing and prevents it from being freed.
*
* HAT_SHARED - The hat has exported it's page tables via hat_share()
*/
#define HAT_FREEING (0x0001)
#define HAT_VLP (0x0002)
#define HAT_VICTIM (0x0004)
#define HAT_SHARED (0x0008)
/*
* Additional platform attribute for hat_devload() to force no caching.
*/
#define HAT_PLAT_NOCACHE (0x100000)
/*
* Simple statistics for the HAT. These are just counters that are
* atomically incremented. They can be reset directly from the kernel
* debugger.
*/
struct hatstats {
};
#if defined(_KERNEL)
/*
* Useful macro to align hat_XXX() address arguments to a page boundary
*/
extern kmutex_t hat_list_lock;
extern kcondvar_t hat_list_cv;
/*
* Interfaces to setup a cpu private mapping (ie. preemption disabled).
* The attr and flags arguments are the same as for hat_devload().
* setup() must be called once, then any number of calls to remap(),
* followed by a final call to release()
*
* Used by ppcopy(), page_zero(), the memscrubber, and the kernel debugger.
*/
/*
* Interfaces to manage which thread has access to htable and hment reserves.
* The USE_HAT_RESERVES macro should always be recomputed in full. Its value
*/
extern uint_t can_steal_post_boot;
extern uint_t use_boot_reserve;
extern kthread_t *hat_reserves_thread;
#define USE_HAT_RESERVES() \
/*
* initialization stuff needed by by startup, mp_startup...
*/
extern void hat_cpu_online(struct cpu *);
extern void hat_cpu_offline(struct cpu *);
extern void setup_vaddr_for_ppcopy(struct cpu *);
extern void teardown_vaddr_for_ppcopy(struct cpu *);
/*
* magic value to indicate that all TLB entries should be demapped.
*/
#define DEMAP_ALL_ADDR (~(uintptr_t)0)
/*
* not in any include file???
*/
/*
*/
extern void hat_kern_setup(void);
extern void hat_init_finish(void);
/*
* Hat switch function invoked to load a new context into %cr3
*/
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _VM_HAT_I86_H */