cache.h
2.34 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
/*
* 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.
*
*/
#ifndef CACHE_H
#define CACHE_H
#ifndef _LANGUAGE_ASSEMBLY
/* Our miss handling table is very simple, it only allows 1 */
/* outstanding reference. It could be extended to model a write */
/* buffer, but outstanding loads seems undoable because of the */
/* difficulty of register interlocks */
typedef struct {
EventCallbackHdr evthdr; /* So we can make this an event callback */
PA pAddr;
VA vAddr;
PA pcPAddr;
int state;
int smht_flags;
int64 iCount;
#if ROYG
VA vpc;
SimTime startTime;
SimTime endTime;
#endif
}EmSMHT;
extern EmSMHT* emSMHT;
#define SMHT_NOTACTIVE 0x0
#define SMHT_ACTIVE 0x1
#define SMHT_UPGRADE 0x2
#define SMHT_PCCONFLICT 0x4
#define SMHT_SC 0x8
#define SMHT_DOUBLECOUNT 0x10
#define SMHT_INSTRUCTION 0x20
/* Just for efficiently */
#define SMHT_BD 0x40
#define SMHT_NLISL 0x80
#define CACHE_TAG_SIZE (LINES_PER_CACHE * sizeof(PLN))
extern void Cache_Init( int cpuNum );
extern void Cache_Clobber( int machine, int cpuNum, PA pAddr, Dir_Entry cpu_bits,
EmVQCMemState state );
extern void UPCache_Ref( int cpuNum, PA pAddr, VA vAddr, EmVQCMemState state);
extern void MPCache_Ref( int cpuNum, PA pAddr, VA vAddr, EmVQCMemState state);
extern void MPinUPCache_Ref( int cpuNum, PA pAddr, VA vAddr,
EmVQCMemState state );
/* Debugging functions */
extern int cache_verify_excl( int cpuNum, PLN pline );
extern int cache_verify_shared( int cpuNum, PLN pline );
/* Even at 16 byte lines, this limits us to 16GB */
/* Top Bit is valid/invalid. Second top bit is shared/excl */
#define INVALID_TAG 0x80000000
/* Our cache tags carry extra info like if line is excl or shared */
#define CACHE_PLINE(_cline) ((uint)(_cline) & 0xbFFFFFFF)
#define CACHE_EXCL(_cline) ((uint)(_cline) & 0x40000000)
#define CACHE_SET_EXCL(_cline) ((uint)(_cline) | 0x40000000)
#define CACHE_SHARED(_cline) (!CACHE_EXCL(_cline))
#define CACHE_SET_SHARED(_cline) ((uint)(_cline) & 0xbFFFFFFF)
#define CACHE_INVALID(_cline) ((uint)(_cline) & INVALID_TAG)
#define CACHE_VALID(_cline) (!((uint)(_cline) & INVALID_TAG))
#endif
#endif