amd64_page.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _AMD64_AMD64_PAGE_H
#define _AMD64_AMD64_PAGE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define AMD64_PAGESIZE 4096
#define AMD64_PAGESIZE_OFFSET_NBITS 11
#define BIT_GLOBAL 8
#define BIT_US 2
#define BIT_RW 1
#define BIT_VALID 0
#define PA_MODBITS_MASK 0x1eULL
#define AMD64_MODE_LEGACY 0
#define AMD64_MODE_LONG64 1
typedef struct amd64_mmumode {
/*
* This macro is needed because of a difference of opinion between compilers
* that can result in inadvertent sign extension when converting from 32-bit
* to 64-bit values.
*
* For example, given the code:
*
* long *i = (long *)0xf0000000;
* unsigned long long l;
*
* l = (unsigned long long)i;
*
* GCC will currently sign extend "i" before converting it to unsigned long
* long, resulting in the value 0xfffffffff0000000 being stored in l.
*
* On the other hand, Forte compilers will not do the extension, resulting in
* l receiving the value 0xf0000000.
*
* The only way to assure sane results regardless of compiler is to use this
* macro whenever converting any value to an unsigned 64-bit value.
*/
(((amd64_mmu_mode) == AMD64_MODE_LEGACY) ? \
(((amd64_mmu_mode) == AMD64_MODE_LEGACY) ? \
(((amd64_mmu_mode) == AMD64_MODE_LEGACY) ? \
#define VA64_OFFSET (0xffffffff00000000ULL)
#define ADDR_TRUNC(a) ((void *)((uintptr_t)(a)))
((UINT64_FROMPTR32(a)) | VA64_OFFSET))
uint16_t);
#ifdef __cplusplus
}
#endif
#endif /* _AMD64_AMD64_PAGE_H */