xref: /titanic_52/usr/src/uts/intel/ia32/sys/pte.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*ae115bc7Smrj  * Common Development and Distribution License (the "License").
6*ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _IA32_SYS_PTE_H
277c478bd9Sstevel@tonic-gate #define	_IA32_SYS_PTE_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _ASM
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #endif /* _ASM */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifndef _ASM
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	PTE36			/* PTE36 ---------------------------- */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef uint64_t	pteval_t;
447c478bd9Sstevel@tonic-gate typedef	pteval_t	*pteptr_t;
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #define	PRPTEx		"llx"
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate typedef struct pte32 {
497c478bd9Sstevel@tonic-gate 	uint32_t Present:1;
507c478bd9Sstevel@tonic-gate 	uint32_t AccessPermissions:2;
517c478bd9Sstevel@tonic-gate 	uint32_t WriteThru:1;
527c478bd9Sstevel@tonic-gate 	uint32_t NonCacheable:1;
537c478bd9Sstevel@tonic-gate 	uint32_t Referenced:1;
547c478bd9Sstevel@tonic-gate 	uint32_t Modified:1;
557c478bd9Sstevel@tonic-gate 	uint32_t MustBeZero:1;
567c478bd9Sstevel@tonic-gate 	uint32_t GlobalEnable:1;
577c478bd9Sstevel@tonic-gate 	uint32_t OSReserved:3;
587c478bd9Sstevel@tonic-gate 	uint32_t PhysicalPageNumber:20;
597c478bd9Sstevel@tonic-gate } pte32_t;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate typedef struct pte {
637c478bd9Sstevel@tonic-gate 	uint32_t Present:1;
647c478bd9Sstevel@tonic-gate 	uint32_t AccessPermissions:2;
657c478bd9Sstevel@tonic-gate 	uint32_t WriteThru:1;
667c478bd9Sstevel@tonic-gate 	uint32_t NonCacheable:1;
677c478bd9Sstevel@tonic-gate 	uint32_t Referenced:1;
687c478bd9Sstevel@tonic-gate 	uint32_t Modified:1;
697c478bd9Sstevel@tonic-gate 	uint32_t MustBeZero:1;
707c478bd9Sstevel@tonic-gate 	uint32_t GlobalEnable:1;
717c478bd9Sstevel@tonic-gate 	uint32_t OSReserved:3;
727c478bd9Sstevel@tonic-gate 	uint32_t PhysicalPageNumberL:20;
737c478bd9Sstevel@tonic-gate 	uint32_t PhysicalPageNumberH;
747c478bd9Sstevel@tonic-gate 					/*
757c478bd9Sstevel@tonic-gate 					 * An easy way to ensure that
767c478bd9Sstevel@tonic-gate 					 * reserved bits are zero.
777c478bd9Sstevel@tonic-gate 					 */
787c478bd9Sstevel@tonic-gate } pte_t;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate struct  pte64 {
817c478bd9Sstevel@tonic-gate 	uint32_t	pte64_0_31;
827c478bd9Sstevel@tonic-gate 	uint32_t	pte64_32_64;
837c478bd9Sstevel@tonic-gate };
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	NPTESHIFT	9
867c478bd9Sstevel@tonic-gate #define	NPTEPERPT	512	/* entries in page table */
877c478bd9Sstevel@tonic-gate #define	PTSIZE		(NPTEPERPT * MMU_PAGESIZE)	/* bytes mapped */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate #else		/* PTE36 */
917c478bd9Sstevel@tonic-gate 				/* PTE32 ---------------------------- */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate typedef uint32_t	pteval_t;
957c478bd9Sstevel@tonic-gate typedef	pteval_t	*pteptr_t;
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate #define	PRPTEx		"x"
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate typedef struct pte {
1007c478bd9Sstevel@tonic-gate 	uint_t Present:1;
1017c478bd9Sstevel@tonic-gate 	uint_t AccessPermissions:2;
1027c478bd9Sstevel@tonic-gate 	uint_t WriteThru:1;
1037c478bd9Sstevel@tonic-gate 	uint_t NonCacheable:1;
1047c478bd9Sstevel@tonic-gate 	uint_t Referenced:1;
1057c478bd9Sstevel@tonic-gate 	uint_t Modified:1;
1067c478bd9Sstevel@tonic-gate 	uint_t MustBeZero:1;
1077c478bd9Sstevel@tonic-gate 	uint_t GlobalEnable:1;
1087c478bd9Sstevel@tonic-gate 	uint_t OSReserved:3;
1097c478bd9Sstevel@tonic-gate 	uint_t PhysicalPageNumber:20;
1107c478bd9Sstevel@tonic-gate } pte_t;
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #define	pte32_t		pte_t
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #define	NPTESHIFT	10
1157c478bd9Sstevel@tonic-gate #define	NPTEPERPT	1024	/* entries in page table */
1167c478bd9Sstevel@tonic-gate #define	PTSIZE		(NPTEPERPT * MMU_PAGESIZE)	/* bytes mapped */
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #endif	/* PTE36 */
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #define	PTE_VALID	0x01
1217c478bd9Sstevel@tonic-gate #define	PTE_LARGEPAGE	0x80
1227c478bd9Sstevel@tonic-gate #define	PTE_SRWX	0x02
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #endif /* !_ASM */
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #endif /* !_IA32_SYS_PTE_H */
132