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 ROL_R_I
40{
41    roli reg, reg, imm, flags=(OF,CF)
42};
43
44def macroop ROL_M_I
45{
46    ldst t1, seg, sib, disp
47    roli t1, t1, imm, flags=(OF,CF)
48    st t1, seg, sib, disp
49};
50
51def macroop ROL_P_I
52{
53    rdip t7
54    ldst t1, seg, riprel, disp
55    roli t1, t1, imm, flags=(OF,CF)
56    st t1, seg, riprel, disp
57};
58
59def macroop ROL_1_R
60{
61    roli reg, reg, 1, flags=(OF,CF)
62};
63
64def macroop ROL_1_M
65{
66    ldst t1, seg, sib, disp
67    roli t1, t1, 1, flags=(OF,CF)
68    st t1, seg, sib, disp
69};
70
71def macroop ROL_1_P
72{
73    rdip t7
74    ldst t1, seg, riprel, disp
75    roli t1, t1, 1, flags=(OF,CF)
76    st t1, seg, riprel, disp
77};
78
79def macroop ROL_R_R
80{
81    rol reg, reg, regm, flags=(OF,CF)
82};
83
84def macroop ROL_M_R
85{
86    ldst t1, seg, sib, disp
87    rol t1, t1, reg, flags=(OF,CF)
88    st t1, seg, sib, disp
89};
90
91def macroop ROL_P_R
92{
93    rdip t7
94    ldst t1, seg, riprel, disp
95    rol t1, t1, reg, flags=(OF,CF)
96    st t1, seg, riprel, disp
97};
98
99def macroop ROR_R_I
100{
101    rori reg, reg, imm, flags=(OF,CF)
102};
103
104def macroop ROR_M_I
105{
106    ldst t1, seg, sib, disp
107    rori t1, t1, imm, flags=(OF,CF)
108    st t1, seg, sib, disp
109};
110
111def macroop ROR_P_I
112{
113    rdip t7
114    ldst t1, seg, riprel, disp
115    rori t1, t1, imm, flags=(OF,CF)
116    st t1, seg, riprel, disp
117};
118
119def macroop ROR_1_R
120{
121    rori reg, reg, 1, flags=(OF,CF)
122};
123
124def macroop ROR_1_M
125{
126    ldst t1, seg, sib, disp
127    rori t1, t1, 1, flags=(OF,CF)
128    st t1, seg, sib, disp
129};
130
131def macroop ROR_1_P
132{
133    rdip t7
134    ldst t1, seg, riprel, disp
135    rori t1, t1, 1, flags=(OF,CF)
136    st t1, seg, riprel, disp
137};
138
139def macroop ROR_R_R
140{
141    ror reg, reg, regm, flags=(OF,CF)
142};
143
144def macroop ROR_M_R
145{
146    ldst t1, seg, sib, disp
147    ror t1, t1, reg, flags=(OF,CF)
148    st t1, seg, sib, disp
149};
150
151def macroop ROR_P_R
152{
153    rdip t7
154    ldst t1, seg, riprel, disp
155    ror t1, t1, reg, flags=(OF,CF)
156    st t1, seg, riprel, disp
157};
158
159def macroop RCL_R_I
160{
161    rcli reg, reg, imm, flags=(OF,CF)
162};
163
164def macroop RCL_M_I
165{
166    ldst t1, seg, sib, disp
167    rcli t1, t1, imm, flags=(OF,CF)
168    st t1, seg, sib, disp
169};
170
171def macroop RCL_P_I
172{
173    rdip t7
174    ldst t1, seg, riprel, disp
175    rcli t1, t1, imm, flags=(OF,CF)
176    st t1, seg, riprel, disp
177};
178
179def macroop RCL_1_R
180{
181    rcli reg, reg, 1, flags=(OF,CF)
182};
183
184def macroop RCL_1_M
185{
186    ldst t1, seg, sib, disp
187    rcli t1, t1, 1, flags=(OF,CF)
188    st t1, seg, sib, disp
189};
190
191def macroop RCL_1_P
192{
193    rdip t7
194    ldst t1, seg, riprel, disp
195    rcli t1, t1, 1, flags=(OF,CF)
196    st t1, seg, riprel, disp
197};
198
199def macroop RCL_R_R
200{
201    rcl reg, reg, regm, flags=(OF,CF)
202};
203
204def macroop RCL_M_R
205{
206    ldst t1, seg, sib, disp
207    rcl t1, t1, reg, flags=(OF,CF)
208    st t1, seg, sib, disp
209};
210
211def macroop RCL_P_R
212{
213    rdip t7
214    ldst t1, seg, riprel, disp
215    rcl t1, t1, reg, flags=(OF,CF)
216    st t1, seg, riprel, disp
217};
218
219def macroop RCR_R_I
220{
221    rcri reg, reg, imm, flags=(OF,CF)
222};
223
224def macroop RCR_M_I
225{
226    ldst t1, seg, sib, disp
227    rcri t1, t1, imm, flags=(OF,CF)
228    st t1, seg, sib, disp
229};
230
231def macroop RCR_P_I
232{
233    rdip t7
234    ldst t1, seg, riprel, disp
235    rcri t1, t1, imm, flags=(OF,CF)
236    st t1, seg, riprel, disp
237};
238
239def macroop RCR_1_R
240{
241    rcri reg, reg, 1, flags=(OF,CF)
242};
243
244def macroop RCR_1_M
245{
246    ldst t1, seg, sib, disp
247    rcri t1, t1, 1, flags=(OF,CF)
248    st t1, seg, sib, disp
249};
250
251def macroop RCR_1_P
252{
253    rdip t7
254    ldst t1, seg, riprel, disp
255    rcri t1, t1, 1, flags=(OF,CF)
256    st t1, seg, riprel, disp
257};
258
259def macroop RCR_R_R
260{
261    rcr reg, reg, regm, flags=(OF,CF)
262};
263
264def macroop RCR_M_R
265{
266    ldst t1, seg, sib, disp
267    rcr t1, t1, reg, flags=(OF,CF)
268    st t1, seg, sib, disp
269};
270
271def macroop RCR_P_R
272{
273    rdip t7
274    ldst t1, seg, riprel, disp
275    rcr t1, t1, reg, flags=(OF,CF)
276    st t1, seg, riprel, disp
277};
278'''
279