]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/sparc/mem_unit-sparc.cpp
Update
[l4.git] / kernel / fiasco / src / kern / sparc / mem_unit-sparc.cpp
1 INTERFACE [sparc]:
2
3 #include "types.h"
4 #include "processor.h"
5
6 namespace Mmu
7 {
8     enum ASI
9     {
10       Cache_miss    = 0x01,
11       Sys_control   = 0x02,
12       Icache_tags   = 0x0C,
13       Icache_data   = 0x0D,
14       Dcache_tags   = 0x0E,
15       Dcache_data   = 0x0F,
16       Icache_flush  = 0X10,
17       Dcache_flush  = 0x11,
18       Flush_context = 0x13,
19       Diag_dcache   = 0x14,
20       Diag_icache   = 0x15,
21       Regs          = 0x19,
22       Bypass        = 0x1C,
23       Diagnostic    = 0x1D,
24       Snoop_diag    = 0x1E
25     };
26
27     enum Registers
28     {
29       Control       = 0x000,
30       ContextTable  = 0x100,
31       ContextNumber = 0x200,
32     };
33 };
34
35 class Mem_unit { };
36
37 //------------------------------------------------------------------------------
38 IMPLEMENTATION[sparc]:
39
40 PUBLIC static inline ALWAYS_INLINE
41 void
42 Mem_unit::make_coherent_to_pou(void const *)
43 {}
44
45 //------------------------------------------------------------------------------
46 IMPLEMENTATION[sparc && !mp]:
47
48 /** Flush whole TLB
49  *
50  * Note: The 'tlbia' instruction is not implemented in G2 cores (causes a
51  * program exception). Therefore, we use 'tlbie' by iterating through EA
52  * bits [15-19] (see: G2 manual)
53  */
54 PUBLIC static inline
55 void
56 Mem_unit::tlb_flush()
57 {
58 }
59
60 /** Flush page at virtual address
61  */
62 PUBLIC static inline
63 void 
64 Mem_unit::tlb_flush(Address addr)
65 {
66   (void)addr;
67 }
68
69 PUBLIC static inline
70 void
71 Mem_unit::sync()
72 {
73 }
74
75 PUBLIC static inline
76 void
77 Mem_unit::isync()
78 {
79 }
80
81 PUBLIC static inline
82 void
83 Mem_unit::context(Mword number)
84 {
85   Proc::write_alternative<Mmu::Regs>(Mmu::ContextNumber, number);
86 }
87
88 PUBLIC static inline
89 void
90 Mem_unit::context_table(Address table)
91 {
92   Proc::write_alternative<Mmu::Regs>(Mmu::ContextTable, (table >> 4) & ~0x3);
93 }
94
95 PUBLIC static inline
96 void
97 Mem_unit::mmu_enable()
98 {
99   Mword r = Proc::read_alternative<Mmu::Regs>(Mmu::Control);
100   r |= 1;
101   Proc::write_alternative<Mmu::Regs>(Mmu::Control, r);
102 }