OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mp3/] [sw/] [mmu/] [immu.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 505 lampret
/* Basic instruction set test */
2
#include "../support/spr_defs.h"
3
 
4
.global _main
5
.global _buserr_except
6
.global _dpf_except
7
.global _ipf_except
8
.global _lpint_except
9
.global _align_except
10
.global _illegal_except
11
.global _hpint_except
12
.global _dtlbmiss_except
13
.global _itlbmiss_except
14
.global _range_except
15
.global _syscall_except
16
.global _res1_except
17
.global _trap_except
18
.global _res2_except
19
 
20
_buserr_except:
21
_dpf_except:
22
_lpint_except:
23
_align_except:
24
_illegal_except:
25
_hpint_except:
26
_dtlbmiss_except:
27
_range_except:
28
_syscall_except:
29
_res1_except:
30
_trap_except:
31
_res2_except:
32
        l.nop
33 564 lampret
        l.ori   r3,r0,0xeeee
34
        l.jal   _report
35 505 lampret
        l.nop
36 564 lampret
        l.jal   _exit
37
        l.nop
38 505 lampret
 
39
_ipf_except:
40
        // Valid entry 1, 1:1, full access
41
        l.addi  r14,r0,64
42
        l.movhi r5,hi(0x00002000|SPR_ITLBMR_V)
43
        l.ori   r5,r5,lo(0x00002000|SPR_ITLBMR_V)
44
        l.mtspr r0,r5,SPR_ITLBMR_BASE(0)+1
45
        l.movhi r5,hi(0x00002000|SPR_ITLBTR_SXE|SPR_ITLBTR_UXE)
46
        l.ori   r5,r5,lo(0x00002000|SPR_ITLBTR_SXE|SPR_ITLBTR_UXE)
47
        l.mtspr r0,r5,SPR_ITLBTR_BASE(0)+1
48
        l.rfe
49
        l.nop
50
 
51
_itlbmiss_except:
52
        // Valid entry 1, but no execute access
53
        l.addi  r13,r0,128
54
        l.movhi r5,hi(0x00002000|SPR_ITLBMR_V)
55
        l.ori   r5,r5,lo(0x00002000|SPR_ITLBMR_V)
56
        l.mtspr r0,r5,SPR_ITLBMR_BASE(0)+1
57
        l.ori   r5,r0,0
58
        l.mtspr r0,r5,SPR_ITLBTR_BASE(0)+1
59
        l.rfe
60
        l.nop
61
 
62
//
63
// r4, r5       - used by exception handlers
64
// r7, r8       - used by main for setting TLB
65
// r11          - accumulator of magic words
66
// r13, r14     - used ONLY by exception handlers for magic words
67
 
68
_main:
69
        l.nop
70
        l.addi  r11,r0,1
71
 
72
        // Valid entry 0, 1:1, full access
73
        l.movhi r5,hi(0x00000000|SPR_ITLBMR_V)
74
        l.ori   r5,r5,lo(0x00000000|SPR_ITLBMR_V)
75
        l.mtspr r0,r5,SPR_ITLBMR_BASE(0)
76
        l.movhi r5,hi(0x00000000|SPR_ITLBTR_UXE|SPR_ITLBTR_SXE)
77
        l.ori   r5,r5,lo(0x00000000|SPR_ITLBTR_UXE|SPR_ITLBTR_SXE)
78
        l.mtspr r0,r5,SPR_ITLBTR_BASE(0)
79
 
80
        // Invalidate entry 1
81
        l.movhi r7,hi(0x00002000)
82
        l.mtspr r0,r7,SPR_ITLBMR_BASE(0)+1
83
        l.ori   r7,r0,0
84
        l.mtspr r0,r7,SPR_ITLBTR_BASE(0)+1
85
 
86
        // Enable IMMU
87
        l.ori   r8,r0,SPR_SR_IME
88
        l.mfspr r7,r0,SPR_SR
89
        l.or    r7,r7,r8
90
        l.mtspr r0,r7,SPR_SR
91
        l.nop
92
        l.nop
93
        l.addi  r11,r11,16
94
 
95
        // Invoke ITLB miss and IPF exceptions
96
        l.jal   _immu_test
97
        l.addi  r11,r11,4
98
 
99
        // Some more magic words
100
        l.addi  r11,r11,8
101
        l.add   r11,r11,r13
102
        l.add   r11,r11,r14
103
 
104
        // Disable IMMU
105
        l.ori   r8,r0,SPR_SR_IME
106
        l.mfspr r7,r0,SPR_SR
107
        l.xor   r7,r7,r8
108
        l.mtspr r0,r7,SPR_SR
109
        l.nop
110
 
111
        // Exit
112
        l.nop
113
        l.movhi r12,hi(0xdeadde72)
114
        l.ori   r12,r12,lo(0xdeadde72)
115 564 lampret
        l.xor   r3,r11,r12
116
        l.jal   _report
117 505 lampret
        l.nop
118 564 lampret
        l.jal   _exit
119 505 lampret
        l.nop
120
        l.nop
121
 
122
 
123
.org 0x2000
124
 
125
_immu_test:
126
        l.addi  r11,r11,2
127
        l.jr    r9
128
        l.nop
129
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.