Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Unified Diff: syzygy/assm/assembler_unittest.cc

Issue 2868683002: adds 'mov reg32, fs:[imm]' and 'inc byte ptr [reg32]' to the assembler (Closed)
Patch Set: fix build break, simplify the encoding and test it with all gprs Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « syzygy/assm/assembler_base_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: syzygy/assm/assembler_unittest.cc
diff --git a/syzygy/assm/assembler_unittest.cc b/syzygy/assm/assembler_unittest.cc
index 777b6472f32109a4c5a5b66567d72ca45830aef0..b35a2b7f651b430eddbf0479e883f74417c17b6e 100644
--- a/syzygy/assm/assembler_unittest.cc
+++ b/syzygy/assm/assembler_unittest.cc
@@ -639,6 +639,12 @@ TEST_F(AssemblerTest, MovWithSegmentPrefix) {
EXPECT_BYTES(0x64, 0x8B, 0x13);
asm_.mov_fs(ecx, Operand(edx));
EXPECT_BYTES(0x64, 0x8B, 0x0A);
+
+ // Immediate source modes.
+ asm_.mov_fs(eax, Immediate(0xCAFEBABE, kSize32Bit));
+ EXPECT_BYTES(0x64, 0xA1, 0xBE, 0xBA, 0xFE, 0xCA);
+ asm_.mov_fs(ebx, Immediate(0x2C, kSize8Bit));
+ EXPECT_BYTES(0x64, 0x8B, 0x1D, 0x2C, 0x00, 0x00, 0x00);
}
TEST_F(AssemblerTest, LeaRegisterIndirect) {
@@ -943,6 +949,25 @@ TEST_F(AssemblerTest, Cmp) {
EXPECT_BYTES(0x3D, 0xEF, 0xBE, 0xAD, 0xDE);
}
+TEST_F(AssemblerTest, IncByte) {
+ asm_.inc(Operand(eax));
+ EXPECT_BYTES(0xFE, 0x00);
+ asm_.inc(Operand(ecx));
+ EXPECT_BYTES(0xFE, 0x01);
+ asm_.inc(Operand(edx));
+ EXPECT_BYTES(0xFE, 0x02);
+ asm_.inc(Operand(ebx));
+ EXPECT_BYTES(0xFE, 0x03);
+ asm_.inc(Operand(esi));
+ EXPECT_BYTES(0xFE, 0x06);
+ asm_.inc(Operand(edi));
+ EXPECT_BYTES(0xFE, 0x07);
+ asm_.inc(Operand(ebp));
+ EXPECT_BYTES(0xFE, 0x45, 0x00);
+ asm_.inc(Operand(esp));
+ EXPECT_BYTES(0xFE, 0x04, 0x24);
+}
+
TEST_F(AssemblerTest, AddByte) {
asm_.add(al, bl);
EXPECT_BYTES(0x02, 0xC3);
« no previous file with comments | « syzygy/assm/assembler_base_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698