addr_layout.h 1.95 KB
/*
 * Copyright (C) 1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * Copyright (C) 1998 Digital Equipment Corporation
 *
 * This file is part of the SimOS distribution.
 * See LICENSE file for terms of the license.
 *
 */

/*
 * Copyright (C) 1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

/**************************************************************************
 * addr_layout.h
 *
 * We currently support several configurations...
 *   OLD SIMOS:     kernel was linked at 0x60000000
 *   EXTENDED_PMEM: used in hive studies 
 *   SIMOS_VERSION_3: kernel is where it should be
 *   R4K: only under SIMOS_VERSION_3
 *
 * $Author: blythe $
 * $Date: 2002/05/29 01:09:11 $
 **************************************************************************/
#ifndef ADDR_LAYOUT_H
#define ADDR_LAYOUT_H

#define USE_MAGIC 0
#define SIM_PAGE_SIZE (8*1024)

#define KSEG   0xfffffc0000000000L
#define K1BASE 0xfffffc8000000000L  
#define K1OFFSET 0x8000000000L

/* 32 bit KSEGS (for WinNT) */
#define KSEG_32   0xffffffff80000000L
#define K1BASE_32 0xffffffffa0000000L

#define	IS_KUSEG(x)	((Reg)(x) < (Reg)KSEG)
#define	IS_KSEG0(x)	(((Reg)(x) >= (Reg)KSEG) && ((Reg)(x) < (Reg)K1BASE))
#define	IS_KSEG1(x)	((Reg)(x) >= (Reg)K1BASE && ((Reg)(x) < (Reg)K1BASE+(Reg)K1OFFSET))

#ifdef SOLO
/* let aint to the translation */

#define PHYS_TO_MEMADDR(_m, _x) (_x)

#else
extern char *alphaMemoryPtr;
#define PHYS_TO_MEMADDR(_m, _x) (alphaMemoryPtr+(_x))
#define PHYS_TO_K1(_x) (K1BASE|(_x))
#define PHYS_TO_K1_32(_x) (K1BASE_32|(_x)) /* For NT */
#define MEMADDR_TO_PHYS(_m,_x)  ((_x)-alphaMemoryPtr)
#define IS_VALID_PA(_m, _x)  (((PA)(_x)) < ((PA)MEM_SIZE(_m)))
#define IS_VALID_MA(_m, _x)  ((((MA)(_x)) >= SIM_MEM_ADDR(_m)) && \
                              (((MA)(_x)) < (SIM_MEM_ADDR(_m) + MEM_SIZE(_m))))
#endif


#endif /* ADDR_LAYOUT_H */