Subversion Repositories HelenOS

Rev

Rev 3425 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3425 Rev 4377
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup mips32mm   
29
/** @addtogroup mips32mm
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
Line 38... Line 38...
38
#include <arch/types.h>
38
#include <arch/types.h>
39
#include <typedefs.h>
39
#include <typedefs.h>
40
#include <arch/mm/asid.h>
40
#include <arch/mm/asid.h>
41
#include <arch/exception.h>
41
#include <arch/exception.h>
42
 
42
 
43
#ifdef TLBCNT
-
 
44
#   define TLB_ENTRY_COUNT      TLBCNT
-
 
45
#else
-
 
46
#   define TLB_ENTRY_COUNT      48
43
#define TLB_ENTRY_COUNT  48
47
#endif
-
 
48
 
44
 
49
#define TLB_WIRED       1
45
#define TLB_WIRED               1
50
#define TLB_KSTACK_WIRED_INDEX  0
46
#define TLB_KSTACK_WIRED_INDEX  0
51
 
47
 
52
#define TLB_PAGE_MASK_4K    (0x000 << 13)
48
#define TLB_PAGE_MASK_4K    (0x000 << 13)
53
#define TLB_PAGE_MASK_16K   (0x003 << 13)
49
#define TLB_PAGE_MASK_16K   (0x003 << 13)
54
#define TLB_PAGE_MASK_64K   (0x00f << 13)
50
#define TLB_PAGE_MASK_64K   (0x00f << 13)
55
#define TLB_PAGE_MASK_256K  (0x03f << 13)
51
#define TLB_PAGE_MASK_256K  (0x03f << 13)
56
#define TLB_PAGE_MASK_1M    (0x0ff << 13)
52
#define TLB_PAGE_MASK_1M    (0x0ff << 13)
57
#define TLB_PAGE_MASK_4M    (0x3ff << 13)
53
#define TLB_PAGE_MASK_4M    (0x3ff << 13)
58
#define TLB_PAGE_MASK_16M   (0xfff << 13)
54
#define TLB_PAGE_MASK_16M   (0xfff << 13)
59
 
55
 
60
#define PAGE_UNCACHED           2
56
#define PAGE_UNCACHED             2
61
#define PAGE_CACHEABLE_EXC_WRITE    5
57
#define PAGE_CACHEABLE_EXC_WRITE  5
62
 
58
 
63
typedef union {
59
typedef union {
64
    struct {
60
    struct {
65
#ifdef BIG_ENDIAN
61
#ifdef BIG_ENDIAN
66
        unsigned : 2;       /* zero */
62
        unsigned : 2;       /* zero */
67
        unsigned pfn : 24;  /* frame number */
63
        unsigned pfn : 24;  /* frame number */
68
        unsigned c : 3;     /* cache coherency attribute */
64
        unsigned c : 3;     /* cache coherency attribute */
69
        unsigned d : 1;     /* dirty/write-protect bit */
65
        unsigned d : 1;     /* dirty/write-protect bit */
70
        unsigned v : 1;     /* valid bit */
66
        unsigned v : 1;     /* valid bit */
71
        unsigned g : 1;     /* global bit */
67
        unsigned g : 1;     /* global bit */
72
#else
68
#else
73
        unsigned g : 1;     /* global bit */
69
        unsigned g : 1;     /* global bit */
74
        unsigned v : 1;     /* valid bit */
70
        unsigned v : 1;     /* valid bit */
75
        unsigned d : 1;     /* dirty/write-protect bit */
71
        unsigned d : 1;     /* dirty/write-protect bit */
76
        unsigned c : 3;     /* cache coherency attribute */
72
        unsigned c : 3;     /* cache coherency attribute */
77
        unsigned pfn : 24;  /* frame number */
73
        unsigned pfn : 24;  /* frame number */
78
        unsigned : 2;       /* zero */
74
        unsigned : 2;       /* zero */
79
#endif
75
#endif
80
    } __attribute__ ((packed));
76
    } __attribute__ ((packed));
81
    uint32_t value;
77
    uint32_t value;
82
} entry_lo_t;
78
} entry_lo_t;
83
 
79
 
Line 161... Line 157...
161
static inline void tlbwr(void)
157
static inline void tlbwr(void)
162
{
158
{
163
    asm volatile ("tlbwr\n\t");
159
    asm volatile ("tlbwr\n\t");
164
}
160
}
165
 
161
 
166
#define tlb_invalidate(asid)    tlb_invalidate_asid(asid)
162
#define tlb_invalidate(asid)  tlb_invalidate_asid(asid)
167
 
163
 
168
extern void tlb_invalid(istate_t *istate);
164
extern void tlb_invalid(istate_t *istate);
169
extern void tlb_refill(istate_t *istate);
165
extern void tlb_refill(istate_t *istate);
170
extern void tlb_modified(istate_t *istate);
166
extern void tlb_modified(istate_t *istate);
171
extern void tlb_prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, bool cacheable, uintptr_t pfn);
167
extern void tlb_prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, bool cacheable, uintptr_t pfn);