segmentation.py (7087:fb8d5786ff30) | segmentation.py (7622:b49144029ec8) |
---|---|
1# Copyright (c) 2007 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 24 unchanged lines hidden (view full) --- 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36# Authors: Gabe Black 37 38microcode = ''' 39def macroop LGDT_M 40{ | 1# Copyright (c) 2007 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 24 unchanged lines hidden (view full) --- 33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35# 36# Authors: Gabe Black 37 38microcode = ''' 39def macroop LGDT_M 40{ |
41 .serializing |
|
41 .adjust_env maxOsz 42 43 # Get the limit 44 ld t1, seg, sib, disp, dataSize=2 45 # Get the base 46 ld t2, seg, sib, 'adjustedDisp + 2' 47 wrbase tsg, t2 48 wrlimit tsg, t1 49}; 50 51def macroop LGDT_P 52{ | 42 .adjust_env maxOsz 43 44 # Get the limit 45 ld t1, seg, sib, disp, dataSize=2 46 # Get the base 47 ld t2, seg, sib, 'adjustedDisp + 2' 48 wrbase tsg, t2 49 wrlimit tsg, t1 50}; 51 52def macroop LGDT_P 53{ |
54 .serializing |
|
53 .adjust_env maxOsz 54 55 rdip t7 56 # Get the limit 57 ld t1, seg, riprel, disp, dataSize=2 58 # Get the base 59 ld t2, seg, riprel, 'adjustedDisp + 2' 60 wrbase tsg, t2 61 wrlimit tsg, t1 62}; 63 64# 65# These versions are for when the original data size was 16 bits. The base is 66# still 32 bits, but the top byte is zeroed before being used. 67# 68 69def macroop LGDT_16_M 70{ | 55 .adjust_env maxOsz 56 57 rdip t7 58 # Get the limit 59 ld t1, seg, riprel, disp, dataSize=2 60 # Get the base 61 ld t2, seg, riprel, 'adjustedDisp + 2' 62 wrbase tsg, t2 63 wrlimit tsg, t1 64}; 65 66# 67# These versions are for when the original data size was 16 bits. The base is 68# still 32 bits, but the top byte is zeroed before being used. 69# 70 71def macroop LGDT_16_M 72{ |
73 .serializing |
|
71 .adjust_env maxOsz 72 73 # Get the limit 74 ld t1, seg, sib, disp, dataSize=2 75 # Get the base 76 ld t2, seg, sib, 'adjustedDisp + 2', dataSize=4 77 zexti t2, t2, 23, dataSize=8 78 wrbase tsg, t2 79 wrlimit tsg, t1 80}; 81 82def macroop LGDT_16_P 83{ | 74 .adjust_env maxOsz 75 76 # Get the limit 77 ld t1, seg, sib, disp, dataSize=2 78 # Get the base 79 ld t2, seg, sib, 'adjustedDisp + 2', dataSize=4 80 zexti t2, t2, 23, dataSize=8 81 wrbase tsg, t2 82 wrlimit tsg, t1 83}; 84 85def macroop LGDT_16_P 86{ |
87 .serializing |
|
84 .adjust_env maxOsz 85 86 rdip t7 87 # Get the limit 88 ld t1, seg, riprel, disp, dataSize=2 89 # Get the base 90 ld t2, seg, riprel, 'adjustedDisp + 2', dataSize=4 91 zexti t2, t2, 23, dataSize=8 92 wrbase tsg, t2 93 wrlimit tsg, t1 94}; 95 96def macroop LIDT_M 97{ | 88 .adjust_env maxOsz 89 90 rdip t7 91 # Get the limit 92 ld t1, seg, riprel, disp, dataSize=2 93 # Get the base 94 ld t2, seg, riprel, 'adjustedDisp + 2', dataSize=4 95 zexti t2, t2, 23, dataSize=8 96 wrbase tsg, t2 97 wrlimit tsg, t1 98}; 99 100def macroop LIDT_M 101{ |
102 .serializing |
|
98 .adjust_env maxOsz 99 100 # Get the limit 101 ld t1, seg, sib, disp, dataSize=2 102 # Get the base 103 ld t2, seg, sib, 'adjustedDisp + 2' 104 wrbase idtr, t2 105 wrlimit idtr, t1 106}; 107 108def macroop LIDT_P 109{ | 103 .adjust_env maxOsz 104 105 # Get the limit 106 ld t1, seg, sib, disp, dataSize=2 107 # Get the base 108 ld t2, seg, sib, 'adjustedDisp + 2' 109 wrbase idtr, t2 110 wrlimit idtr, t1 111}; 112 113def macroop LIDT_P 114{ |
115 .serializing |
|
110 .adjust_env maxOsz 111 112 rdip t7 113 # Get the limit 114 ld t1, seg, riprel, disp, dataSize=2 115 # Get the base 116 ld t2, seg, riprel, 'adjustedDisp + 2' 117 wrbase idtr, t2 118 wrlimit idtr, t1 119}; 120 121# 122# These versions are for when the original data size was 16 bits. The base is 123# still 32 bits, but the top byte is zeroed before being used. 124# 125 126def macroop LIDT_16_M 127{ | 116 .adjust_env maxOsz 117 118 rdip t7 119 # Get the limit 120 ld t1, seg, riprel, disp, dataSize=2 121 # Get the base 122 ld t2, seg, riprel, 'adjustedDisp + 2' 123 wrbase idtr, t2 124 wrlimit idtr, t1 125}; 126 127# 128# These versions are for when the original data size was 16 bits. The base is 129# still 32 bits, but the top byte is zeroed before being used. 130# 131 132def macroop LIDT_16_M 133{ |
134 .serializing |
|
128 .adjust_env maxOsz 129 130 # Get the limit 131 ld t1, seg, sib, disp, dataSize=2 132 # Get the base 133 ld t2, seg, sib, 'adjustedDisp + 2', dataSize=4 134 zexti t2, t2, 23, dataSize=8 135 wrbase idtr, t2 136 wrlimit idtr, t1 137}; 138 139def macroop LIDT_16_P 140{ | 135 .adjust_env maxOsz 136 137 # Get the limit 138 ld t1, seg, sib, disp, dataSize=2 139 # Get the base 140 ld t2, seg, sib, 'adjustedDisp + 2', dataSize=4 141 zexti t2, t2, 23, dataSize=8 142 wrbase idtr, t2 143 wrlimit idtr, t1 144}; 145 146def macroop LIDT_16_P 147{ |
148 .serializing |
|
141 .adjust_env maxOsz 142 143 rdip t7 144 # Get the limit 145 ld t1, seg, riprel, disp, dataSize=2 146 # Get the base 147 ld t2, seg, riprel, 'adjustedDisp + 2', dataSize=4 148 zexti t2, t2, 23, dataSize=8 149 wrbase idtr, t2 150 wrlimit idtr, t1 151}; 152 153def macroop LTR_R 154{ | 149 .adjust_env maxOsz 150 151 rdip t7 152 # Get the limit 153 ld t1, seg, riprel, disp, dataSize=2 154 # Get the base 155 ld t2, seg, riprel, 'adjustedDisp + 2', dataSize=4 156 zexti t2, t2, 23, dataSize=8 157 wrbase idtr, t2 158 wrlimit idtr, t1 159}; 160 161def macroop LTR_R 162{ |
163 .serializing |
|
155 chks reg, t0, TRCheck 156 limm t4, 0, dataSize=8 157 srli t4, reg, 3, dataSize=2 158 ldst t1, tsg, [8, t4, t0], dataSize=8 159 ld t2, tsg, [8, t4, t0], 8, dataSize=8 160 chks reg, t1, TSSCheck 161 wrdh t3, t1, t2 162 wrdl tr, t1, reg 163 wrbase tr, t3, dataSize=8 164 limm t5, (1 << 9) 165 or t1, t1, t5 166 st t1, tsg, [8, t4, t0], dataSize=8 167}; 168 169def macroop LTR_M 170{ | 164 chks reg, t0, TRCheck 165 limm t4, 0, dataSize=8 166 srli t4, reg, 3, dataSize=2 167 ldst t1, tsg, [8, t4, t0], dataSize=8 168 ld t2, tsg, [8, t4, t0], 8, dataSize=8 169 chks reg, t1, TSSCheck 170 wrdh t3, t1, t2 171 wrdl tr, t1, reg 172 wrbase tr, t3, dataSize=8 173 limm t5, (1 << 9) 174 or t1, t1, t5 175 st t1, tsg, [8, t4, t0], dataSize=8 176}; 177 178def macroop LTR_M 179{ |
180 .serializing |
|
171 ld t5, seg, sib, disp, dataSize=2 172 chks t5, t0, TRCheck 173 limm t4, 0, dataSize=8 174 srli t4, t5, 3, dataSize=2 175 ldst t1, tsg, [8, t4, t0], dataSize=8 176 ld t2, tsg, [8, t4, t0], 8, dataSize=8 177 chks t5, t1, TSSCheck 178 wrdh t3, t1, t2 179 wrdl tr, t1, t5 180 wrbase tr, t3, dataSize=8 181 limm t5, (1 << 9) 182 or t1, t1, t5 183 st t1, tsg, [8, t4, t0], dataSize=8 184}; 185 186def macroop LTR_P 187{ | 181 ld t5, seg, sib, disp, dataSize=2 182 chks t5, t0, TRCheck 183 limm t4, 0, dataSize=8 184 srli t4, t5, 3, dataSize=2 185 ldst t1, tsg, [8, t4, t0], dataSize=8 186 ld t2, tsg, [8, t4, t0], 8, dataSize=8 187 chks t5, t1, TSSCheck 188 wrdh t3, t1, t2 189 wrdl tr, t1, t5 190 wrbase tr, t3, dataSize=8 191 limm t5, (1 << 9) 192 or t1, t1, t5 193 st t1, tsg, [8, t4, t0], dataSize=8 194}; 195 196def macroop LTR_P 197{ |
198 .serializing |
|
188 rdip t7 189 ld t5, seg, riprel, disp, dataSize=2 190 chks t5, t0, TRCheck 191 limm t4, 0, dataSize=8 192 srli t4, t5, 3, dataSize=2 193 ldst t1, tsg, [8, t4, t0], dataSize=8 194 ld t2, tsg, [8, t4, t0], 8, dataSize=8 195 chks t5, t1, TSSCheck 196 wrdh t3, t1, t2 197 wrdl tr, t1, t5 198 wrbase tr, t3, dataSize=8 199 limm t5, (1 << 9) 200 or t1, t1, t5 201 st t1, tsg, [8, t4, t0], dataSize=8 202}; 203 204def macroop LLDT_R 205{ | 199 rdip t7 200 ld t5, seg, riprel, disp, dataSize=2 201 chks t5, t0, TRCheck 202 limm t4, 0, dataSize=8 203 srli t4, t5, 3, dataSize=2 204 ldst t1, tsg, [8, t4, t0], dataSize=8 205 ld t2, tsg, [8, t4, t0], 8, dataSize=8 206 chks t5, t1, TSSCheck 207 wrdh t3, t1, t2 208 wrdl tr, t1, t5 209 wrbase tr, t3, dataSize=8 210 limm t5, (1 << 9) 211 or t1, t1, t5 212 st t1, tsg, [8, t4, t0], dataSize=8 213}; 214 215def macroop LLDT_R 216{ |
217 .serializing |
|
206 chks reg, t0, InGDTCheck, flags=(EZF,) 207 br label("end"), flags=(CEZF,) 208 limm t4, 0, dataSize=8 209 srli t4, reg, 3, dataSize=2 210 ldst t1, tsg, [8, t4, t0], dataSize=8 211 ld t2, tsg, [8, t4, t0], 8, dataSize=8 212 chks reg, t1, LDTCheck 213 wrdh t3, t1, t2 214 wrdl tr, t1, reg 215 wrbase tr, t3, dataSize=8 216end: 217 fault "NoFault" 218}; 219 220def macroop LLDT_M 221{ | 218 chks reg, t0, InGDTCheck, flags=(EZF,) 219 br label("end"), flags=(CEZF,) 220 limm t4, 0, dataSize=8 221 srli t4, reg, 3, dataSize=2 222 ldst t1, tsg, [8, t4, t0], dataSize=8 223 ld t2, tsg, [8, t4, t0], 8, dataSize=8 224 chks reg, t1, LDTCheck 225 wrdh t3, t1, t2 226 wrdl tr, t1, reg 227 wrbase tr, t3, dataSize=8 228end: 229 fault "NoFault" 230}; 231 232def macroop LLDT_M 233{ |
234 .serializing |
|
222 ld t5, seg, sib, disp, dataSize=2 223 chks t5, t0, InGDTCheck, flags=(EZF,) 224 br label("end"), flags=(CEZF,) 225 limm t4, 0, dataSize=8 226 srli t4, t5, 3, dataSize=2 227 ldst t1, tsg, [8, t4, t0], dataSize=8 228 ld t2, tsg, [8, t4, t0], 8, dataSize=8 229 chks t5, t1, LDTCheck 230 wrdh t3, t1, t2 231 wrdl tr, t1, t5 232 wrbase tr, t3, dataSize=8 233end: 234 fault "NoFault" 235}; 236 237def macroop LLDT_P 238{ | 235 ld t5, seg, sib, disp, dataSize=2 236 chks t5, t0, InGDTCheck, flags=(EZF,) 237 br label("end"), flags=(CEZF,) 238 limm t4, 0, dataSize=8 239 srli t4, t5, 3, dataSize=2 240 ldst t1, tsg, [8, t4, t0], dataSize=8 241 ld t2, tsg, [8, t4, t0], 8, dataSize=8 242 chks t5, t1, LDTCheck 243 wrdh t3, t1, t2 244 wrdl tr, t1, t5 245 wrbase tr, t3, dataSize=8 246end: 247 fault "NoFault" 248}; 249 250def macroop LLDT_P 251{ |
252 .serializing |
|
239 rdip t7 240 ld t5, seg, riprel, disp, dataSize=2 241 chks t5, t0, InGDTCheck, flags=(EZF,) 242 br label("end"), flags=(CEZF,) 243 limm t4, 0, dataSize=8 244 srli t4, t5, 3, dataSize=2 245 ldst t1, tsg, [8, t4, t0], dataSize=8 246 ld t2, tsg, [8, t4, t0], 8, dataSize=8 --- 16 unchanged lines hidden --- | 253 rdip t7 254 ld t5, seg, riprel, disp, dataSize=2 255 chks t5, t0, InGDTCheck, flags=(EZF,) 256 br label("end"), flags=(CEZF,) 257 limm t4, 0, dataSize=8 258 srli t4, t5, 3, dataSize=2 259 ldst t1, tsg, [8, t4, t0], dataSize=8 260 ld t2, tsg, [8, t4, t0], 8, dataSize=8 --- 16 unchanged lines hidden --- |