cp0.h
2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright (C) 1996-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.
*
*/
/*****************************************************************
* cp0.h
*
* Definitions for CP0 - TLB and exception handling
* Written for BIG ENDIAN!!!
*
* $Author: blythe $
* $Date: 2002/05/29 01:09:10 $
*****************************************************************/
#ifndef CP0_H
#define CP0_H
/* These two codes are used in mem_driver_simos.c to alert it to */
/* backdoor references */
#define NORMAL_CODE 0
#define BACKDOOR_CODE 0x100
#define EXCEPTION_CODE 0x200
/* This can only take on values up to NTLBENTRIES, but use of */
/* registers, and possible problems with sign extension make using a */
/* whole word make the most sense */
typedef uint IDX ;
extern int exceptionDuringBackdoor;
/* This is called to allow access to the hash talbe */
IDX Tlb_Lookup( int cpuNum, uint region, VPN, ASID );
/* This is called after Tlb_Init when we are jumping into Embra to set */
/* up the entries in the TLB hash table, and the quick check*/
extern void Em_Tlb_Init( int cpuNum, int swtch );
/* This is called when we switch out of mshade, so we don't have stale data*/
/* if/when we re-enter mshade */
extern void Em_Tlb_Clear( int cpuNum );
/* Global CP0 Functions */
/* These are called from translated code */
C_LINK void Em_RestoreFromException(int cpuNum, VA restoreAddr);
C_LINK uint Em_ProbeTLB(int cpuNum);
C_LINK uint Em_ReadTLBEntry(int cpuNum);
C_LINK uint Em_WriteRandomTLBEntry(int cpuNum);
C_LINK uint Em_WriteTLBEntry(int cpuNum);
C_LINK uint Em_MoveToC0(int cpuNum, Inst instr, VA nextPC );
/*C_LINK void MoveFromC0(int cpuNum, unsigned gp_reg, unsigned co_reg );*/
/* Is this entry writable (dirty) in the TLB? */
int Em_Is_Tlb_Writable( int cpuNum, VA vAddr, ASID asid );
/* Is this entry readable (valid) in the TLB? */
int Em_Is_Tlb_Readable( int cpuNum, VA vAddr, ASID asid );
void Em_RaiseC1Unusable( int cpuNum );
void Em_EXCEPTION(int cpuNum, int, int);
C_LINK void Em_RaiseEXCEPTION(int cpuNum, int code, int ce);
typedef enum {ACT_DWRITE, ACT_DREAD, ACT_IREAD} Em_accesstype;
extern uint Em_TranslateVirtual(int cpuNum, VA, PA*, Em_accesstype);
struct PgMaskStruct{
Reg mask;
uint loBit;
uint offset_mask;
};
extern struct PgMaskStruct PgSz[];
#endif /* CP0_H */