Add PowerPC64 definitions

This commit is contained in:
matt 2003-11-21 17:40:48 +00:00
parent 19552574ee
commit 13e522ee98
1 changed files with 55 additions and 5 deletions

View File

@ -1,6 +1,7 @@
/* $NetBSD: pte.h,v 1.3 2003/08/24 17:52:34 chs Exp $ */
/* $NetBSD: pte.h,v 1.4 2003/11/21 17:40:48 matt Exp $ */
/*-
* Copyright (C) 2003 Matt Thomas
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
@ -51,6 +52,14 @@ struct pteg {
#endif /* _LOCORE */
/* High word: */
#ifdef PPC_OEA64
#define PTE_VALID 0x00000001
#define PTE_HID 0x00000002
#define PTE_API 0x00000f80
#define PTE_API_SHFT 7
#define PTE_VSID_SHFT 12
#define PTE_VSID (~0xfffL)
#else
#define PTE_VALID 0x80000000
#define PTE_VSID 0x7fffff80
#define PTE_VSID_SHFT 7
@ -58,8 +67,11 @@ struct pteg {
#define PTE_HID 0x00000040
#define PTE_API 0x0000003f
#define PTE_API_SHFT 0
#endif /* PPC_OEA64 */
/* Low word: */
#define PTE_RPGN 0xfffff000
#define PTE_RPGN (~0xfffL)
#define PTE_RPGN_SHFT 12
#define PTE_REF 0x00000100
#define PTE_CHG 0x00000080
@ -82,21 +94,59 @@ struct pteg {
/*
* Extract bits from address
*/
#define ADDR_SR (~0x0fffffffL)
#define ADDR_SR_SHFT 28
#define ADDR_PIDX 0x0ffff000
#define ADDR_PIDX_SHFT 12
#define ADDR_API_SHFT 22
#ifdef PPC_OEA64
#define ADDR_API_SHFT 23 /* API is 5 bits */
#else
#define ADDR_API_SHFT 22 /* API is 6 bits */
#endif /* PPC_OEA64 */
#define ADDR_POFF 0x00000fff
#define ADDR_SEG_WIDTH 4
#ifdef PPC_OEA64
/*
* Segment Table Element
*/
#ifndef _LOCORE
struct ste {
register_t ste_hi;
register_t ste_lo;
};
struct steg {
struct ste st[8];
};
#endif /* _LOCORE */
/* High Word */
#define STE_VALID 0x00000080
#define STE_TYPE 0x00000040
#define STE_SUKEY 0x00000020 /* Super-state protection */
#define STE_PRKEY 0x00000010 /* User-state protection */
#define STE_NOEXEC 0x00000008 /* No-execute protection bit */
#define STE_ESID (~0x0fffffffL) /* Effective Segment ID */
#define STE_ESID_SHFT 28
#define STE_ESID_MASK 0x0000001f /* low 5 bits of the ESID */
/* Low Word */
#define STE_VSID (~0xfffL) /* Virtual Segment ID */
#define STE_VSID_SHFT 12
#define SR_KEY_LEN 9 /* 64 groups of 8 segment entries */
#else /* !defined(PPC_OEA64) */
/*
* Segment registers
*/
#define SR_KEY_LEN 4 /* key bit width */
#define SR_KEY_LEN 4 /* 16 segment registers */
#define SR_TYPE 0x80000000 /* T=0 selects memory format */
#define SR_SUKEY 0x40000000 /* Supervisor protection key */
#define SR_PRKEY 0x20000000 /* User protection key */
#define SR_NOEXEC 0x10000000 /* No-execute protection bit */
#define SR_VSID 0x00ffffff /* Virtual segment ID */
#endif /* PPC_OEA64 */
#endif /* _POWERPC_OEA_PTE_H_ */