Commit graph

186 commits

Author SHA1 Message Date
Gabe Black b0b4038ee9 X86: Fix a corner case where mul would overwrite an original register value it still needed.
--HG--
extra : convert_revision : 86ee0e2bf716d52c34ee731727d6366935f103ed
2007-09-04 23:22:08 -07:00
Gabe Black 9da070ce8a X86: Major rework of how regop microops are generated.
The new implementation uses metaclass, and gives a lot more precise control
with a lot less verbosity. The flags/no flags reg/imm variants are all handled
by the same python class now which supplies a constructor to the right C++
class based on context.

--HG--
extra : convert_revision : 712e3ec6de7a5a038da083f79635fd7a687d56e5
2007-08-31 22:28:07 -07:00
Gabe Black f67cd04673 X86: Fix the sra microop to get the sign bit from the right operand.
--HG--
extra : convert_revision : 71e58dd6dd6918ee403f2e332c47e29acdace464
2007-08-29 20:39:41 -07:00
Gabe Black c1a776de8a X86: Implement the movaps instruction.
--HG--
extra : convert_revision : 2aeb1c05205f8ea8f7484e8bacf3fbbc581defd2
2007-08-29 20:38:22 -07:00
Gabe Black 3da3190f07 X86: Implement the movsd instruction.
--HG--
extra : convert_revision : a5a73e0ddd39144d2aeeb9cc6a299516752fd4c2
2007-08-29 20:37:44 -07:00
Gabe Black f0b20ff970 X86: Implement the movlpd instruction.
--HG--
extra : convert_revision : dddb20fe48c0ae9de7cd0ba1a1467ecb690056c1
2007-08-29 20:37:16 -07:00
Gabe Black 3b97b6e0e2 X86: Add an fp move microop.
--HG--
extra : convert_revision : a9d6d3568cd2c6a65df91bf56ee1e43523f04630
2007-08-29 20:36:44 -07:00
Gabe Black 22830c0747 X86: Add load and store microops that use the fp registers.
--HG--
extra : convert_revision : 153a055e888d8c47d59758a599dbd38f63008137
2007-08-29 20:36:12 -07:00
Gabe Black 34f3c9d196 X86: Add operands to handle floating point registers.
--HG--
extra : convert_revision : 2e8289dbd3f5dda1221014d4ed0e9450f60de0cf
2007-08-29 20:35:30 -07:00
Gabe Black bc3635a110 X86: Flesh out register indexing constants.
--HG--
extra : convert_revision : 56eedc076bbb7962c3976599a15ed93c7cb154c0
2007-08-29 20:34:52 -07:00
Gabe Black c593cfbdeb X86: More two byte opcode decoding. I missed two groups in the last changeset.
--HG--
extra : convert_revision : 1a2813b2e7d3e0e02c8f1474f372de5cf16e7d7b
2007-08-28 19:36:51 -07:00
Gabe Black 37f1ff95e0 X86: More fully decode two byte opcodes.
This includes the most of the SSE stuff, but not some of the "groups" of
instructions.

--HG--
extra : convert_revision : 4725c34f3d73971ae1763611685c5877b6c51412
2007-08-28 17:18:13 -07:00
Gabe Black 8d1c7a83d7 X86: Make the Ruflag microop work correctly, and make the code a little clearer.
--HG--
extra : convert_revision : c551f51cdda46df99370363ed2d70916db8413eb
2007-08-26 20:41:36 -07:00
Gabe Black ac5ec1542e X86: Return values for some cpuid functions that match what my development machine returns.
--HG--
extra : convert_revision : e6619da11f43bbe025ceabd06387dd24e1cd883b
2007-08-26 20:40:42 -07:00
Gabe Black 8b738f7f12 X86: Make the microassembler accept lines which are just labels.
The labels on these lines will be associated with whatever the next microop
is.

--HG--
extra : convert_revision : 80c260e48ec1c16e6325061608e37c95a0610cfa
2007-08-26 20:39:55 -07:00
Gabe Black 03880cf828 X86: Make cpuid actually consider the eax parameter and return different values.
--HG--
extra : convert_revision : 527c1cacdd20ab162859bba7f9a6bed33afa2d4f
2007-08-26 20:38:42 -07:00
Gabe Black 9c99f5f825 X86: Fix the sign extension microop so it extends zeros correctly.
--HG--
extra : convert_revision : 9d7ca286ba7709175fa75226320601acce4ced98
2007-08-26 20:37:41 -07:00
Gabe Black 506bf83595 X86: Implement cmps (string compare)
--HG--
extra : convert_revision : 0d6b783b2246b8ad8d91e4c63e407307ee11c651
2007-08-26 20:36:46 -07:00
Gabe Black 00d9036c62 X86: Make shift instructions set some of the flags they're supposed to.
The flag mechanism for microops needs to be fleshd out a little more to allow
for custom flag calculation methods for certain microops. Shift is an example
where the rules for calculating OF and CF are unique.

--HG--
extra : convert_revision : 91981a00c1efd05db702fffa9cea51f912583013
2007-08-26 20:35:48 -07:00
Gabe Black fcd04f953c X86: Remove x86 code that attempted to fix misaligned accesses.
--HG--
extra : convert_revision : 42f68010e6498aceb7ed25da278093e99150e4df
2007-08-26 20:30:36 -07:00
Gabe Black 24541780c6 X86: Implemented and hooked in SCAS (scan string)
Fixed the asz assembler symbol.
Adjusted the condion checks to have appropriate options.
Implemented the SCAS microcode.
Attached SCAS into the decoder.

--HG--
extra : convert_revision : 17bf9ddae6bc2069e43b076f8f83c4e54fb7966c
2007-08-07 15:25:41 -07:00
Gabe Black d79a591608 X86: Add a format to handle string instructions which can use the repe and repne prefixes.
--HG--
extra : convert_revision : 205fbbb947258bc0ef2915e22d5b32a3df1a1ce2
2007-08-07 15:23:01 -07:00
Gabe Black 60c61cb2b1 X86: Overhaul of ruflags to get it to work correctly.
--HG--
extra : convert_revision : 00a36a80a1945806aac9fa7d9d6a3906465dcad2
2007-08-07 15:21:13 -07:00
Gabe Black fb6cdf09cb X86: Make a microcode branch microop.
Also some touch up for ruflag.

--HG--
extra : convert_revision : 829947169af25ca6573f53b9430707101c75cc23
2007-08-07 15:19:26 -07:00
Gabe Black 30e777a5d3 X86: Implement microops and instructions that manipulate the flags register.
--HG--
extra : convert_revision : 566841577bf4a98cac0b65292fe0f7daf89a9203
2007-08-04 20:24:18 -07:00
Gabe Black 802f13e6bd X86: Make 64 bit unaligned accesses work as well as the other sizes.
There is a fundemental flaw in how unaligned accesses are supported, but this
is still an improvement.

--HG--
extra : convert_revision : 1c20b524ac24cd4a812c876b067495ee6a7ae29f
2007-08-04 20:22:20 -07:00
Gabe Black fc6b2cceb4 X86: Make fixed register operands ignore register index extensions from the REX prefix.
The only cases where this was the correct behavior are now handled with the
"B" operand type, and doing things this way was breaking some instructions,
notably a shift.

--HG--
extra : convert_revision : 072346d4f541edaceba7aecc26ba8d2cd756e481
2007-08-04 20:17:31 -07:00
Gabe Black 6f3bb03a3f X86: Implement the cmpxchg instruction.
--HG--
extra : convert_revision : b9e172bcb9551edf65c63f26dfa07d771edf3e1e
2007-08-04 20:15:27 -07:00
Gabe Black e410a925df X86: Start implementing segmentation support.
Make instructions observe segment prefixes, default segment rules, segment
base addresses.
Also fix some microcode and add sib and riprel "keywords" to the x86
specialization of the microassembler.

--HG--
extra : convert_revision : be5a3b33d33f243ed6e1ad63faea8495e46d0ac9
2007-08-04 20:12:54 -07:00
Gabe Black 0e6be2a9b1 X86: Add the arch_prctl system call and fix up some microcoding.
The arch_prctl system call is used to set and get the FS and GS segment
bases. The FS segment is use for TLS, so glibc needs to be able to set it
up.

--HG--
extra : convert_revision : 79501491a15967a7a862add846ff88a934fb1b37
2007-08-04 20:02:41 -07:00
Gabe Black e5e5b0119d X86: Fix for compilation bug with new cache code.
--HG--
extra : convert_revision : 073c6db0796cd2c11b8293b382b438a2a959b821
2007-08-01 12:49:58 -07:00
Gabe Black 4bdabe1254 Add a flag to indicate an instruction triggers a syscall in SE mode.
--HG--
extra : convert_revision : 1d0b3afdd8254f5b2fb4bbff1fa4a0536f78bb06
2007-07-31 17:34:08 -07:00
Gabe Black 55ade789d3 X86: Add operand type information to the fnstcw and fldw instruction placeholders.
These are the only floating point instructions that get used in my simple hello world test. These instructions are for setting up the floating point control register. Their not being implemented doesn't affect anything because floating point isn't used.

--HG--
extra : convert_revision : 4dfb9ef2a5665f034946c504978029e8799e64cd
2007-07-31 14:55:06 -07:00
Gabe Black ae3e1d22fc X86: Add decoding for x87 floating point.
--HG--
extra : convert_revision : 08f0f4a3d77a2c5eb9b5ca0cae7d0be9a72febec
2007-07-30 17:54:01 -07:00
Gabe Black 463e8a7516 X86: Attach the "DIV" instruction implementation to the decoder.
--HG--
extra : convert_revision : 8aef1c8d1ced2db998ed0d31241cadc17e19eadd
2007-07-30 15:44:48 -07:00
Gabe Black 595ff465e5 X86: Remove a naming conflict between the register index parameters and the "picked" register values.
--HG--
extra : convert_revision : 7b2c1be509478153ebf396841e4cbeccee3e03d1
2007-07-30 15:44:21 -07:00
Gabe Black 890e583163 X86: Set up RIP relative LEA instructions operands correctly.
--HG--
extra : convert_revision : 820cafadd550487c0d62c5082261b0886fce4f0d
2007-07-30 15:41:08 -07:00
Gabe Black 44c3419e1a X86: Implement unsigned divide. The non-byte version ignores rdx which it shouldn't.
--HG--
extra : convert_revision : 07e5509fb8ed9d73c144d6f52951ebc02e7c0032
2007-07-30 15:40:39 -07:00
Gabe Black 74fcf117dd X86: Allow RIP relative decode on -all- memory forms of operands.
--HG--
extra : convert_revision : 8af62cda2ce1c4acfa26a028a4f7506647bc27f7
2007-07-30 15:39:25 -07:00
Gabe Black 65db30992c X86: Take into account the regular registers and the microcode registers when decided whether or not to fold.
--HG--
extra : convert_revision : 26feec984dec61799c4afb03a4503a53c35872c5
2007-07-30 15:38:40 -07:00
Gabe Black a1b193f026 X86: Hook in the new instructions.
--HG--
extra : convert_revision : c4233001b35b52161083482841593ec28da6ff7d
2007-07-30 13:31:27 -07:00
Gabe Black 18be07289f X86: Implement a stub CPUID function which is hardcode to return certain values.
--HG--
extra : convert_revision : 4085e04fd13e834646106faa55726d07d9631f42
2007-07-30 13:29:33 -07:00
Gabe Black dbc979b9e2 X86: Force jumps to use 64 bit operand size.
--HG--
extra : convert_revision : 1c3685e7f4d07d5b4ded6c78b794964f51a358a9
2007-07-30 13:28:31 -07:00
Gabe Black bae96272a1 X86: Make instructions use pick, and implement/adjust some multiplication microops and instructions.
--HG--
extra : convert_revision : 5c56f6819ee07d936b388b3d1810a3b73db84f9c
2007-07-30 13:28:05 -07:00
Gabe Black 31a862b8f1 X86: missed a file which adds a "fold" bit.
--HG--
extra : convert_revision : 2c8eea425221d069a9bb888c8f18839843061899
2007-07-30 13:25:38 -07:00
Gabe Black da84aa95a9 Make the register indices use the appropriate "fold" bit.
--HG--
extra : convert_revision : 89e15e2ef1f709f2c09238b78f94505ce8ef146d
2007-07-30 13:25:00 -07:00
Gabe Black d8beeff324 X86: Make disassembly use the final register index. Add bits to indicate whether or not register indexes should be "folded".
--HG--
extra : convert_revision : 4b46e71ca91e480f6e1662b7f37b75240d6598e9
2007-07-30 13:23:33 -07:00
Gabe Black 4b3a20cdec X86: Implement LEAVE
--HG--
extra : convert_revision : c642d5018ece82c644e1cfa389b2d3dbd6ab5ffd
2007-07-30 13:19:11 -07:00
Gabe Black e70ffb0117 X86: Add a bitfield to indicate whether or not an REX prefix was present.
--HG--
extra : convert_revision : 9c4802f6c6e4eaab36aac900e2c7576682cb0f33
2007-07-30 13:17:34 -07:00
Gabe Black 7309d5ee45 X86: Make logic instructions flag setting work.
The instructions now ask for the appropriate flags to be set, and the microops do the "right thing" with the CF and OF flags, namely zero them.

--HG--
extra : convert_revision : 85138a832f44c879bf8a11bd3a35b58be6272ef3
2007-07-29 13:51:40 -07:00