1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# Redistribution and use of this software in source and binary forms, 5# with or without modification, are permitted provided that the 6# following conditions are met: 7# 8# The software must be used only for Non-Commercial Use which means any 9# use which is NOT directed to receiving any direct monetary 10# compensation for, or commercial advantage from such use. Illustrative 11# examples of non-commercial use are academic research, personal study, 12# teaching, education and corporate research & development. 13# Illustrative examples of commercial use are distributing products for 14# commercial advantage and providing services using the software for 15# commercial advantage. 16# 17# If you wish to use this software or functionality therein that may be 18# covered by patents for commercial use, please contact: 19# Director of Intellectual Property Licensing 20# Office of Strategy and Technology 21# Hewlett-Packard Company 22# 1501 Page Mill Road 23# Palo Alto, California 94304 24# 25# Redistributions of source code must retain the above copyright notice, 26# this list of conditions and the following disclaimer. Redistributions 27# in binary form must reproduce the above copyright notice, this list of 28# conditions and the following disclaimer in the documentation and/or 29# other materials provided with the distribution. Neither the name of 30# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 31# contributors may be used to endorse or promote products derived from 32# this software without specific prior written permission. No right of 33# sublicense is granted herewith. Derivatives of the software and 34# output created using the software may be prepared, but only for 35# Non-Commercial Uses. Derivatives of the software may be shared with 36# others provided: (i) the others agree to abide by the list of 37# conditions herein which includes the Non-Commercial Use restrictions; 38# and (ii) such Derivatives of the software include the above copyright 39# notice to acknowledge the contribution from this software where 40# applicable, this list of conditions and the disclaimer below. 41# 42# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53# 54# Authors: Gabe Black 55 56microcode = ''' 57 58# 59# Regular moves 60# 61 62def macroop MOV_R_MI { 63 limm t1, imm, dataSize=asz 64 ld reg, seg, [1, t0, t1] 65}; 66 67def macroop MOV_MI_R { 68 limm t1, imm, dataSize=asz 69 st reg, seg, [1, t0, t1] 70}; 71 72def macroop MOV_R_R { 73 mov reg, reg, regm 74}; 75 76def macroop MOV_M_R { 77 st reg, seg, sib, disp 78}; 79 80def macroop MOV_P_R { 81 rdip t7 82 st reg, seg, riprel, disp 83}; 84 85def macroop MOV_R_M { 86 ld reg, seg, sib, disp 87}; 88 89def macroop MOV_R_P { 90 rdip t7 91 ld reg, seg, riprel, disp 92}; 93 94def macroop MOV_R_I { 95 limm reg, imm 96}; 97 98def macroop MOV_M_I { 99 limm t1, imm 100 st t1, seg, sib, disp 101}; 102 103def macroop MOV_P_I { 104 rdip t7 105 limm t1, imm 106 st t1, seg, riprel, disp 107}; 108 109# 110# Sign extending moves 111# 112 113def macroop MOVSXD_R_R { 114 sexti reg, regm, 31 115}; 116 117def macroop MOVSXD_R_M { 118 ld t1, seg, sib, disp, dataSize=4 119 sexti reg, t1, 31 120}; 121 122def macroop MOVSXD_R_P { 123 rdip t7 124 ld t1, seg, riprel, disp, dataSize=4 125 sexti reg, t1, 31 126}; 127 128def macroop MOVSX_B_R_R {
| 1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company 2# All rights reserved. 3# 4# Redistribution and use of this software in source and binary forms, 5# with or without modification, are permitted provided that the 6# following conditions are met: 7# 8# The software must be used only for Non-Commercial Use which means any 9# use which is NOT directed to receiving any direct monetary 10# compensation for, or commercial advantage from such use. Illustrative 11# examples of non-commercial use are academic research, personal study, 12# teaching, education and corporate research & development. 13# Illustrative examples of commercial use are distributing products for 14# commercial advantage and providing services using the software for 15# commercial advantage. 16# 17# If you wish to use this software or functionality therein that may be 18# covered by patents for commercial use, please contact: 19# Director of Intellectual Property Licensing 20# Office of Strategy and Technology 21# Hewlett-Packard Company 22# 1501 Page Mill Road 23# Palo Alto, California 94304 24# 25# Redistributions of source code must retain the above copyright notice, 26# this list of conditions and the following disclaimer. Redistributions 27# in binary form must reproduce the above copyright notice, this list of 28# conditions and the following disclaimer in the documentation and/or 29# other materials provided with the distribution. Neither the name of 30# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 31# contributors may be used to endorse or promote products derived from 32# this software without specific prior written permission. No right of 33# sublicense is granted herewith. Derivatives of the software and 34# output created using the software may be prepared, but only for 35# Non-Commercial Uses. Derivatives of the software may be shared with 36# others provided: (i) the others agree to abide by the list of 37# conditions herein which includes the Non-Commercial Use restrictions; 38# and (ii) such Derivatives of the software include the above copyright 39# notice to acknowledge the contribution from this software where 40# applicable, this list of conditions and the disclaimer below. 41# 42# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53# 54# Authors: Gabe Black 55 56microcode = ''' 57 58# 59# Regular moves 60# 61 62def macroop MOV_R_MI { 63 limm t1, imm, dataSize=asz 64 ld reg, seg, [1, t0, t1] 65}; 66 67def macroop MOV_MI_R { 68 limm t1, imm, dataSize=asz 69 st reg, seg, [1, t0, t1] 70}; 71 72def macroop MOV_R_R { 73 mov reg, reg, regm 74}; 75 76def macroop MOV_M_R { 77 st reg, seg, sib, disp 78}; 79 80def macroop MOV_P_R { 81 rdip t7 82 st reg, seg, riprel, disp 83}; 84 85def macroop MOV_R_M { 86 ld reg, seg, sib, disp 87}; 88 89def macroop MOV_R_P { 90 rdip t7 91 ld reg, seg, riprel, disp 92}; 93 94def macroop MOV_R_I { 95 limm reg, imm 96}; 97 98def macroop MOV_M_I { 99 limm t1, imm 100 st t1, seg, sib, disp 101}; 102 103def macroop MOV_P_I { 104 rdip t7 105 limm t1, imm 106 st t1, seg, riprel, disp 107}; 108 109# 110# Sign extending moves 111# 112 113def macroop MOVSXD_R_R { 114 sexti reg, regm, 31 115}; 116 117def macroop MOVSXD_R_M { 118 ld t1, seg, sib, disp, dataSize=4 119 sexti reg, t1, 31 120}; 121 122def macroop MOVSXD_R_P { 123 rdip t7 124 ld t1, seg, riprel, disp, dataSize=4 125 sexti reg, t1, 31 126}; 127 128def macroop MOVSX_B_R_R {
|
164}; 165 166def macroop MOVZX_B_R_M { 167 ld t1, seg, sib, disp, dataSize=1 168 zexti reg, t1, 7 169}; 170 171def macroop MOVZX_B_R_P { 172 rdip t7 173 ld t1, seg, riprel, disp, dataSize=1 174 zexti reg, t1, 7 175}; 176 177def macroop MOVZX_W_R_R { 178 zexti reg, regm, 15 179}; 180 181def macroop MOVZX_W_R_M { 182 ld t1, seg, sib, disp, dataSize=2 183 zexti reg, t1, 15 184}; 185 186def macroop MOVZX_W_R_P { 187 rdip t7 188 ld t1, seg, riprel, disp, dataSize=2 189 zexti reg, t1, 15 190}; 191 192def macroop MOV_C_R { 193 wrcr reg, regm 194}; 195 196def macroop MOV_R_C { 197 rdcr reg, regm 198}; 199 200def macroop MOV_R_S { 201 rdsel reg, regm 202}; 203 204def macroop MOV_M_S { 205 rdsel t1, reg 206 st t1, seg, sib, disp, dataSize=2 207}; 208 209def macroop MOV_P_S { 210 rdip t7 211 rdsel t1, reg 212 st t1, seg, riprel, disp, dataSize=2 213}; 214 215def macroop MOV_REAL_S_R { 216 zext t2, regm, 15 217 slli t3, t2, 2, dataSize=8 218 wrsel reg, regm 219 wrbase reg, t3 220}; 221 222def macroop MOV_REAL_S_M { 223 ld t1, seg, sib, disp, dataSize=2 224 zext t2, t1, 15 225 slli t3, t2, 2, dataSize=8 226 wrsel reg, t1 227 wrbase reg, t3 228}; 229 230def macroop MOV_REAL_S_P { 231 rdip t7 232 ld t1, seg, riprel, disp, dataSize=2 233 zext t2, t1, 15 234 slli t3, t2, 2, dataSize=8 235 wrsel reg, t1 236 wrbase reg, t3 237}; 238 239def macroop MOV_S_R { 240 andi t0, regm, 0xFC, flags=(EZF,), dataSize=2 241 bri t0, label("processDescriptor"), flags=(CEZF,) 242 andi t2, regm, 0xF8, dataSize=8 243 andi t0, regm, 0x4, flags=(EZF,), dataSize=2 244 bri t0, label("globalDescriptor"), flags=(CEZF,) 245 ld t3, tsl, [1, t0, t2], dataSize=8 246 bri t0, label("processDescriptor") 247globalDescriptor: 248 ld t3, tsg, [1, t0, t2], dataSize=8 249processDescriptor: 250 chks regm, t3, dataSize=8 251 wrdl reg, t3, regm 252 wrsel reg, regm 253}; 254 255def macroop MOV_S_M { 256 ld t1, seg, sib, disp, dataSize=2 257 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 258 bri t0, label("processDescriptor"), flags=(CEZF,) 259 andi t2, t1, 0xF8, dataSize=8 260 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 261 bri t0, label("globalDescriptor"), flags=(CEZF,) 262 ld t3, tsl, [1, t0, t2], dataSize=8 263 bri t0, label("processDescriptor") 264globalDescriptor: 265 ld t3, tsg, [1, t0, t2], dataSize=8 266processDescriptor: 267 chks t1, t3, dataSize=8 268 wrdl reg, t3, t1 269 wrsel reg, t1 270}; 271 272def macroop MOV_S_P { 273 rdip t7 274 ld t1, seg, riprel, disp, dataSize=2 275 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 276 bri t0, label("processDescriptor"), flags=(CEZF,) 277 andi t2, t1, 0xF8, dataSize=8 278 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 279 bri t0, label("globalDescriptor"), flags=(CEZF,) 280 ld t3, tsl, [1, t0, t2], dataSize=8 281 bri t0, label("processDescriptor") 282globalDescriptor: 283 ld t3, tsg, [1, t0, t2], dataSize=8 284processDescriptor: 285 chks t1, t3, dataSize=8 286 wrdl reg, t3, t1 287 wrsel reg, t1 288}; 289 290def macroop MOVSS_S_R { 291 andi t0, regm, 0xFC, flags=(EZF,), dataSize=2 292 bri t0, label("processDescriptor"), flags=(CEZF,) 293 andi t2, regm, 0xF8, dataSize=8 294 andi t0, regm, 0x4, flags=(EZF,), dataSize=2 295 bri t0, label("globalDescriptor"), flags=(CEZF,) 296 ld t3, tsl, [1, t0, t2], dataSize=8 297 bri t0, label("processDescriptor") 298globalDescriptor: 299 ld t3, tsg, [1, t0, t2], dataSize=8 300processDescriptor: 301 chks regm, t3, SSCheck, dataSize=8 302 wrdl reg, t3, regm 303 wrsel reg, regm 304}; 305 306def macroop MOVSS_S_M { 307 ld t1, seg, sib, disp, dataSize=2 308 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 309 bri t0, label("processDescriptor"), flags=(CEZF,) 310 andi t2, t1, 0xF8, dataSize=8 311 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 312 bri t0, label("globalDescriptor"), flags=(CEZF,) 313 ld t3, tsl, [1, t0, t2], dataSize=8 314 bri t0, label("processDescriptor") 315globalDescriptor: 316 ld t3, tsg, [1, t0, t2], dataSize=8 317processDescriptor: 318 chks t1, t3, SSCheck, dataSize=8 319 wrdl reg, t3, t1 320 wrsel reg, t1 321}; 322 323def macroop MOVSS_S_P { 324 rdip t7 325 ld t1, seg, riprel, disp, dataSize=2 326 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 327 bri t0, label("processDescriptor"), flags=(CEZF,) 328 andi t2, t1, 0xF8, dataSize=8 329 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 330 bri t0, label("globalDescriptor"), flags=(CEZF,) 331 ld t3, tsl, [1, t0, t2], dataSize=8 332 bri t0, label("processDescriptor") 333globalDescriptor: 334 ld t3, tsg, [1, t0, t2], dataSize=8 335processDescriptor: 336 chks t1, t3, SSCheck, dataSize=8 337 wrdl reg, t3, t1 338 wrsel reg, t1 339}; 340''' 341#let {{ 342# class MOVD(Inst): 343# "GenFault ${new UnimpInstFault}" 344# class MOVNTI(Inst): 345# "GenFault ${new UnimpInstFault}" 346#}};
| 166}; 167 168def macroop MOVZX_B_R_M { 169 ld t1, seg, sib, disp, dataSize=1 170 zexti reg, t1, 7 171}; 172 173def macroop MOVZX_B_R_P { 174 rdip t7 175 ld t1, seg, riprel, disp, dataSize=1 176 zexti reg, t1, 7 177}; 178 179def macroop MOVZX_W_R_R { 180 zexti reg, regm, 15 181}; 182 183def macroop MOVZX_W_R_M { 184 ld t1, seg, sib, disp, dataSize=2 185 zexti reg, t1, 15 186}; 187 188def macroop MOVZX_W_R_P { 189 rdip t7 190 ld t1, seg, riprel, disp, dataSize=2 191 zexti reg, t1, 15 192}; 193 194def macroop MOV_C_R { 195 wrcr reg, regm 196}; 197 198def macroop MOV_R_C { 199 rdcr reg, regm 200}; 201 202def macroop MOV_R_S { 203 rdsel reg, regm 204}; 205 206def macroop MOV_M_S { 207 rdsel t1, reg 208 st t1, seg, sib, disp, dataSize=2 209}; 210 211def macroop MOV_P_S { 212 rdip t7 213 rdsel t1, reg 214 st t1, seg, riprel, disp, dataSize=2 215}; 216 217def macroop MOV_REAL_S_R { 218 zext t2, regm, 15 219 slli t3, t2, 2, dataSize=8 220 wrsel reg, regm 221 wrbase reg, t3 222}; 223 224def macroop MOV_REAL_S_M { 225 ld t1, seg, sib, disp, dataSize=2 226 zext t2, t1, 15 227 slli t3, t2, 2, dataSize=8 228 wrsel reg, t1 229 wrbase reg, t3 230}; 231 232def macroop MOV_REAL_S_P { 233 rdip t7 234 ld t1, seg, riprel, disp, dataSize=2 235 zext t2, t1, 15 236 slli t3, t2, 2, dataSize=8 237 wrsel reg, t1 238 wrbase reg, t3 239}; 240 241def macroop MOV_S_R { 242 andi t0, regm, 0xFC, flags=(EZF,), dataSize=2 243 bri t0, label("processDescriptor"), flags=(CEZF,) 244 andi t2, regm, 0xF8, dataSize=8 245 andi t0, regm, 0x4, flags=(EZF,), dataSize=2 246 bri t0, label("globalDescriptor"), flags=(CEZF,) 247 ld t3, tsl, [1, t0, t2], dataSize=8 248 bri t0, label("processDescriptor") 249globalDescriptor: 250 ld t3, tsg, [1, t0, t2], dataSize=8 251processDescriptor: 252 chks regm, t3, dataSize=8 253 wrdl reg, t3, regm 254 wrsel reg, regm 255}; 256 257def macroop MOV_S_M { 258 ld t1, seg, sib, disp, dataSize=2 259 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 260 bri t0, label("processDescriptor"), flags=(CEZF,) 261 andi t2, t1, 0xF8, dataSize=8 262 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 263 bri t0, label("globalDescriptor"), flags=(CEZF,) 264 ld t3, tsl, [1, t0, t2], dataSize=8 265 bri t0, label("processDescriptor") 266globalDescriptor: 267 ld t3, tsg, [1, t0, t2], dataSize=8 268processDescriptor: 269 chks t1, t3, dataSize=8 270 wrdl reg, t3, t1 271 wrsel reg, t1 272}; 273 274def macroop MOV_S_P { 275 rdip t7 276 ld t1, seg, riprel, disp, dataSize=2 277 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 278 bri t0, label("processDescriptor"), flags=(CEZF,) 279 andi t2, t1, 0xF8, dataSize=8 280 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 281 bri t0, label("globalDescriptor"), flags=(CEZF,) 282 ld t3, tsl, [1, t0, t2], dataSize=8 283 bri t0, label("processDescriptor") 284globalDescriptor: 285 ld t3, tsg, [1, t0, t2], dataSize=8 286processDescriptor: 287 chks t1, t3, dataSize=8 288 wrdl reg, t3, t1 289 wrsel reg, t1 290}; 291 292def macroop MOVSS_S_R { 293 andi t0, regm, 0xFC, flags=(EZF,), dataSize=2 294 bri t0, label("processDescriptor"), flags=(CEZF,) 295 andi t2, regm, 0xF8, dataSize=8 296 andi t0, regm, 0x4, flags=(EZF,), dataSize=2 297 bri t0, label("globalDescriptor"), flags=(CEZF,) 298 ld t3, tsl, [1, t0, t2], dataSize=8 299 bri t0, label("processDescriptor") 300globalDescriptor: 301 ld t3, tsg, [1, t0, t2], dataSize=8 302processDescriptor: 303 chks regm, t3, SSCheck, dataSize=8 304 wrdl reg, t3, regm 305 wrsel reg, regm 306}; 307 308def macroop MOVSS_S_M { 309 ld t1, seg, sib, disp, dataSize=2 310 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 311 bri t0, label("processDescriptor"), flags=(CEZF,) 312 andi t2, t1, 0xF8, dataSize=8 313 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 314 bri t0, label("globalDescriptor"), flags=(CEZF,) 315 ld t3, tsl, [1, t0, t2], dataSize=8 316 bri t0, label("processDescriptor") 317globalDescriptor: 318 ld t3, tsg, [1, t0, t2], dataSize=8 319processDescriptor: 320 chks t1, t3, SSCheck, dataSize=8 321 wrdl reg, t3, t1 322 wrsel reg, t1 323}; 324 325def macroop MOVSS_S_P { 326 rdip t7 327 ld t1, seg, riprel, disp, dataSize=2 328 andi t0, t1, 0xFC, flags=(EZF,), dataSize=2 329 bri t0, label("processDescriptor"), flags=(CEZF,) 330 andi t2, t1, 0xF8, dataSize=8 331 andi t0, t1, 0x4, flags=(EZF,), dataSize=2 332 bri t0, label("globalDescriptor"), flags=(CEZF,) 333 ld t3, tsl, [1, t0, t2], dataSize=8 334 bri t0, label("processDescriptor") 335globalDescriptor: 336 ld t3, tsg, [1, t0, t2], dataSize=8 337processDescriptor: 338 chks t1, t3, SSCheck, dataSize=8 339 wrdl reg, t3, t1 340 wrsel reg, t1 341}; 342''' 343#let {{ 344# class MOVD(Inst): 345# "GenFault ${new UnimpInstFault}" 346# class MOVNTI(Inst): 347# "GenFault ${new UnimpInstFault}" 348#}};
|