summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/insts/general_purpose
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-09-19 18:25:17 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-09-19 18:25:17 -0700
commita54ae9f92b6000e8aaf5e056deaead8725c25a74 (patch)
treebd8bb93ef344056ab10dd0a7deaf8170a16bc44f /src/arch/x86/isa/insts/general_purpose
parenta1912df3601873c7014c8bc34183b8c3bd168cdc (diff)
downloadgem5-a54ae9f92b6000e8aaf5e056deaead8725c25a74.tar.xz
X86: Put in stubs for x87, 64 bit and 128 bit SIMD instruction microcode.
--HG-- rename : src/arch/x86/isa/insts/sse/__init__.py => src/arch/x86/isa/insts/simd128/__init__.py extra : convert_revision : efb4405aebaa4a04f33572e7d078ceca45872d9c
Diffstat (limited to 'src/arch/x86/isa/insts/general_purpose')
-rw-r--r--src/arch/x86/isa/insts/general_purpose/__init__.py79
-rw-r--r--src/arch/x86/isa/insts/general_purpose/arithmetic/__init__.py64
-rw-r--r--src/arch/x86/isa/insts/general_purpose/arithmetic/add_and_subtract.py300
-rw-r--r--src/arch/x86/isa/insts/general_purpose/arithmetic/increment_and_decrement.py96
-rw-r--r--src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py833
-rw-r--r--src/arch/x86/isa/insts/general_purpose/cache_and_memory_management.py72
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/__init__.py66
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_scan.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_test.py66
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/bounds.py60
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/compare.py108
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/set_byte_on_condition.py392
-rw-r--r--src/arch/x86/isa/insts/general_purpose/compare_and_test/test.py95
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/__init__.py66
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/call.py107
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/conditional_jump.py216
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py68
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/jump.py93
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py60
-rw-r--r--src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py78
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/__init__.py66
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/ascii_adjust.py66
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/bcd_adjust.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/endian_conversion.py60
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/extract_sign_mask.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/sign_extension.py67
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_conversion/translate.py60
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_transfer/__init__.py64
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_transfer/conditional_move.py344
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_transfer/move.py187
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py157
-rw-r--r--src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py98
-rw-r--r--src/arch/x86/isa/insts/general_purpose/flags/__init__.py63
-rw-r--r--src/arch/x86/isa/insts/general_purpose/flags/load_and_store.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py70
-rw-r--r--src/arch/x86/isa/insts/general_purpose/flags/set_and_clear.py93
-rw-r--r--src/arch/x86/isa/insts/general_purpose/input_output/__init__.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/input_output/general_io.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/input_output/string_io.py78
-rw-r--r--src/arch/x86/isa/insts/general_purpose/load_effective_address.py65
-rw-r--r--src/arch/x86/isa/insts/general_purpose/load_segment_registers.py72
-rw-r--r--src/arch/x86/isa/insts/general_purpose/logical.py247
-rw-r--r--src/arch/x86/isa/insts/general_purpose/no_operation.py61
-rw-r--r--src/arch/x86/isa/insts/general_purpose/processor_information.py405
-rw-r--r--src/arch/x86/isa/insts/general_purpose/rotate_and_shift/__init__.py62
-rw-r--r--src/arch/x86/isa/insts/general_purpose/rotate_and_shift/rotate.py296
-rw-r--r--src/arch/x86/isa/insts/general_purpose/rotate_and_shift/shift.py236
-rw-r--r--src/arch/x86/isa/insts/general_purpose/semaphores.py87
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/__init__.py65
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/compare_strings.py112
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/load_string.py68
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/move_string.py68
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/scan_string.py107
-rw-r--r--src/arch/x86/isa/insts/general_purpose/string/store_string.py68
-rw-r--r--src/arch/x86/isa/insts/general_purpose/system_calls.py66
55 files changed, 6849 insertions, 0 deletions
diff --git a/src/arch/x86/isa/insts/general_purpose/__init__.py b/src/arch/x86/isa/insts/general_purpose/__init__.py
new file mode 100644
index 000000000..4f77cb233
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/__init__.py
@@ -0,0 +1,79 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["arithmetic",
+ "cache_and_memory_management",
+ "compare_and_test",
+ "control_transfer",
+ "data_conversion",
+ "data_transfer",
+ "flags",
+ "input_output",
+ "load_effective_address",
+ "load_segment_registers",
+ "logical",
+ "no_operation",
+ "processor_information",
+ "rotate_and_shift",
+ "semaphores",
+ "string",
+ "system_calls"]
+
+microcode = '''
+# Microcode for general purpose instructions
+'''
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/arithmetic/__init__.py b/src/arch/x86/isa/insts/general_purpose/arithmetic/__init__.py
new file mode 100644
index 000000000..c7e6b8c5f
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/arithmetic/__init__.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["add_and_subtract",
+ "increment_and_decrement",
+ "multiply_and_divide"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
+
diff --git a/src/arch/x86/isa/insts/general_purpose/arithmetic/add_and_subtract.py b/src/arch/x86/isa/insts/general_purpose/arithmetic/add_and_subtract.py
new file mode 100644
index 000000000..87fbb796c
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/arithmetic/add_and_subtract.py
@@ -0,0 +1,300 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop ADD_R_R
+{
+ add reg, reg, regm, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADD_R_I
+{
+ limm t1, imm
+ add reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADD_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ add t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop ADD_P_I
+{
+ rdip t7
+ limm t2, imm
+ ld t1, seg, riprel, disp
+ add t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop ADD_M_R
+{
+ ld t1, seg, sib, disp
+ add t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop ADD_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ add t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop ADD_R_M
+{
+ ld t1, seg, sib, disp
+ add reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADD_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ add reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SUB_R_R
+{
+ sub reg, reg, regm, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SUB_R_I
+{
+ limm t1, imm
+ sub reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SUB_R_M
+{
+ ld t1, seg, sib, disp
+ sub reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SUB_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SUB_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ sub t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop SUB_P_I
+{
+ rdip t7
+ limm t2, imm
+ ld t1, seg, riprel, disp
+ sub t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SUB_M_R
+{
+ ld t1, seg, sib, disp
+ sub t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop SUB_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop ADC_R_R
+{
+ adc reg, reg, regm, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADC_R_I
+{
+ limm t1, imm
+ adc reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADC_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ adc t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop ADC_P_I
+{
+ rdip t7
+ limm t2, imm
+ ld t1, seg, riprel, disp
+ adc t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop ADC_M_R
+{
+ ld t1, seg, sib, disp
+ adc t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop ADC_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ adc t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop ADC_R_M
+{
+ ld t1, seg, sib, disp
+ adc reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop ADC_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ adc reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SBB_R_R
+{
+ sbb reg, reg, regm, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SBB_R_I
+{
+ limm t1, imm
+ sbb reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SBB_R_M
+{
+ ld t1, seg, sib, disp
+ sbb reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SBB_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sbb reg, reg, t1, flags=(OF,SF,ZF,AF,PF,CF)
+};
+
+def macroop SBB_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ sbb t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop SBB_P_I
+{
+ rdip t7
+ limm t2, imm
+ ld t1, seg, riprel, disp
+ sbb t1, t1, t2, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SBB_M_R
+{
+ ld t1, seg, sib, disp
+ sbb t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop SBB_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sbb t1, t1, reg, flags=(OF,SF,ZF,AF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop NEG_R
+{
+ sub reg, t0, reg, flags=(CF,OF,SF,ZF,AF,PF)
+};
+
+def macroop NEG_M
+{
+ ld t1, seg, sib, disp
+ sub t1, t0, t1, flags=(CF,OF,SF,ZF,AF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop NEG_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t1, t0, t1, flags=(CF,OF,SF,ZF,AF,PF)
+ st t1, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/arithmetic/increment_and_decrement.py b/src/arch/x86/isa/insts/general_purpose/arithmetic/increment_and_decrement.py
new file mode 100644
index 000000000..2a8024eee
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/arithmetic/increment_and_decrement.py
@@ -0,0 +1,96 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop INC_R
+{
+ addi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
+};
+
+def macroop INC_M
+{
+ ld t1, seg, sib, disp
+ addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
+ st t1, seg, sib, disp
+};
+
+def macroop INC_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ addi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop DEC_R
+{
+ subi reg, reg, 1, flags=(OF, SF, ZF, AF, PF)
+};
+
+def macroop DEC_M
+{
+ ld t1, seg, sib, disp
+ subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
+ st t1, seg, sib, disp
+};
+
+def macroop DEC_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ subi t1, t1, 1, flags=(OF, SF, ZF, AF, PF)
+ st t1, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py b/src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py
new file mode 100644
index 000000000..a9b53acac
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/arithmetic/multiply_and_divide.py
@@ -0,0 +1,833 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+
+#
+# Byte version of one operand unsigned multiply.
+#
+
+def macroop MUL_B_R
+{
+ mul1u rax, reg
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+def macroop MUL_B_M
+{
+ ld t1, seg, sib, disp
+ mul1u rax, t1
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+def macroop MUL_B_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mul1u rax, t1
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+#
+# One operand unsigned multiply.
+#
+
+def macroop MUL_R
+{
+ mul1u rax, reg
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+def macroop MUL_M
+{
+ ld t1, seg, sib, disp
+ mul1u rax, t1
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+def macroop MUL_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mul1u rax, t1
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+#
+# Byte version of one operand signed multiply.
+#
+
+def macroop IMUL_B_R
+{
+ mul1s rax, reg
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+def macroop IMUL_B_M
+{
+ ld t1, seg, sib, disp
+ mul1s rax, t1
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+def macroop IMUL_B_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mul1s rax, t1
+ mulel rax
+ # Really ah
+ muleh rsi, flags=(OF,CF)
+};
+
+#
+# One operand signed multiply.
+#
+
+def macroop IMUL_R
+{
+ mul1s rax, reg
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+def macroop IMUL_M
+{
+ ld t1, seg, sib, disp
+ mul1s rax, t1
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+def macroop IMUL_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mul1s rax, t1
+ mulel rax
+ muleh rdx, flags=(OF,CF)
+};
+
+def macroop IMUL_R_R
+{
+ mul1s reg, regm
+ mulel reg
+ muleh t0, flags=(CF,OF)
+};
+
+def macroop IMUL_R_M
+{
+ ld t1, seg, sib, disp
+ mul1s reg, t1
+ mulel reg
+ muleh t0, flags=(CF,OF)
+};
+
+def macroop IMUL_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mul1s reg, t1
+ mulel reg
+ muleh t0, flags=(CF,OF)
+};
+
+#
+# Three operand signed multiply.
+#
+
+def macroop IMUL_R_R_I
+{
+ limm t1, imm
+ mul1s regm, t1
+ mulel reg
+ muleh t0, flags=(OF,CF)
+};
+
+def macroop IMUL_R_M_I
+{
+ limm t1, imm
+ ld t2, seg, sib, disp
+ mul1s t2, t1
+ mulel reg
+ muleh t0, flags=(OF,CF)
+};
+
+def macroop IMUL_R_P_I
+{
+ rdip t7
+ limm t1, imm
+ ld t2, seg, riprel
+ mul1s t2, t1
+ mulel reg
+ muleh t0, flags=(OF,CF)
+};
+
+#
+# One byte version of unsigned division
+#
+
+def macroop DIV_B_R
+{
+ # Do the initial part of the division
+ div1 rsi, reg, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, 8, dataSize=1
+ div2 t1, rax, t1, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t1, rax, t1, dataSize=1
+ div2 t1, rax, t1, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax, dataSize=1
+ divr rsi, dataSize=1
+};
+
+def macroop DIV_B_M
+{
+ ld t2, seg, sib, disp
+
+ # Do the initial part of the division
+ div1 rsi, t2, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, 8, dataSize=1
+ div2 t1, rax, t1, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t1, rax, t1, dataSize=1
+ div2 t1, rax, t1, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax, dataSize=1
+ divr rsi, dataSize=1
+};
+
+def macroop DIV_B_P
+{
+ rdip t7
+ ld t2, seg, riprel, disp
+
+ # Do the initial part of the division
+ div1 rsi, t2, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, 8, dataSize=1
+ div2 t1, rax, t1, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t1, rax, t1, dataSize=1
+ div2 t1, rax, t1, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax, dataSize=1
+ divr rsi, dataSize=1
+};
+
+#
+# Unsigned division
+#
+
+def macroop DIV_R
+{
+ # Do the initial part of the division
+ div1 rdx, reg
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, "env.dataSize * 8"
+ div2 t1, rax, t1
+
+ #Loop until we're out of bits to shift in
+ #The amount of unrolling here could stand some tuning
+divLoopTop:
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax
+ divr rdx
+};
+
+def macroop DIV_M
+{
+ ld t2, seg, sib, disp
+
+ # Do the initial part of the division
+ div1 rdx, t2
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, "env.dataSize * 8"
+ div2 t1, rax, t1
+
+ #Loop until we're out of bits to shift in
+ #The amount of unrolling here could stand some tuning
+divLoopTop:
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax
+ divr rdx
+};
+
+def macroop DIV_P
+{
+ rdip t7
+ ld t2, seg, riprel, disp
+
+ # Do the initial part of the division
+ div1 rdx, t2
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t1, rax, "env.dataSize * 8"
+ div2 t1, rax, t1
+
+ #Loop until we're out of bits to shift in
+ #The amount of unrolling here could stand some tuning
+divLoopTop:
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1
+ div2 t1, rax, t1, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq rax
+ divr rdx
+};
+
+#
+# One byte version of signed division
+#
+
+def macroop IDIV_B_R
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,), dataSize=1
+ ruflag t4, 3
+ sub t2, t0, rsi, dataSize=1
+ sub t2, t2, t4
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, reg, 1, flags=(ECF,), dataSize=1
+
+ # Negate divisor
+ sub t3, t0, reg, dataSize=1
+ # Put the divisor's absolute value into t3
+ mov t3, t3, reg, flags=(nCECF,), dataSize=1
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rsi, 1, flags=(ECF,), dataSize=1
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,), dataSize=1
+ mov t2, t2, rsi, flags=(nCECF,), dataSize=1
+
+ # Do the initial part of the division
+ div1 t2, t3, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, 8, dataSize=1
+ div2 t4, t1, t4, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4, dataSize=1
+ div2 t4, t1, t4, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5, dataSize=1
+ divr t6, dataSize=1
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6, dataSize=1
+ # If the dividend was negitive, put the negated remainder in rsi.
+ mov rsi, rsi, t4, (CECF,), dataSize=1
+ # Otherwise put the regular remainder in rsi.
+ mov rsi, rsi, t6, (nCECF,), dataSize=1
+
+ # Negate the quotient.
+ sub t4, t0, t5, dataSize=1
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,), dataSize=1
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,), dataSize=1
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5, dataSize=1
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,), dataSize=1
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,), dataSize=1
+};
+
+def macroop IDIV_B_M
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,), dataSize=1
+ ruflag t4, 3
+ sub t2, t0, rsi, dataSize=1
+ sub t2, t2, t4
+
+ ld t3, seg, sib, disp
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, t3, 1, flags=(ECF,), dataSize=1
+
+ # Negate divisor
+ sub t4, t0, t3, dataSize=1
+ # Put the divisor's absolute value into t3
+ mov t3, t3, t4, flags=(CECF,), dataSize=1
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rsi, 1, flags=(ECF,), dataSize=1
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,), dataSize=1
+ mov t2, t2, rsi, flags=(nCECF,), dataSize=1
+
+ # Do the initial part of the division
+ div1 t2, t3, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, 8, dataSize=1
+ div2 t4, t1, t4, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4, dataSize=1
+ div2 t4, t1, t4, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5, dataSize=1
+ divr t6, dataSize=1
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6, dataSize=1
+ # If the dividend was negitive, put the negated remainder in rsi.
+ mov rsi, rsi, t4, (CECF,), dataSize=1
+ # Otherwise put the regular remainder in rsi.
+ mov rsi, rsi, t6, (nCECF,), dataSize=1
+
+ # Negate the quotient.
+ sub t4, t0, t5, dataSize=1
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,), dataSize=1
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,), dataSize=1
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5, dataSize=1
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,), dataSize=1
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,), dataSize=1
+};
+
+def macroop IDIV_B_P
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,), dataSize=1
+ ruflag t4, 3
+ sub t2, t0, rsi, dataSize=1
+ sub t2, t2, t4
+
+ rdip t7
+ ld t3, seg, riprel, disp
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, t3, 1, flags=(ECF,), dataSize=1
+
+ # Negate divisor
+ sub t4, t0, t3, dataSize=1
+ # Put the divisor's absolute value into t3
+ mov t3, t3, t4, flags=(CECF,), dataSize=1
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rsi, 1, flags=(ECF,), dataSize=1
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,), dataSize=1
+ mov t2, t2, rsi, flags=(nCECF,), dataSize=1
+
+ # Do the initial part of the division
+ div1 t2, t3, dataSize=1
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, 8, dataSize=1
+ div2 t4, t1, t4, dataSize=1
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4, dataSize=1
+ div2 t4, t1, t4, flags=(EZF,), dataSize=1
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5, dataSize=1
+ divr t6, dataSize=1
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6, dataSize=1
+ # If the dividend was negitive, put the negated remainder in rsi.
+ mov rsi, rsi, t4, (CECF,), dataSize=1
+ # Otherwise put the regular remainder in rsi.
+ mov rsi, rsi, t6, (nCECF,), dataSize=1
+
+ # Negate the quotient.
+ sub t4, t0, t5, dataSize=1
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,), dataSize=1
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,), dataSize=1
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5, dataSize=1
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,), dataSize=1
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,), dataSize=1
+};
+
+#
+# Signed division
+#
+
+def macroop IDIV_R
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,)
+ ruflag t4, 3
+ sub t2, t0, rdx
+ sub t2, t2, t4
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, reg, 1, flags=(ECF,)
+
+ # Negate divisor
+ sub t3, t0, reg
+ # Put the divisor's absolute value into t3
+ mov t3, t3, reg, flags=(nCECF,)
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rdx, 1, flags=(ECF,)
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,)
+ mov t2, t2, rdx, flags=(nCECF,)
+
+ # Do the initial part of the division
+ div1 t2, t3
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, "env.dataSize * 8"
+ div2 t4, t1, t4
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5
+ divr t6
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6
+ # If the dividend was negitive, put the negated remainder in rdx.
+ mov rdx, rdx, t4, (CECF,)
+ # Otherwise put the regular remainder in rdx.
+ mov rdx, rdx, t6, (nCECF,)
+
+ # Negate the quotient.
+ sub t4, t0, t5
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,)
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,)
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,)
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,)
+};
+
+def macroop IDIV_M
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,)
+ ruflag t4, 3
+ sub t2, t0, rdx
+ sub t2, t2, t4
+
+ ld t3, seg, sib, disp
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, t3, 1, flags=(ECF,)
+
+ # Negate divisor
+ sub t4, t0, t3
+ # Put the divisor's absolute value into t3
+ mov t3, t3, t4, flags=(CECF,)
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rdx, 1, flags=(ECF,)
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,)
+ mov t2, t2, rdx, flags=(nCECF,)
+
+ # Do the initial part of the division
+ div1 t2, t3
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, "env.dataSize * 8"
+ div2 t4, t1, t4
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5
+ divr t6
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6
+ # If the dividend was negitive, put the negated remainder in rdx.
+ mov rdx, rdx, t4, (CECF,)
+ # Otherwise put the regular remainder in rdx.
+ mov rdx, rdx, t6, (nCECF,)
+
+ # Negate the quotient.
+ sub t4, t0, t5
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,)
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,)
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,)
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,)
+};
+
+def macroop IDIV_P
+{
+ # Negate dividend
+ sub t1, t0, rax, flags=(ECF,)
+ ruflag t4, 3
+ sub t2, t0, rdx
+ sub t2, t2, t4
+
+ rdip t7
+ ld t3, seg, riprel, disp
+
+ #Find the sign of the divisor
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, t3, 1, flags=(ECF,)
+
+ # Negate divisor
+ sub t4, t0, t3
+ # Put the divisor's absolute value into t3
+ mov t3, t3, t4, flags=(CECF,)
+
+ #Find the sign of the dividend
+ #FIXME!!! This depends on shifts setting the carry flag correctly.
+ slli t0, rdx, 1, flags=(ECF,)
+
+ # Put the dividend's absolute value into t1 and t2
+ mov t1, t1, rax, flags=(nCECF,)
+ mov t2, t2, rdx, flags=(nCECF,)
+
+ # Do the initial part of the division
+ div1 t2, t3
+
+ #These are split out so we can initialize the number of bits in the
+ #second register
+ div2i t4, t1, "env.dataSize * 8"
+ div2 t4, t1, t4
+
+ #Loop until we're out of bits to shift in
+divLoopTop:
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4
+ div2 t4, t1, t4, flags=(EZF,)
+ bri t0, label("divLoopTop"), flags=(nCEZF,)
+
+ #Unload the answer
+ divq t5
+ divr t6
+
+ # Fix up signs. The sign of the dividend is still lying around in ECF.
+ # The sign of the remainder, ah, is the same as the dividend. The sign
+ # of the quotient is negated if the signs of the divisor and dividend
+ # were different.
+
+ # Negate the remainder
+ sub t4, t0, t6
+ # If the dividend was negitive, put the negated remainder in rdx.
+ mov rdx, rdx, t4, (CECF,)
+ # Otherwise put the regular remainder in rdx.
+ mov rdx, rdx, t6, (nCECF,)
+
+ # Negate the quotient.
+ sub t4, t0, t5
+ # If the dividend was negative, start using the negated quotient
+ mov t5, t5, t4, (CECF,)
+
+ # Check the sign of the divisor
+ slli t0, t3, 1, flags=(ECF,)
+
+ # Negate the (possibly already negated) quotient
+ sub t4, t0, t5
+ # If the divisor was negative, put the negated quotient in rax.
+ mov rax, rax, t4, (CECF,)
+ # Otherwise put the one that wasn't negated (at least here) in rax.
+ mov rax, rax, t5, (nCECF,)
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/cache_and_memory_management.py b/src/arch/x86/isa/insts/general_purpose/cache_and_memory_management.py
new file mode 100644
index 000000000..b5fc43fcd
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/cache_and_memory_management.py
@@ -0,0 +1,72 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class LFENCE(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class SFENCE(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MFENCE(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class PREFETCHlevel(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class PREFETCH(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class PREFETCHW(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class CLFLUSH(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/__init__.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/__init__.py
new file mode 100644
index 000000000..56f33585a
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/__init__.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["bit_scan",
+ "bit_test",
+ "bounds",
+ "compare",
+ "set_byte_on_condition",
+ "test"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_scan.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_scan.py
new file mode 100644
index 000000000..f04520296
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_scan.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class BSF(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class BSR(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_test.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_test.py
new file mode 100644
index 000000000..e950f008a
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bit_test.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class BT(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class BTC(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class BTR(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class BTS(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/bounds.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bounds.py
new file mode 100644
index 000000000..4b6cc8f71
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/bounds.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class BOUND(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/compare.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/compare.py
new file mode 100644
index 000000000..76c75a442
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/compare.py
@@ -0,0 +1,108 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CMP_R_M
+{
+ ld t1, seg, sib, disp
+ sub t0, reg, t1, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t0, reg, t1, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ sub t0, t1, t2, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_P_I
+{
+ limm t2, imm
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t0, t1, t2, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_M_R
+{
+ ld t1, seg, sib, disp
+ sub t0, t1, reg, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t0, t1, reg, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_R_R
+{
+ sub t0, reg, regm, flags=(OF, SF, ZF, AF, PF, CF)
+};
+
+def macroop CMP_R_I
+{
+ limm t1, imm
+ sub t0, reg, t1, flags=(OF, SF, ZF, AF, PF, CF)
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/set_byte_on_condition.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/set_byte_on_condition.py
new file mode 100644
index 000000000..81091905c
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/set_byte_on_condition.py
@@ -0,0 +1,392 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop SETZ_R
+{
+ movi reg, reg, 1, flags=(CZF,)
+ movi reg, reg, 0, flags=(nCZF,)
+};
+
+def macroop SETZ_M
+{
+ movi t1, t1, 1, flags=(CZF,)
+ movi t1, t1, 0, flags=(nCZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETZ_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CZF,)
+ movi t1, t1, 0, flags=(nCZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNZ_R
+{
+ movi reg, reg, 1, flags=(nCZF,)
+ movi reg, reg, 0, flags=(CZF,)
+};
+
+def macroop SETNZ_M
+{
+ movi t1, t1, 1, flags=(nCZF,)
+ movi t1, t1, 0, flags=(CZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNZ_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCZF,)
+ movi t1, t1, 0, flags=(CZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETB_R
+{
+ movi reg, reg, 1, flags=(CCF,)
+ movi reg, reg, 0, flags=(nCCF,)
+};
+
+def macroop SETB_M
+{
+ movi t1, t1, 1, flags=(CCF,)
+ movi t1, t1, 0, flags=(nCCF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETB_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CCF,)
+ movi t1, t1, 0, flags=(nCCF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNB_R
+{
+ movi reg, reg, 1, flags=(nCCF,)
+ movi reg, reg, 0, flags=(CCF,)
+};
+
+def macroop SETNB_M
+{
+ movi t1, t1, 1, flags=(nCCF,)
+ movi t1, t1, 0, flags=(CCF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNB_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCCF,)
+ movi t1, t1, 0, flags=(CCF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETBE_R
+{
+ movi reg, reg, 1, flags=(CCvZF,)
+ movi reg, reg, 0, flags=(nCCvZF,)
+};
+
+def macroop SETBE_M
+{
+ movi t1, t1, 1, flags=(CCvZF,)
+ movi t1, t1, 0, flags=(nCCvZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETBE_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CCvZF,)
+ movi t1, t1, 0, flags=(nCCvZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNBE_R
+{
+ movi reg, reg, 1, flags=(nCCvZF,)
+ movi reg, reg, 0, flags=(CCvZF,)
+};
+
+def macroop SETNBE_M
+{
+ movi t1, t1, 1, flags=(nCCvZF,)
+ movi t1, t1, 0, flags=(CCvZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNBE_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCCvZF,)
+ movi t1, t1, 0, flags=(CCvZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETS_R
+{
+ movi reg, reg, 1, flags=(CSF,)
+ movi reg, reg, 0, flags=(nCSF,)
+};
+
+def macroop SETS_M
+{
+ movi t1, t1, 1, flags=(CSF,)
+ movi t1, t1, 0, flags=(nCSF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETS_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CSF,)
+ movi t1, t1, 0, flags=(nCSF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNS_R
+{
+ movi reg, reg, 1, flags=(nCSF,)
+ movi reg, reg, 0, flags=(CSF,)
+};
+
+def macroop SETNS_M
+{
+ movi t1, t1, 1, flags=(nCSF,)
+ movi t1, t1, 0, flags=(CSF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNS_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCSF,)
+ movi t1, t1, 0, flags=(CSF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETP_R
+{
+ movi reg, reg, 1, flags=(CPF,)
+ movi reg, reg, 0, flags=(nCPF,)
+};
+
+def macroop SETP_M
+{
+ movi t1, t1, 1, flags=(CPF,)
+ movi t1, t1, 0, flags=(nCPF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETP_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CPF,)
+ movi t1, t1, 0, flags=(nCPF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNP_R
+{
+ movi reg, reg, 1, flags=(nCPF,)
+ movi reg, reg, 0, flags=(CPF,)
+};
+
+def macroop SETNP_M
+{
+ movi t1, t1, 1, flags=(nCPF,)
+ movi t1, t1, 0, flags=(CPF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNP_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCPF,)
+ movi t1, t1, 0, flags=(CPF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETL_R
+{
+ movi reg, reg, 1, flags=(CSxOF,)
+ movi reg, reg, 0, flags=(nCSxOF,)
+};
+
+def macroop SETL_M
+{
+ movi t1, t1, 1, flags=(CSxOF,)
+ movi t1, t1, 0, flags=(nCSxOF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETL_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CSxOF,)
+ movi t1, t1, 0, flags=(nCSxOF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNL_R
+{
+ movi reg, reg, 1, flags=(nCSxOF,)
+ movi reg, reg, 0, flags=(CSxOF,)
+};
+
+def macroop SETNL_M
+{
+ movi t1, t1, 1, flags=(nCSxOF,)
+ movi t1, t1, 0, flags=(CSxOF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNL_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCSxOF,)
+ movi t1, t1, 0, flags=(CSxOF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETLE_R
+{
+ movi reg, reg, 1, flags=(CSxOvZF,)
+ movi reg, reg, 0, flags=(nCSxOvZF,)
+};
+
+def macroop SETLE_M
+{
+ movi t1, t1, 1, flags=(CSxOvZF,)
+ movi t1, t1, 0, flags=(nCSxOvZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETLE_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(CSxOvZF,)
+ movi t1, t1, 0, flags=(nCSxOvZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNLE_R
+{
+ movi reg, reg, 1, flags=(nCSxOvZF,)
+ movi reg, reg, 0, flags=(CSxOvZF,)
+};
+
+def macroop SETNLE_M
+{
+ movi t1, t1, 1, flags=(nCSxOvZF,)
+ movi t1, t1, 0, flags=(CSxOvZF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNLE_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCSxOvZF,)
+ movi t1, t1, 0, flags=(CSxOvZF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETO_R
+{
+ movi reg, reg, 1, flags=(COF,)
+ movi reg, reg, 0, flags=(nCOF,)
+};
+
+def macroop SETO_M
+{
+ movi t1, t1, 1, flags=(COF,)
+ movi t1, t1, 0, flags=(nCOF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETO_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(COF,)
+ movi t1, t1, 0, flags=(nCOF,)
+ st t1, seg, riprel, disp
+};
+
+def macroop SETNO_R
+{
+ movi reg, reg, 1, flags=(nCOF,)
+ movi reg, reg, 0, flags=(COF,)
+};
+
+def macroop SETNO_M
+{
+ movi t1, t1, 1, flags=(nCOF,)
+ movi t1, t1, 0, flags=(COF,)
+ st t1, seg, sib, disp
+};
+
+def macroop SETNO_P
+{
+ rdip t7
+ movi t1, t1, 1, flags=(nCOF,)
+ movi t1, t1, 0, flags=(COF,)
+ st t1, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/compare_and_test/test.py b/src/arch/x86/isa/insts/general_purpose/compare_and_test/test.py
new file mode 100644
index 000000000..2b4bf7b9a
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/compare_and_test/test.py
@@ -0,0 +1,95 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop TEST_M_R
+{
+ ld t1, seg, sib, disp
+ and t0, t1, reg, flags=(SF, ZF, PF)
+};
+
+def macroop TEST_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ and t0, t1, reg, flags=(SF, ZF, PF)
+};
+
+def macroop TEST_R_R
+{
+ and t0, reg, regm, flags=(SF, ZF, PF)
+};
+
+def macroop TEST_M_I
+{
+ ld t1, seg, sib, disp
+ limm t2, imm
+ and t0, t1, t2, flags=(SF, ZF, PF)
+};
+
+def macroop TEST_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ limm t2, imm
+ and t0, t1, t2, flags=(SF, ZF, PF)
+};
+
+def macroop TEST_R_I
+{
+ limm t1, imm
+ and t0, reg, t1, flags=(SF, ZF, PF)
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/__init__.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/__init__.py
new file mode 100644
index 000000000..6694b857c
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/__init__.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["call",
+ "conditional_jump",
+ "interrupts_and_exceptions",
+ "jump",
+ "loop",
+ "xreturn"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py
new file mode 100644
index 000000000..504e9ab0a
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py
@@ -0,0 +1,107 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CALL_NEAR_I
+{
+ # Make the default data size of calls 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ limm t1, imm
+ rdip t7
+ subi rsp, rsp, dsz
+ st t7, ss, [0, t0, rsp]
+ wrip t7, t1
+};
+
+def macroop CALL_NEAR_R
+{
+ # Make the default data size of calls 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ subi rsp, rsp, dsz
+ st t1, ss, [0, t0, rsp]
+ wripi reg, 0
+};
+
+def macroop CALL_NEAR_M
+{
+ # Make the default data size of calls 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t7
+ ld t1, seg, sib, disp
+ subi rsp, rsp, dsz
+ st t7, ss, [0, t0, rsp]
+ wripi t1, 0
+};
+
+def macroop CALL_NEAR_P
+{
+ # Make the default data size of calls 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t7
+ ld t1, seg, riprel, disp
+ subi rsp, rsp, dsz
+ st t7, ss, [0, t0, rsp]
+ wripi t1, 0
+};
+'''
+#let {{
+# class CALL(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/conditional_jump.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/conditional_jump.py
new file mode 100644
index 000000000..b04ca97d6
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/conditional_jump.py
@@ -0,0 +1,216 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop JZ_I
+{
+ # Make the defualt data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CZF,)
+};
+
+def macroop JNZ_I
+{
+ # Make the defualt data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCZF,)
+};
+
+def macroop JB_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CCF,)
+};
+
+def macroop JNB_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCCF,)
+};
+
+def macroop JBE_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CCvZF,)
+};
+
+def macroop JNBE_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCCvZF,)
+};
+
+def macroop JS_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CSF,)
+};
+
+def macroop JNS_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCSF,)
+};
+
+def macroop JP_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CPF,)
+};
+
+def macroop JNP_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCPF,)
+};
+
+def macroop JL_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CSxOF,)
+};
+
+def macroop JNL_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCSxOF,)
+};
+
+def macroop JLE_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(CSxOvZF,)
+};
+
+def macroop JNLE_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCSxOvZF,)
+};
+
+def macroop JO_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(COF,)
+};
+
+def macroop JNO_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2, flags=(nCOF,)
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
new file mode 100644
index 000000000..7039b4b5c
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
@@ -0,0 +1,68 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class INT(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class INTO(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class IRET(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class IRETD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class IRETQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/jump.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/jump.py
new file mode 100644
index 000000000..bb3ae4213
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/jump.py
@@ -0,0 +1,93 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop JMP_I
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t1
+ limm t2, imm
+ wrip t1, t2
+};
+
+def macroop JMP_R
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ wripi reg, 0
+};
+
+def macroop JMP_M
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ ld t1, seg, sib, disp
+ wripi t1, 0
+};
+
+def macroop JMP_P
+{
+ # Make the default data size of jumps 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t7
+ ld t1, seg, riprel, disp
+ wripi t1, 0
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py
new file mode 100644
index 000000000..d742f217f
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/loop.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class LOOPcc(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py
new file mode 100644
index 000000000..1efddf1d2
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py
@@ -0,0 +1,78 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop RET_NEAR
+{
+ # Make the default data size of rets 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ ld t1, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+ wripi t1, 0
+};
+
+def macroop RET_NEAR_I
+{
+ # Make the default data size of rets 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ limm t2, imm
+ ld t1, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+ add rsp, rsp, t2
+ wripi t1, 0
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/__init__.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/__init__.py
new file mode 100644
index 000000000..b3a40b8a0
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/__init__.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["ascii_adjust",
+ "bcd_adjust",
+ "endian_conversion",
+ "extract_sign_mask",
+ "sign_extension",
+ "translate"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/ascii_adjust.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/ascii_adjust.py
new file mode 100644
index 000000000..a1e322e56
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/ascii_adjust.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class AAA(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class AAD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class AAM(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class AAS(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/bcd_adjust.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/bcd_adjust.py
new file mode 100644
index 000000000..213724768
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/bcd_adjust.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class DAA(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class DAS(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/endian_conversion.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/endian_conversion.py
new file mode 100644
index 000000000..b98d09816
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/endian_conversion.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class BSWAP(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/extract_sign_mask.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/extract_sign_mask.py
new file mode 100644
index 000000000..1e0810594
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/extract_sign_mask.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class MOVMSKPS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVMSKPD(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/sign_extension.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/sign_extension.py
new file mode 100644
index 000000000..9a7c226af
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/sign_extension.py
@@ -0,0 +1,67 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CDQE_R {
+ sext reg, reg, "env.dataSize << 2"
+};
+
+def macroop CQO_R_R {
+ # A shift might be slower than, for example, an explicit sign extension,
+ # so it might be worthwhile to try to find an alternative.
+ mov regm, regm, reg
+ srai regm, regm, "env.dataSize * 8 - 1"
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/data_conversion/translate.py b/src/arch/x86/isa/insts/general_purpose/data_conversion/translate.py
new file mode 100644
index 000000000..bb286b976
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_conversion/translate.py
@@ -0,0 +1,60 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class XLAT(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/__init__.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/__init__.py
new file mode 100644
index 000000000..365f95eaa
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/__init__.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["conditional_move",
+ "move",
+ "stack_operations",
+ "xchg"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/conditional_move.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/conditional_move.py
new file mode 100644
index 000000000..1a60c5b61
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/conditional_move.py
@@ -0,0 +1,344 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CMOVZ_R_R
+{
+ mov reg, reg, regm, flags=(CZF,)
+};
+
+def macroop CMOVZ_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CZF,)
+};
+
+def macroop CMOVZ_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CZF,)
+};
+
+def macroop CMOVNZ_R_R
+{
+ mov reg, reg, regm, flags=(nCZF,)
+};
+
+def macroop CMOVNZ_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCZF,)
+};
+
+def macroop CMOVNZ_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCZF,)
+};
+
+def macroop CMOVB_R_R
+{
+ mov reg, reg, regm, flags=(CCF,)
+};
+
+def macroop CMOVB_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CCF,)
+};
+
+def macroop CMOVB_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CCF,)
+};
+
+def macroop CMOVNB_R_R
+{
+ mov reg, reg, regm, flags=(nCCF,)
+};
+
+def macroop CMOVNB_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCCF,)
+};
+
+def macroop CMOVNB_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCCF,)
+};
+
+def macroop CMOVBE_R_R
+{
+ mov reg, reg, regm, flags=(CCvZF,)
+};
+
+def macroop CMOVBE_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CCvZF,)
+};
+
+def macroop CMOVBE_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CCvZF,)
+};
+
+def macroop CMOVNBE_R_R
+{
+ mov reg, reg, regm, flags=(nCCvZF,)
+};
+
+def macroop CMOVNBE_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCCvZF,)
+};
+
+def macroop CMOVNBE_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCCvZF,)
+};
+
+def macroop CMOVS_R_R
+{
+ mov reg, reg, regm, flags=(CSF,)
+};
+
+def macroop CMOVS_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CSF,)
+};
+
+def macroop CMOVS_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CSF,)
+};
+
+def macroop CMOVNS_R_R
+{
+ mov reg, reg, regm, flags=(nCSF,)
+};
+
+def macroop CMOVNS_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCSF,)
+};
+
+def macroop CMOVNS_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCSF,)
+};
+
+def macroop CMOVP_R_R
+{
+ mov reg, reg, regm, flags=(CPF,)
+};
+
+def macroop CMOVP_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CPF,)
+};
+
+def macroop CMOVP_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CPF,)
+};
+
+def macroop CMOVNP_R_R
+{
+ mov reg, reg, regm, flags=(nCPF,)
+};
+
+def macroop CMOVNP_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, regm, flags=(nCPF,)
+};
+
+def macroop CMOVNP_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, regm, flags=(nCPF,)
+};
+
+def macroop CMOVL_R_R
+{
+ mov reg, reg, regm, flags=(CSxOF,)
+};
+
+def macroop CMOVL_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CSxOF,)
+};
+
+def macroop CMOVL_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CSxOF,)
+};
+
+def macroop CMOVNL_R_R
+{
+ mov reg, reg, regm, flags=(nCSxOF,)
+};
+
+def macroop CMOVNL_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCSxOF,)
+};
+
+def macroop CMOVNL_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCSxOF,)
+};
+
+def macroop CMOVLE_R_R
+{
+ mov reg, reg, regm, flags=(CSxOvZF,)
+};
+
+def macroop CMOVLE_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(CSxOvZF,)
+};
+
+def macroop CMOVLE_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(CSxOvZF,)
+};
+
+def macroop CMOVNLE_R_R
+{
+ mov reg, reg, regm, flags=(nCSxOvZF,)
+};
+
+def macroop CMOVNLE_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCSxOvZF,)
+};
+
+def macroop CMOVNLE_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCSxOvZF,)
+};
+
+def macroop CMOVO_R_R
+{
+ mov reg, reg, regm, flags=(COF,)
+};
+
+def macroop CMOVO_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(COF,)
+};
+
+def macroop CMOVO_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(COF,)
+};
+
+def macroop CMOVNO_R_R
+{
+ mov reg, reg, regm, flags=(nCOF,)
+};
+
+def macroop CMOVNO_R_M
+{
+ ld t1, seg, sib, disp
+ mov reg, reg, t1, flags=(nCOF,)
+};
+
+def macroop CMOVNO_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ mov reg, reg, t1, flags=(nCOF,)
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/move.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/move.py
new file mode 100644
index 000000000..a248f5656
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/move.py
@@ -0,0 +1,187 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+
+#
+# Regular moves
+#
+
+def macroop MOV_R_R {
+ mov reg, reg, regm
+};
+
+def macroop MOV_M_R {
+ st reg, seg, sib, disp
+};
+
+def macroop MOV_P_R {
+ rdip t7
+ st reg, seg, riprel, disp
+};
+
+def macroop MOV_R_M {
+ ld reg, seg, sib, disp
+};
+
+def macroop MOV_R_P {
+ rdip t7
+ ld reg, seg, riprel, disp
+};
+
+def macroop MOV_R_I {
+ limm reg, imm
+};
+
+def macroop MOV_M_I {
+ limm t1, imm
+ st t1, seg, sib, disp
+};
+
+def macroop MOV_P_I {
+ rdip t7
+ limm t1, imm
+ st t1, seg, riprel, disp
+};
+
+#
+# Sign extending moves
+#
+
+def macroop MOVSXD_R_R {
+ sext reg, regm, 32
+};
+
+def macroop MOVSXD_R_M {
+ ld t1, seg, sib, disp, dataSize=4
+ sext reg, t1, 32
+};
+
+def macroop MOVSXD_R_P {
+ rdip t7
+ ld t1, seg, riprel, disp, dataSize=4
+ sext reg, t1, 32
+};
+
+def macroop MOVSX_B_R_R {
+ sext reg, regm, 8
+};
+
+def macroop MOVSX_B_R_M {
+ ld reg, seg, sib, disp, dataSize=1
+ sext reg, reg, 8
+};
+
+def macroop MOVSX_B_R_P {
+ rdip t7
+ ld reg, seg, riprel, disp, dataSize=1
+ sext reg, reg, 8
+};
+
+def macroop MOVSX_W_R_R {
+ sext reg, regm, 16
+};
+
+def macroop MOVSX_W_R_M {
+ ld reg, seg, sib, disp, dataSize=2
+ sext reg, reg, 16
+};
+
+def macroop MOVSX_W_R_P {
+ rdip t7
+ ld reg, seg, riprel, disp, dataSize=2
+ sext reg, reg, 16
+};
+
+#
+# Zero extending moves
+#
+
+def macroop MOVZX_B_R_R {
+ zext reg, regm, 8
+};
+
+def macroop MOVZX_B_R_M {
+ ld t1, seg, sib, disp, dataSize=1
+ zext reg, t1, 8
+};
+
+def macroop MOVZX_B_R_P {
+ rdip t7
+ ld t1, seg, riprel, disp, dataSize=1
+ zext reg, t1, 8
+};
+
+def macroop MOVZX_W_R_R {
+ zext reg, regm, 16
+};
+
+def macroop MOVZX_W_R_M {
+ ld t1, seg, sib, disp, dataSize=2
+ zext reg, t1, 16
+};
+
+def macroop MOVZX_W_R_P {
+ rdip t7
+ ld t1, seg, riprel, disp, dataSize=2
+ zext reg, t1, 16
+};
+'''
+#let {{
+# class MOVD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVNTI(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py
new file mode 100644
index 000000000..9e6807039
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py
@@ -0,0 +1,157 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop POP_R {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ ld reg, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+};
+
+def macroop POP_M {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ ld t1, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+ st t1, seg, sib, disp
+};
+
+def macroop POP_P {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t7
+ ld t1, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+ st t1, seg, riprel, disp
+};
+
+def macroop PUSH_R {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ # This needs to work slightly differently from the other versions of push
+ # because the -original- version of the stack pointer is what gets pushed
+ st reg, ss, [1, t0, rsp], "-env.dataSize"
+ subi rsp, rsp, dsz
+};
+
+def macroop PUSH_I {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ limm t1, imm
+ subi rsp, rsp, dsz
+ st t1, ss, [1, t0, rsp]
+};
+
+def macroop PUSH_M {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ ld t1, seg, sib, disp
+ subi rsp, rsp, dsz
+ st t1, ss, [1, t0, rsp]
+};
+
+def macroop PUSH_P {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ rdip t7
+ ld t1, seg, riprel, disp
+ subi rsp, rsp, dsz
+ st t1, ss, [1, t0, rsp]
+};
+
+def macroop PUSHA {
+ st rax, ss, [1, t0, rsp], "-0 * env.dataSize"
+ st rcx, ss, [1, t0, rsp], "-1 * env.dataSize"
+ st rdx, ss, [1, t0, rsp], "-2 * env.dataSize"
+ st rbx, ss, [1, t0, rsp], "-3 * env.dataSize"
+ st rsp, ss, [1, t0, rsp], "-4 * env.dataSize"
+ st rbp, ss, [1, t0, rsp], "-5 * env.dataSize"
+ st rsi, ss, [1, t0, rsp], "-6 * env.dataSize"
+ st rdi, ss, [1, t0, rsp], "-7 * env.dataSize"
+ subi rsp, rsp, "8 * env.dataSize"
+};
+
+def macroop POPA {
+ ld rdi, ss, [1, t0, rsp], "0 * env.dataSize"
+ ld rsi, ss, [1, t0, rsp], "1 * env.dataSize"
+ ld rbp, ss, [1, t0, rsp], "2 * env.dataSize"
+ ld rbx, ss, [1, t0, rsp], "4 * env.dataSize"
+ ld rdx, ss, [1, t0, rsp], "5 * env.dataSize"
+ ld rcx, ss, [1, t0, rsp], "6 * env.dataSize"
+ ld rax, ss, [1, t0, rsp], "7 * env.dataSize"
+ addi rsp, rsp, "8 * env.dataSize"
+};
+
+def macroop LEAVE {
+ # Make the default data size of pops 64 bits in 64 bit mode
+ .adjust_env oszIn64Override
+
+ mov rsp, rsp, rbp
+ ld rbp, ss, [1, t0, rsp]
+ addi rsp, rsp, dsz
+};
+'''
+#let {{
+# class ENTER(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py
new file mode 100644
index 000000000..9478c71fc
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py
@@ -0,0 +1,98 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+
+# All the memory versions need to use LOCK, regardless of if it was set
+
+def macroop XCHG_R_R
+{
+ # Use the xor trick instead of moves to reduce register pressure.
+ # This probably doesn't make much of a difference, but it's easy.
+ xor reg, reg, regm
+ xor regm, regm, reg
+ xor reg, reg, regm
+};
+
+def macroop XCHG_R_M
+{
+ ld t1, seg, sib, disp
+ st reg, seg, sib, disp
+ mov reg, reg, t1
+};
+
+def macroop XCHG_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ st reg, seg, riprel, disp
+ mov reg, reg, t1
+};
+
+def macroop XCHG_M_R
+{
+ ld t1, seg, sib, disp
+ st reg, seg, sib, disp
+ mov reg, reg, t1
+};
+
+def macroop XCHG_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ st reg, seg, riprel, disp
+ mov reg, reg, t1
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/flags/__init__.py b/src/arch/x86/isa/insts/general_purpose/flags/__init__.py
new file mode 100644
index 000000000..92a8e6a2d
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/flags/__init__.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["load_and_store",
+ "push_and_pop",
+ "set_and_clear"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/flags/load_and_store.py b/src/arch/x86/isa/insts/general_purpose/flags/load_and_store.py
new file mode 100644
index 000000000..c6f279a25
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/flags/load_and_store.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class LAHF(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class SAHF(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py b/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py
new file mode 100644
index 000000000..dbb6c34c4
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py
@@ -0,0 +1,70 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class POPF(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class POPFD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class POPFQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class PUSHF(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class PUSHFD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class pushfq(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/flags/set_and_clear.py b/src/arch/x86/isa/insts/general_purpose/flags/set_and_clear.py
new file mode 100644
index 000000000..4c655e0b2
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/flags/set_and_clear.py
@@ -0,0 +1,93 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CLD {
+ ruflags t1
+ limm t2, "~((uint64_t)DFBit)"
+ and t1, t1, t2
+ wruflags t1, t0
+};
+
+def macroop STD {
+ ruflags t1
+ limm t2, "DFBit"
+ or t1, t1, t2
+ wruflags t1, t0
+};
+
+def macroop CLC {
+ ruflags t1
+ andi t2, t1, "CFBit"
+ wruflags t1, t2
+};
+
+def macroop STC {
+ ruflags t1
+ ori t1, t1, "CFBit"
+ wruflags t1, t0
+};
+
+def macroop CMC {
+ ruflags t1
+ wruflagsi t1, "CFBit"
+};
+'''
+#let {{
+# class CLI(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class STI(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/input_output/__init__.py b/src/arch/x86/isa/insts/general_purpose/input_output/__init__.py
new file mode 100644
index 000000000..54fb3d9b0
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/input_output/__init__.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["general_io",
+ "string_io"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/input_output/general_io.py b/src/arch/x86/isa/insts/general_purpose/input_output/general_io.py
new file mode 100644
index 000000000..f9aa9d6e4
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/input_output/general_io.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class IN(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUT(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/input_output/string_io.py b/src/arch/x86/isa/insts/general_purpose/input_output/string_io.py
new file mode 100644
index 000000000..a35ba772f
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/input_output/string_io.py
@@ -0,0 +1,78 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class INS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class INSB(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class INSW(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class INSD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class INSQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUTS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUTSB(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUTSW(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUTSD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class OUTSQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/load_effective_address.py b/src/arch/x86/isa/insts/general_purpose/load_effective_address.py
new file mode 100644
index 000000000..0c4e0f7df
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/load_effective_address.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop LEA_R_M {
+ lea reg, seg, sib, disp
+};
+
+def macroop LEA_R_P {
+ rdip t7
+ lea reg, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/load_segment_registers.py b/src/arch/x86/isa/insts/general_purpose/load_segment_registers.py
new file mode 100644
index 000000000..8aec4b99e
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/load_segment_registers.py
@@ -0,0 +1,72 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class LDS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LES(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LFS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LGS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LSS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOV_SEG(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class POP(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/logical.py b/src/arch/x86/isa/insts/general_purpose/logical.py
new file mode 100644
index 000000000..2137ae82f
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/logical.py
@@ -0,0 +1,247 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop OR_R_R
+{
+ or reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop OR_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop OR_P_I
+{
+ limm t2, imm
+ rdip t7
+ ld t1, seg, riprel, disp
+ or t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop OR_M_R
+{
+ ld t1, seg, sib, disp
+ or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop OR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ or t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop OR_R_M
+{
+ ld t1, seg, sib, disp
+ or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop OR_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop OR_R_I
+{
+ limm t1, imm
+ or reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop XOR_R_R
+{
+ xor reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop XOR_R_I
+{
+ limm t1, imm
+ xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop XOR_M_I
+{
+ limm t2, imm
+ ld t1, seg, sib, disp
+ xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop XOR_P_I
+{
+ limm t2, imm
+ rdip t7
+ ld t1, seg, riprel, disp
+ xor t1, t1, t2, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop XOR_M_R
+{
+ ld t1, seg, sib, disp
+ xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop XOR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ xor t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop XOR_R_M
+{
+ ld t1, seg, sib, disp
+ xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop XOR_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ xor reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop AND_R_R
+{
+ and reg, reg, regm, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop AND_R_M
+{
+ ld t1, seg, sib, disp
+ and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop AND_R_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop AND_R_I
+{
+ limm t1, imm
+ and reg, reg, t1, flags=(OF,SF,ZF,PF,CF)
+};
+
+def macroop AND_M_I
+{
+ ld t2, seg, sib, disp
+ limm t1, imm
+ and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
+ st t2, seg, sib, disp
+};
+
+def macroop AND_P_I
+{
+ rdip t7
+ ld t2, seg, riprel, disp
+ limm t1, imm
+ and t2, t2, t1, flags=(OF,SF,ZF,PF,CF)
+ st t2, seg, riprel, disp
+};
+
+def macroop AND_M_R
+{
+ ld t1, seg, sib, disp
+ and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, sib, disp
+};
+
+def macroop AND_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ and t1, t1, reg, flags=(OF,SF,ZF,PF,CF)
+ st t1, seg, riprel, disp
+};
+
+def macroop NOT_R
+{
+ limm t1, -1
+ xor reg, reg, t1
+};
+
+def macroop NOT_M
+{
+ limm t1, -1
+ ld t2, seg, sib, disp
+ xor t2, t2, t1
+ st t2, seg, sib, disp
+};
+
+def macroop NOT_P
+{
+ limm t1, -1
+ rdip t7
+ ld t2, seg, riprel, disp
+ xor t2, t2, t1
+ st t2, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/no_operation.py b/src/arch/x86/isa/insts/general_purpose/no_operation.py
new file mode 100644
index 000000000..306ee2797
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/no_operation.py
@@ -0,0 +1,61 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop NOP
+{
+ fault "NoFault"
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/processor_information.py b/src/arch/x86/isa/insts/general_purpose/processor_information.py
new file mode 100644
index 000000000..6070169ac
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/processor_information.py
@@ -0,0 +1,405 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CPUID_R {
+
+#
+# Find which type of cpuid function it is by checking bit 31. Also clear that
+# bit to form an offset into the functions of that type.
+#
+ limm t1, 0x80000000, dataSize=4
+ and t2, t1, rax, flags=(EZF,)
+ # clear the bit
+ xor t1, t2, rax
+
+#
+# Do range checking on the offset
+#
+ # If EZF is set, the function is standard and the max is 0x1.
+ movi t2, t2, 0x1, flags=(CEZF,)
+ # If EZF is cleared, the function is extended and the max is 0x18.
+ movi t2, t2, 0x18, flags=(nCEZF,)
+ subi t0, t1, t2, flags=(ECF,)
+ # ECF will be set if the offset is too large.
+ bri t0, label("end"), flags=(nCECF,)
+
+
+#
+# Jump to the right portion
+#
+ movi t2, t2, label("standardStart"), flags=(CEZF,)
+ movi t2, t2, label("extendedStart"), flags=(nCEZF,)
+ # This gives each function 8 microops to use. It's wasteful because only
+ # 5 will be needed, but a multiply would be expensive. In the system
+ # described in the RISC86 patent, the fifth instruction would really be
+ # the sequencing field on an op quad, so each function would be implemented
+ # by -exactly- one op quad. Since we're approximating, this should be ok.
+ slli t1, t1, 3
+ br t2, t1
+
+#############################################################################
+#############################################################################
+
+#
+# Standard functions.
+#
+
+standardStart:
+
+# 0x00000000 -- Processor Vendor and Largest Standard Function Number
+ limm rax, 0x00000001, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x00000001 -- Family, Model, Stepping Identifiers
+ limm rax, 0x00020f51, dataSize=4
+ limm rbx, 0x00000405, dataSize=4
+ limm rdx, 0xe3d3fbff, dataSize=4
+ limm rcx, 0x00000001, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+#
+# Extended functions.
+#
+
+extendedStart:
+
+# 0x80000000 -- Processor Vendor and Largest Extended Function Number
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000001 -- EAX: AMD Family, Model, Stepping
+# EBX: BrandId Identifier
+# ECX: Feature Identifiers
+# EDX: Feature Identifiers
+ limm rax, 0x00020f51, dataSize=4
+ limm rbx, 0x00000405, dataSize=4
+ limm rdx, 0xe3d3fbff, dataSize=4
+ limm rcx, 0x00000001, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000002 -- Processor Name String Identifier
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000003 -- Processor Name String Identifier
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000004 -- Processor Name String Identifier
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000005 -- L1 Cache and TLB Identifiers
+ limm rax, 0xff08ff08, dataSize=4
+ limm rbx, 0xff20ff20, dataSize=4
+ limm rdx, 0x40020140, dataSize=4
+ limm rcx, 0x40020140, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000006 -- L2/L3 Cache and L2 TLB Identifiers
+ limm rax, 0x00000000, dataSize=4
+ limm rbx, 0x42004200, dataSize=4
+ limm rdx, 0x00000000, dataSize=4
+ limm rcx, 0x04008140, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000007 -- Advanced Power Management Information
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000008 -- Long Mode Address Size Identification
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000009 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000A -- SVM Revision and Feature Identification
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000B -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000C -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000D -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000E -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x8000000F -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000010 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000011 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000012 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000013 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000014 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000015 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000016 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000017 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+# 0x80000018 -- Reserved
+ # JUNK VALUES
+ limm rax, 0x80000018, dataSize=4
+ limm rbx, 0x68747541, dataSize=4
+ limm rdx, 0x69746e65, dataSize=4
+ limm rcx, 0x444d4163, dataSize=4
+ bri t0, label("end")
+ fault "NoFault"
+ fault "NoFault"
+ fault "NoFault"
+
+end:
+ fault "NoFault"
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/__init__.py b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/__init__.py
new file mode 100644
index 000000000..c6c019f0d
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/__init__.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["rotate",
+ "shift"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/rotate.py b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/rotate.py
new file mode 100644
index 000000000..a13df3a64
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/rotate.py
@@ -0,0 +1,296 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop ROL_R_I
+{
+ roli reg, reg, imm
+};
+
+def macroop ROL_M_I
+{
+ ld t1, seg, sib, disp
+ roli t1, t1, imm
+ st t1, seg, sib, disp
+};
+
+def macroop ROL_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ roli t1, t1, imm
+ st t1, seg, riprel, disp
+};
+
+def macroop ROL_1_R
+{
+ roli reg, reg, 1
+};
+
+def macroop ROL_1_M
+{
+ ld t1, seg, sib, disp
+ roli t1, t1, 1
+ st t1, seg, sib, disp
+};
+
+def macroop ROL_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ roli t1, t1, 1
+ st t1, seg, riprel, disp
+};
+
+def macroop ROL_R_R
+{
+ rol reg, reg, regm
+};
+
+def macroop ROL_M_R
+{
+ ld t1, seg, sib, disp
+ rol t1, t1, reg
+ st t1, seg, sib, disp
+};
+
+def macroop ROL_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rol t1, t1, reg
+ st t1, seg, riprel, disp
+};
+
+def macroop ROR_R_I
+{
+ rori reg, reg, imm
+};
+
+def macroop ROR_M_I
+{
+ ld t1, seg, sib, disp
+ rori t1, t1, imm
+ st t1, seg, sib, disp
+};
+
+def macroop ROR_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rori t1, t1, imm
+ st t1, seg, riprel, disp
+};
+
+def macroop ROR_1_R
+{
+ rori reg, reg, 1
+};
+
+def macroop ROR_1_M
+{
+ ld t1, seg, sib, disp
+ rori t1, t1, 1
+ st t1, seg, sib, disp
+};
+
+def macroop ROR_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rori t1, t1, 1
+ st t1, seg, riprel, disp
+};
+
+def macroop ROR_R_R
+{
+ ror reg, reg, regm
+};
+
+def macroop ROR_M_R
+{
+ ld t1, seg, sib, disp
+ ror t1, t1, reg
+ st t1, seg, sib, disp
+};
+
+def macroop ROR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ ror t1, t1, reg
+ st t1, seg, riprel, disp
+};
+
+def macroop RCL_R_I
+{
+ rcli reg, reg, imm
+};
+
+def macroop RCL_M_I
+{
+ ld t1, seg, sib, disp
+ rcli t1, t1, imm
+ st t1, seg, sib, disp
+};
+
+def macroop RCL_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcli t1, t1, imm
+ st t1, seg, riprel, disp
+};
+
+def macroop RCL_1_R
+{
+ rcli reg, reg, 1
+};
+
+def macroop RCL_1_M
+{
+ ld t1, seg, sib, disp
+ rcli t1, t1, 1
+ st t1, seg, sib, disp
+};
+
+def macroop RCL_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcli t1, t1, 1
+ st t1, seg, riprel, disp
+};
+
+def macroop RCL_R_R
+{
+ rcl reg, reg, regm
+};
+
+def macroop RCL_M_R
+{
+ ld t1, seg, sib, disp
+ rcl t1, t1, reg
+ st t1, seg, sib, disp
+};
+
+def macroop RCL_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcl t1, t1, reg
+ st t1, seg, riprel, disp
+};
+
+def macroop RCR_R_I
+{
+ rcri reg, reg, imm
+};
+
+def macroop RCR_M_I
+{
+ ld t1, seg, sib, disp
+ rcri t1, t1, imm
+ st t1, seg, sib, disp
+};
+
+def macroop RCR_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcri t1, t1, imm
+ st t1, seg, riprel, disp
+};
+
+def macroop RCR_1_R
+{
+ rcri reg, reg, 1
+};
+
+def macroop RCR_1_M
+{
+ ld t1, seg, sib, disp
+ rcri t1, t1, 1
+ st t1, seg, sib, disp
+};
+
+def macroop RCR_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcri t1, t1, 1
+ st t1, seg, riprel, disp
+};
+
+def macroop RCR_R_R
+{
+ rcr reg, reg, regm
+};
+
+def macroop RCR_M_R
+{
+ ld t1, seg, sib, disp
+ rcr t1, t1, reg
+ st t1, seg, sib, disp
+};
+
+def macroop RCR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ rcr t1, t1, reg
+ st t1, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/shift.py b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/shift.py
new file mode 100644
index 000000000..6c688cca3
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/rotate_and_shift/shift.py
@@ -0,0 +1,236 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop SAL_R_I
+{
+ slli reg, reg, imm, flags=(SF,ZF,PF)
+};
+
+def macroop SAL_M_I
+{
+ ld t1, seg, sib, disp
+ slli t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAL_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ slli t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SAL_1_R
+{
+ slli reg, reg, 1, flags=(SF,ZF,PF)
+};
+
+def macroop SAL_1_M
+{
+ ld t1, seg, sib, disp
+ slli t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAL_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ slli t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SAL_R_R
+{
+ sll reg, reg, regm, flags=(SF,ZF,PF)
+};
+
+def macroop SAL_M_R
+{
+ ld t1, seg, sib, disp
+ sll t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAL_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sll t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SHR_R_I
+{
+ srli reg, reg, imm, flags=(SF,ZF,PF)
+};
+
+def macroop SHR_M_I
+{
+ ld t1, seg, sib, disp
+ srli t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SHR_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ srli t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SHR_1_R
+{
+ srli reg, reg, 1, flags=(SF,ZF,PF)
+};
+
+def macroop SHR_1_M
+{
+ ld t1, seg, sib, disp
+ srli t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SHR_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ srli t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SHR_R_R
+{
+ srl reg, reg, regm, flags=(SF,ZF,PF)
+};
+
+def macroop SHR_M_R
+{
+ ld t1, seg, sib, disp
+ srl t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SHR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ srl t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SAR_R_I
+{
+ srai reg, reg, imm, flags=(SF,ZF,PF)
+};
+
+def macroop SAR_M_I
+{
+ ld t1, seg, sib, disp
+ srai t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAR_P_I
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ srai t1, t1, imm, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SAR_1_R
+{
+ srai reg, reg, 1, flags=(SF,ZF,PF)
+};
+
+def macroop SAR_1_M
+{
+ ld t1, seg, sib, disp
+ srai t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAR_1_P
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ srai t1, t1, 1, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+
+def macroop SAR_R_R
+{
+ sra reg, reg, regm, flags=(SF,ZF,PF)
+};
+
+def macroop SAR_M_R
+{
+ ld t1, seg, sib, disp
+ sra t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, sib, disp
+};
+
+def macroop SAR_P_R
+{
+ rdip t7
+ ld t1, seg, riprel, disp
+ sra t1, t1, reg, flags=(SF,ZF,PF)
+ st t1, seg, riprel, disp
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/semaphores.py b/src/arch/x86/isa/insts/general_purpose/semaphores.py
new file mode 100644
index 000000000..800f1b325
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/semaphores.py
@@ -0,0 +1,87 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CMPXCHG_R_R {
+ sub t0, rax, reg, flags=(OF, SF, ZF, AF, PF, CF)
+ mov reg, reg, regm, flags=(CZF,)
+ mov rax, rax, reg, flags=(nCZF,)
+};
+
+def macroop CMPXCHG_M_R {
+ ld t1, seg, sib, disp
+ sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF)
+
+ mov t1, t1, reg, flags=(CZF,)
+ st t1, seg, sib, disp
+ mov rax, rax, t1, flags=(nCZF,)
+};
+
+def macroop CMPXCHG_P_R {
+ rdip t7
+ ld t1, seg, riprel, disp
+ sub t0, rax, t1, flags=(OF, SF, ZF, AF, PF, CF)
+
+ mov t1, t1, reg, flags=(CZF,)
+ st t1, seg, riprel, disp
+ mov rax, rax, t1, flags=(nCZF,)
+};
+'''
+#let {{
+# class XADD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class XCHG(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/string/__init__.py b/src/arch/x86/isa/insts/general_purpose/string/__init__.py
new file mode 100644
index 000000000..f43a8d3e5
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/__init__.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+categories = ["compare_strings",
+ "load_string",
+ "move_string",
+ "scan_string",
+ "store_string"]
+
+microcode = ""
+for category in categories:
+ exec "import %s as cat" % category
+ microcode += cat.microcode
diff --git a/src/arch/x86/isa/insts/general_purpose/string/compare_strings.py b/src/arch/x86/isa/insts/general_purpose/string/compare_strings.py
new file mode 100644
index 000000000..71b8511b4
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/compare_strings.py
@@ -0,0 +1,112 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop CMPS_M_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+ ld t1, seg, [1, t0, rsi]
+ ld t2, es, [1, t0, rdi]
+ sub t0, t1, t2, flags=(OF, SF, ZF, AF, PF, CF)
+
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+};
+
+#
+# Versions which have the rep prefix. These could benefit from some loop
+# unrolling.
+#
+
+def macroop CMPS_E_M_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+ ld t1, seg, [1, t0, rsi]
+ ld t2, es, [1, t0, rdi]
+ sub t0, t1, t2, flags=(OF, SF, ZF, AF, PF, CF)
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+ bri t0, 4, flags=(CSTRZnEZF,)
+ fault "NoFault"
+};
+
+def macroop CMPS_N_M_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t3, t3, dsz, flags=(CEZF,), dataSize=asz
+ subi t4, t0, dsz, dataSize=asz
+ mov t3, t3, t4, flags=(nCEZF,), dataSize=asz
+
+ ld t1, seg, [1, t0, rsi]
+ ld t2, es, [1, t0, rdi]
+ sub t0, t1, t2, flags=(OF, SF, ZF, AF, PF, CF)
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t3, dataSize=asz
+ add rsi, rsi, t3, dataSize=asz
+ bri t0, 4, flags=(CSTRnZnEZF,)
+ fault "NoFault"
+};
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/string/load_string.py b/src/arch/x86/isa/insts/general_purpose/string/load_string.py
new file mode 100644
index 000000000..0f749a273
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/load_string.py
@@ -0,0 +1,68 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class LODS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LODSB(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LODSW(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LODSD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class LODSQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/string/move_string.py b/src/arch/x86/isa/insts/general_purpose/string/move_string.py
new file mode 100644
index 000000000..0a855b384
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/move_string.py
@@ -0,0 +1,68 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class MOVS(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVSB(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVSW(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVSD(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class MOVSQ(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/string/scan_string.py b/src/arch/x86/isa/insts/general_purpose/string/scan_string.py
new file mode 100644
index 000000000..b038cc00a
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/scan_string.py
@@ -0,0 +1,107 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = '''
+def macroop SCAS_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t2, t2, dsz, flags=(CEZF,), dataSize=asz
+ subi t3, t0, dsz, dataSize=asz
+ mov t2, t2, t3, flags=(nCEZF,), dataSize=asz
+
+ ld t1, es, [1, t0, rdi]
+ sub t0, t1, rax, flags=(OF, SF, ZF, AF, PF, CF)
+
+ add rdi, rdi, t2, dataSize=asz
+};
+
+#
+# Versions which have the rep prefix. These could benefit from some loop
+# unrolling.
+#
+
+def macroop SCAS_E_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t2, t2, dsz, flags=(CEZF,), dataSize=asz
+ subi t3, t0, dsz, dataSize=asz
+ mov t2, t2, t3, flags=(nCEZF,), dataSize=asz
+
+ ld t1, es, [1, t0, rdi]
+ sub t0, t1, rax, flags=(OF, SF, ZF, AF, PF, CF)
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t2, dataSize=asz
+ bri t0, 4, flags=(CSTRZnEZF,)
+ fault "NoFault"
+};
+
+def macroop SCAS_N_M {
+ # Find the constant we need to either add or subtract from rdi
+ ruflag t0, 10
+ movi t2, t2, dsz, flags=(CEZF,), dataSize=asz
+ subi t3, t0, dsz, dataSize=asz
+ mov t2, t2, t3, flags=(nCEZF,), dataSize=asz
+
+ ld t1, es, [1, t0, rdi]
+ sub t0, t1, rax, flags=(OF, SF, ZF, AF, PF, CF)
+
+ subi rcx, rcx, 1, flags=(EZF,), dataSize=asz
+ add rdi, rdi, t2, dataSize=asz
+ bri t0, 4, flags=(CSTRnZnEZF,)
+ fault "NoFault"
+};
+
+'''
diff --git a/src/arch/x86/isa/insts/general_purpose/string/store_string.py b/src/arch/x86/isa/insts/general_purpose/string/store_string.py
new file mode 100644
index 000000000..08a126c1f
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/string/store_string.py
@@ -0,0 +1,68 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class STOS(Inst):
+# "Add 0 0 0"
+# class STOSB(Inst):
+# "Add 0 0 0"
+# class STOSW(Inst):
+# "Add 0 0 0"
+# class STOSD(Inst):
+# "Add 0 0 0"
+# class STOSQ(Inst):
+# "Add 0 0 0"
+#}};
diff --git a/src/arch/x86/isa/insts/general_purpose/system_calls.py b/src/arch/x86/isa/insts/general_purpose/system_calls.py
new file mode 100644
index 000000000..e056bea84
--- /dev/null
+++ b/src/arch/x86/isa/insts/general_purpose/system_calls.py
@@ -0,0 +1,66 @@
+# Copyright (c) 2007 The Hewlett-Packard Development Company
+# All rights reserved.
+#
+# Redistribution and use of this software in source and binary forms,
+# with or without modification, are permitted provided that the
+# following conditions are met:
+#
+# The software must be used only for Non-Commercial Use which means any
+# use which is NOT directed to receiving any direct monetary
+# compensation for, or commercial advantage from such use. Illustrative
+# examples of non-commercial use are academic research, personal study,
+# teaching, education and corporate research & development.
+# Illustrative examples of commercial use are distributing products for
+# commercial advantage and providing services using the software for
+# commercial advantage.
+#
+# If you wish to use this software or functionality therein that may be
+# covered by patents for commercial use, please contact:
+# Director of Intellectual Property Licensing
+# Office of Strategy and Technology
+# Hewlett-Packard Company
+# 1501 Page Mill Road
+# Palo Alto, California 94304
+#
+# Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer. Redistributions
+# in binary form must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution. Neither the name of
+# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission. No right of
+# sublicense is granted herewith. Derivatives of the software and
+# output created using the software may be prepared, but only for
+# Non-Commercial Uses. Derivatives of the software may be shared with
+# others provided: (i) the others agree to abide by the list of
+# conditions herein which includes the Non-Commercial Use restrictions;
+# and (ii) such Derivatives of the software include the above copyright
+# notice to acknowledge the contribution from this software where
+# applicable, this list of conditions and the disclaimer below.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Gabe Black
+
+microcode = ""
+#let {{
+# class SYSENTER(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class SYSEXIT(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class SYSCALL(Inst):
+# "GenFault ${new UnimpInstFault}"
+# class SYSRET(Inst):
+# "GenFault ${new UnimpInstFault}"
+#}};