[FAST486]: Do not call RtlCopyMemory for copying few bytes (2 and 4).
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 16 Oct 2014 21:48:18 +0000 (21:48 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Thu, 16 Oct 2014 21:48:18 +0000 (21:48 +0000)
svn path=/trunk/; revision=64773

reactos/lib/fast486/fast486.c
reactos/lib/fast486/opgroups.c

index 9c87a12..7e3da4e 100644 (file)
@@ -117,7 +117,6 @@ NTAPI
 Fast486MemReadCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
 {
     UNREFERENCED_PARAMETER(State);
-
     RtlMoveMemory(Buffer, (PVOID)Address, Size);
 }
 
@@ -126,7 +125,6 @@ NTAPI
 Fast486MemWriteCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
 {
     UNREFERENCED_PARAMETER(State);
-
     RtlMoveMemory((PVOID)Address, Buffer, Size);
 }
 
index 2dcdcae..5ec066b 100644 (file)
@@ -2016,6 +2016,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F00)
 
 FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
 {
+    // FAST486_TABLE_REG TableReg;
     UCHAR TableReg[6];
     FAST486_MOD_REG_RM ModRegRm;
     BOOLEAN OperandSize, AddressSize;
@@ -2054,8 +2055,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
             }
 
             /* Fill the 6-byte table register */
-            RtlCopyMemory(TableReg, &State->Gdtr.Size, sizeof(USHORT));
-            RtlCopyMemory(&TableReg[sizeof(USHORT)], &State->Gdtr.Address, sizeof(ULONG));
+            // TableReg = State->Gdtr;
+            *((PUSHORT)&TableReg) = State->Gdtr.Size;
+            *((PULONG)&TableReg[sizeof(USHORT)]) = State->Gdtr.Address;
 
             /* Store the GDTR */
             return Fast486WriteMemory(State,
@@ -2076,8 +2078,9 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
             }
 
             /* Fill the 6-byte table register */
-            RtlCopyMemory(TableReg, &State->Idtr.Size, sizeof(USHORT));
-            RtlCopyMemory(&TableReg[sizeof(USHORT)], &State->Idtr.Address, sizeof(ULONG));
+            // TableReg = State->Idtr;
+            *((PUSHORT)&TableReg) = State->Idtr.Size;
+            *((PULONG)&TableReg[sizeof(USHORT)]) = State->Idtr.Address;
 
             /* Store the IDTR */
             return Fast486WriteMemory(State,
@@ -2117,7 +2120,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
             }
 
             /* Load the new GDT */
-            State->Gdtr.Size = *((PUSHORT)TableReg);
+            // State->Gdtr = TableReg;
+            State->Gdtr.Size = *((PUSHORT)&TableReg);
             State->Gdtr.Address = *((PULONG)&TableReg[sizeof(USHORT)]);
 
             /* In 16-bit mode the highest byte is masked out */
@@ -2156,7 +2160,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0F01)
             }
 
             /* Load the new IDT */
-            State->Idtr.Size = *((PUSHORT)TableReg);
+            // State->Idtr = TableReg;
+            State->Idtr.Size = *((PUSHORT)&TableReg);
             State->Idtr.Address = *((PULONG)&TableReg[sizeof(USHORT)]);
 
             /* In 16-bit mode the highest byte is masked out */