Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8327 maxcodehac 1
#ifndef _ICACHE_H_
2
#define _ICACHE_H_
3
 
4
 
5
#include "types.h"
6
#include "CPU.h"
7
 
8
 
9
#define ICACHE_L		4UL	//line size is 2^L bytes
10
#define ICACHE_S		6UL	//number of sets is 2^S
11
#define ICACHE_A		6UL	//set associativity
12
 
13
 
14
#define ICACHE_LINE_SZ		(1UL << ICACHE_L)
15
#define ICACHE_BUCKET_NUM	(1UL << ICACHE_S)
16
#define ICACHE_BUCKET_SZ	(ICACHE_A)
17
 
18
 
19
#define ICACHE_ADDR_MASK	((UInt32)-ICACHE_LINE_SZ)
20
#define ICACHE_USED_MASK	1UL
21
#define ICACHE_PRIV_MASK	2UL
22
 
23
typedef struct{
24
 
25
	UInt32 info;	//addr, masks
26
	UInt8 data[ICACHE_LINE_SZ];
27
 
28
}icacheLine;
29
 
30
typedef struct{
31
 
32
	struct ArmCpu* cpu;
33
	ArmCpuMemF memF;
34
	icacheLine lines[ICACHE_BUCKET_NUM][ICACHE_BUCKET_SZ];
35
	UInt8 ptr[ICACHE_BUCKET_NUM];
36
 
37
}icache;
38
 
39
 
40
void icacheInit(icache* ic, struct ArmCpu* cpu, ArmCpuMemF memF);
41
Boolean icacheFetch(icache* ic, UInt32 va, UInt8 sz, Boolean priviledged, UInt8* fsr, void* buf);
42
void icacheInval(icache* ic);
43
void icacheInvalAddr(icache* ic, UInt32 addr);
44
 
45
 
46
 
47
#endif