Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: tlb.fth | |
4 | \ | |
5 | \ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | \ | |
7 | \ - Do no alter or remove copyright notices | |
8 | \ | |
9 | \ - Redistribution and use of this software in source and binary forms, with | |
10 | \ or without modification, are permitted provided that the following | |
11 | \ conditions are met: | |
12 | \ | |
13 | \ - Redistribution of source code must retain the above copyright notice, | |
14 | \ this list of conditions and the following disclaimer. | |
15 | \ | |
16 | \ - Redistribution in binary form must reproduce the above copyright notice, | |
17 | \ this list of conditions and the following disclaimer in the | |
18 | \ documentation and/or other materials provided with the distribution. | |
19 | \ | |
20 | \ Neither the name of Sun Microsystems, Inc. or the names of contributors | |
21 | \ may be used to endorse or promote products derived from this software | |
22 | \ without specific prior written permission. | |
23 | \ | |
24 | \ This software is provided "AS IS," without a warranty of any kind. | |
25 | \ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
26 | \ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
27 | \ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
28 | \ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
29 | \ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
30 | \ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
31 | \ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
32 | \ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
33 | \ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
34 | \ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
35 | \ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
36 | \ | |
37 | \ You acknowledge that this software is not designed, licensed or | |
38 | \ intended for use in the design, construction, operation or maintenance of | |
39 | \ any nuclear facility. | |
40 | \ | |
41 | \ ========== Copyright Header End ============================================ | |
42 | id: @(#)tlb.fth 1.1 06/02/16 | |
43 | purpose: | |
44 | copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headerless | |
48 | ||
49 | : va>va,ctx ( vadr -- vadr ctx# ) | |
50 | dup page#mask and swap pagemask and | |
51 | ; | |
52 | ||
53 | : demap-tlb ( addr -- ) | |
54 | 3 0 rot demap-page drop | |
55 | ; | |
56 | ||
57 | : demap-itlb ( addr -- ) | |
58 | 2 0 rot demap-page drop | |
59 | ; | |
60 | : demap-dtlb ( addr -- ) | |
61 | 1 0 rot demap-page drop | |
62 | ; | |
63 | : (.tte-soft1) ( tte -- ) | |
64 | 4 bits drop 2 bits .x drop | |
65 | ; | |
66 | : (.tte-soft2) ( tte -- ) | |
67 | d# 60 bits drop 2 bits .x drop | |
68 | ; | |
69 | ||
70 | : itlb-tar-dir! ( tte vadr -- ) | |
71 | 2 -rot va>va,ctx swap map-addr drop | |
72 | ; | |
73 | ||
74 | : dtlb-tar-dir! ( tte vadr -- ) | |
75 | 1 -rot va>va,ctx swap map-addr drop | |
76 | ; | |
77 | ||
78 | : itlb-tar-data! ( tte index tlb# vadr -- ) | |
79 | nip nip ( tte vadr ) | |
80 | 2 -rot va>va,ctx swap map-perm-addr drop | |
81 | ; | |
82 | ||
83 | : dtlb-tar-data! ( tte index tlb# vadr -- ) | |
84 | nip nip ( tte vadr ) | |
85 | 1 -rot va>va,ctx swap map-perm-addr drop | |
86 | ; | |
87 | ||
88 | headers | |
89 | defer .soft1 ( tte -- ) ' (.tte-soft1) is .soft1 | |
90 | defer .soft2 ( tte -- ) ' (.tte-soft2) is .soft2 | |
91 | ||
92 | : flush-tlb-page ( vadr -- ) | |
93 | pagesize round-down demap-tlb | |
94 | ; | |
95 | ||
96 | : flush-tlb-range ( vadr size -- ) | |
97 | over + pagesize round-up swap pagesize round-down | |
98 | ?do i demap-tlb pagesize +loop | |
99 | ; | |
100 | ||
101 | : flush-tlb-context ( -- ) \ XXX is this correct??? XXX | |
102 | \ h# 40 dup demap-itlb demap-dtlb | |
103 | ; | |
104 | ||
105 | : .tlb ( tlbdata -- ) | |
106 | >r r@ | |
107 | ." Size:" 3 bits .x | |
108 | 1bits drop | |
109 | ." Soft1:" 2 bits drop r@ .soft1 | |
110 | ." W:" 1bits . | |
111 | 1bits drop | |
112 | ." P:" 1bits . | |
113 | ." CV:" 1bits . | |
114 | ." CP:" 1bits . | |
115 | ." E:" 1bits . | |
116 | ." IE:" 1bits . | |
117 | ." PA[39:13]:" d# 27 bits dup .x | |
118 | ." PA:" pageshift lshift .x cr | |
119 | ( reserved ) d# 20 bits drop | |
120 | ." Soft2:" 2 bits drop r@ .soft2 | |
121 | ." NFO:" 1bits . | |
122 | ." V:" 1bits . | |
123 | r> 2drop | |
124 | ; | |
125 | ||
126 | headerless | |
127 | : is-ultra3+? ( ver -- flag ) | |
128 | d# 32 >> dup h# ff and swap d# 8 >> h# ff00 and or h# 3e15 = | |
129 | ; | |
130 | ||
131 | : is-ultra4? ( ver -- flag ) | |
132 | d# 32 >> dup h# ff and swap d# 8 >> h# ff00 and or h# 3e18 = | |
133 | ; | |
134 | ||
135 | : is-dtlb#3? ( ver -- flag ) | |
136 | dup is-ultra3+? swap is-ultra4? or | |
137 | ; | |
138 | ||
139 | : is-cmp? ( ver -- flag) is-ultra4? ; | |
140 | ||
141 | : #dtlb-entries ( tlb# -- #tlb-entries ) drop d# 128 ; | |
142 | : #itlb-entries ( tlb# -- #tlb-entries ) drop d# 128 ; | |
143 | ||
144 | headers |