zulu_hat.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __ZULU_HAT_INCL__
#define __ZULU_HAT_INCL__
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define ZULU_TTE8K 0
#define ZULU_TTE64K 1
#define ZULU_TTE512K 2
#define ZULU_TTE4M 3
#define ZULUM_MAX_PG_SIZES 4
#define ZULU_CTX_MASK 0x1fff
#ifndef _ASM
#define ZULU_HAT_BP_SHIFT 13
#define ZULU_HAT_PGSHIFT(s) (ZULU_HAT_BP_SHIFT + \
#define ZULU_HAT_PGDIFF(a, s) (ZULU_HAT_PGSZ(s) - \
ZULU_HAT_PGADDROFF(a, s))
/*
* zulu_ctx_tab is an array of pointers to zulu hat structures.
* since the addresses are 8 byte aligned we use bit 0 as a lock flag.
* This will synchronize TL1 access to the tsb and the mappings.
*/
#define ZULU_CTX_LOCK 0x1
#define ZULU_CTX_SET_HAT(c, h) zulu_ctx_tab[c] = h
zulu_ctx_tab[c] & ~ZULU_CTX_LOCK)
struct zulu_tag {
};
struct zulu_tte {
union {
struct zulu_tag zulu_tte_tag;
} un;
};
/*
* zulu hat stores its list of translation in a hash table.
* TODO: size this table. 256 buckets may be too small.
*/
#define ZULU_HASH_TBL_NUM 0x100
/*
*
* TODO: need finalize the number of entries in the TSB
* 32K tsb entries caused us to never get a tsb miss that didn't cause
* a page fault.
*
* Reducing TSB_NUM to 512 entries caused tsb_miss > tsb_hit
* in a yoyo run.
*/
#define ZULU_TSB_NUM 4096
(s-1))
struct zulu_hat_blk {
struct zulu_hat_blk *zulu_hash_next;
struct zulu_hat_blk *zulu_hash_prev;
struct zulu_shadow_blk *zulu_shadow_blk;
struct zulu_tte zulu_hat_blk_tte;
};
/*
* for fast lookups by address, len we use an avl list to shadow occupied
* 4Mb regions that have mappings.
*/
#define ZULU_SHADOW_BLK_RANGE 0x400000
struct zulu_shadow_blk {
};
#define ZULU_SHADOW_BLK_LINK_OFFSET (0)
struct zulu_hat {
char magic; /* =42 to mark our data for mdb */
unsigned in_fault : 1;
unsigned freed : 1;
unsigned map8k : 1;
unsigned map64k : 1;
unsigned map512k : 1;
unsigned map4m : 1;
short zulu_ctx;
unsigned short zulu_tsb_size; /* TODO why not a constant? */
struct zulu_hat_blk **hash_tbl;
void *zdev;
};
/*
* Assembly language function for TSB lookups
*/
/*
* zuluvm's interface to zulu_hat
*/
int zulu_hat_init();
int zulu_hat_destroy();
int zulu_hat_attach(void *arg);
int zulu_hat_detach(void *arg);
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* __ZULU_HAT_INCL__ */