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 9# terms below provided that you ensure that this notice is replicated 10# unmodified and in its entirety in all distributions of the software, 11# modified or unmodified, in source code or in binary form. 12# 13# Redistribution and use in source and binary forms, with or without 14# modification, are permitted provided that the following conditions are 15# met: redistributions of source code must retain the above copyright 16# notice, this list of conditions and the following disclaimer; 17# redistributions in binary form must reproduce the above copyright 18# notice, this list of conditions and the following disclaimer in the 19# documentation and/or other materials provided with the distribution; 20# neither the name of the copyright holders nor the names of its 21# contributors may be used to endorse or promote products derived from 22# this software without specific prior written permission. 23# 24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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 SAL_R_I 40{ 41 slli reg, reg, imm, flags=(CF,OF,SF,ZF,PF) 42}; 43 44def macroop SAL_M_I 45{ 46 ldst t1, seg, sib, disp 47 slli t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 48 st t1, seg, sib, disp 49}; 50 51def macroop SAL_P_I 52{ 53 rdip t7 54 ldst t1, seg, riprel, disp 55 slli t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 56 st t1, seg, riprel, disp 57}; 58 59def macroop SAL_1_R 60{ 61 slli reg, reg, 1, flags=(CF,OF,SF,ZF,PF) 62}; 63 64def macroop SAL_1_M 65{ 66 ldst t1, seg, sib, disp 67 slli t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 68 st t1, seg, sib, disp 69}; 70 71def macroop SAL_1_P 72{ 73 rdip t7 74 ldst t1, seg, riprel, disp 75 slli t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 76 st t1, seg, riprel, disp 77}; 78 79def macroop SAL_R_R 80{ 81 sll reg, reg, regm, flags=(CF,OF,SF,ZF,PF) 82}; 83 84def macroop SAL_M_R 85{ 86 ldst t1, seg, sib, disp 87 sll t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 88 st t1, seg, sib, disp 89}; 90 91def macroop SAL_P_R 92{ 93 rdip t7 94 ldst t1, seg, riprel, disp 95 sll t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 96 st t1, seg, riprel, disp 97}; 98 99def macroop SHLD_R_R 100{ 101 mdbi regm, 0 102 sld reg, reg, rcx, flags=(CF,OF,SF,ZF,PF) 103}; 104 105def macroop SHLD_M_R 106{ 107 ldst t1, seg, sib, disp 108 mdbi reg, 0 109 sld t1, t1, rcx, flags=(CF,OF,SF,ZF,PF) 110 st t1, seg, sib, disp 111}; 112 113def macroop SHLD_P_R 114{ 115 rdip t7 116 ldst t1, seg, riprel, disp 117 mdbi reg, 0 118 sld t1, t1, rcx, flags=(CF,OF,SF,ZF,PF) 119 st t1, seg, riprel, disp 120}; 121 122def macroop SHLD_R_R_I 123{ 124 mdbi regm, 0 125 sldi reg, reg, imm, flags=(CF,OF,SF,ZF,PF) 126}; 127 128def macroop SHLD_M_R_I 129{ 130 ldst t1, seg, sib, disp 131 mdbi reg, 0 132 sldi t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 133 st t1, seg, sib, disp 134}; 135 136def macroop SHLD_P_R_I 137{ 138 rdip t7 139 ldst t1, seg, riprel, disp 140 mdbi reg, 0 141 sldi t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 142 st t1, seg, riprel, disp 143}; 144 145def macroop SHR_R_I 146{ 147 srli reg, reg, imm, flags=(CF,OF,SF,ZF,PF) 148}; 149 150def macroop SHR_M_I 151{ 152 ldst t1, seg, sib, disp 153 srli t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 154 st t1, seg, sib, disp 155}; 156 157def macroop SHR_P_I 158{ 159 rdip t7 160 ldst t1, seg, riprel, disp 161 srli t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 162 st t1, seg, riprel, disp 163}; 164 165def macroop SHR_1_R 166{ 167 srli reg, reg, 1, flags=(CF,OF,SF,ZF,PF) 168}; 169 170def macroop SHR_1_M 171{ 172 ldst t1, seg, sib, disp 173 srli t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 174 st t1, seg, sib, disp 175}; 176 177def macroop SHR_1_P 178{ 179 rdip t7 180 ldst t1, seg, riprel, disp 181 srli t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 182 st t1, seg, riprel, disp 183}; 184 185def macroop SHR_R_R 186{ 187 srl reg, reg, regm, flags=(CF,OF,SF,ZF,PF) 188}; 189 190def macroop SHR_M_R 191{ 192 ldst t1, seg, sib, disp 193 srl t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 194 st t1, seg, sib, disp 195}; 196 197def macroop SHR_P_R 198{ 199 rdip t7 200 ldst t1, seg, riprel, disp 201 srl t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 202 st t1, seg, riprel, disp 203}; 204 205def macroop SHRD_R_R 206{ 207 mdbi regm, 0 208 srd reg, reg, rcx, flags=(CF,OF,SF,ZF,PF) 209}; 210 211def macroop SHRD_M_R 212{ 213 ldst t1, seg, sib, disp 214 mdbi reg, 0 215 srd t1, t1, rcx, flags=(CF,OF,SF,ZF,PF) 216 st t1, seg, sib, disp 217}; 218 219def macroop SHRD_P_R 220{ 221 rdip t7 222 ldst t1, seg, riprel, disp 223 mdbi reg, 0 224 srd t1, t1, rcx, flags=(CF,OF,SF,ZF,PF) 225 st t1, seg, riprel, disp 226}; 227 228def macroop SHRD_R_R_I 229{ 230 mdbi regm, 0 231 srdi reg, reg, imm, flags=(CF,OF,SF,ZF,PF) 232}; 233 234def macroop SHRD_M_R_I 235{ 236 ldst t1, seg, sib, disp 237 mdbi reg, 0 238 srdi t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 239 st t1, seg, sib, disp 240}; 241 242def macroop SHRD_P_R_I 243{ 244 rdip t7 245 ldst t1, seg, riprel, disp 246 mdbi reg, 0 247 srdi t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 248 st t1, seg, riprel, disp 249}; 250 251def macroop SAR_R_I 252{ 253 srai reg, reg, imm, flags=(CF,OF,SF,ZF,PF) 254}; 255 256def macroop SAR_M_I 257{ 258 ldst t1, seg, sib, disp 259 srai t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 260 st t1, seg, sib, disp 261}; 262 263def macroop SAR_P_I 264{ 265 rdip t7 266 ldst t1, seg, riprel, disp 267 srai t1, t1, imm, flags=(CF,OF,SF,ZF,PF) 268 st t1, seg, riprel, disp 269}; 270 271def macroop SAR_1_R 272{ 273 srai reg, reg, 1, flags=(CF,OF,SF,ZF,PF) 274}; 275 276def macroop SAR_1_M 277{ 278 ldst t1, seg, sib, disp 279 srai t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 280 st t1, seg, sib, disp 281}; 282 283def macroop SAR_1_P 284{ 285 rdip t7 286 ldst t1, seg, riprel, disp 287 srai t1, t1, 1, flags=(CF,OF,SF,ZF,PF) 288 st t1, seg, riprel, disp 289}; 290 291def macroop SAR_R_R 292{ 293 sra reg, reg, regm, flags=(CF,OF,SF,ZF,PF) 294}; 295 296def macroop SAR_M_R 297{ 298 ldst t1, seg, sib, disp 299 sra t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 300 st t1, seg, sib, disp 301}; 302 303def macroop SAR_P_R 304{ 305 rdip t7 306 ldst t1, seg, riprel, disp 307 sra t1, t1, reg, flags=(CF,OF,SF,ZF,PF) 308 st t1, seg, riprel, disp 309}; 310''' 311