OLD | NEW |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 // Special encoding for indirect displacement only to EAX. | 898 // Special encoding for indirect displacement only to EAX. |
899 instr.EmitOpCodeByte(0xA1); | 899 instr.EmitOpCodeByte(0xA1); |
900 instr.Emit32BitDisplacement(src.displacement()); | 900 instr.Emit32BitDisplacement(src.displacement()); |
901 } else { | 901 } else { |
902 instr.EmitOpCodeByte(0x8B); | 902 instr.EmitOpCodeByte(0x8B); |
903 instr.EmitOperand(dst.code(), src); | 903 instr.EmitOperand(dst.code(), src); |
904 } | 904 } |
905 } | 905 } |
906 | 906 |
907 template <class ReferenceType> | 907 template <class ReferenceType> |
| 908 void AssemblerBase<ReferenceType>::mov_fs(const Register32& dst, |
| 909 const Immediate& src) { |
| 910 InstructionBuffer instr(this); |
| 911 instr.EmitOpCodeByte(kFsSegmentPrefix); |
| 912 |
| 913 if (dst.id() == kRegisterEax) { |
| 914 // Special encoding for indirect displacement only to EAX. |
| 915 instr.EmitOpCodeByte(0xA1); |
| 916 } else { |
| 917 instr.EmitOpCodeByte(0x8B); |
| 918 instr.EmitOpCodeByte(0x1D); |
| 919 } |
| 920 instr.Emit32BitImmediate(src); |
| 921 } |
| 922 |
| 923 template <class ReferenceType> |
908 void AssemblerBase<ReferenceType>::mov_fs(const Operand& dst, | 924 void AssemblerBase<ReferenceType>::mov_fs(const Operand& dst, |
909 const Register32& src) { | 925 const Register32& src) { |
910 InstructionBuffer instr(this); | 926 InstructionBuffer instr(this); |
911 instr.EmitOpCodeByte(kFsSegmentPrefix); | 927 instr.EmitOpCodeByte(kFsSegmentPrefix); |
912 | 928 |
913 if (src.id() == kRegisterEax && IsDisplacementOnly(dst)) { | 929 if (src.id() == kRegisterEax && IsDisplacementOnly(dst)) { |
914 // Special encoding for indirect displacement only from EAX. | 930 // Special encoding for indirect displacement only from EAX. |
915 instr.EmitOpCodeByte(0xA3); | 931 instr.EmitOpCodeByte(0xA3); |
916 instr.Emit32BitDisplacement(dst.displacement()); | 932 instr.Emit32BitDisplacement(dst.displacement()); |
917 } else { | 933 } else { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 } | 1173 } |
1158 | 1174 |
1159 template <class ReferenceType> | 1175 template <class ReferenceType> |
1160 void AssemblerBase<ReferenceType>::add(const Operand& dst, | 1176 void AssemblerBase<ReferenceType>::add(const Operand& dst, |
1161 const Immediate& src) { | 1177 const Immediate& src) { |
1162 InstructionBuffer instr(this); | 1178 InstructionBuffer instr(this); |
1163 instr.EmitArithmeticInstructionToOperand(0x83, 0x81, 0, dst, src); | 1179 instr.EmitArithmeticInstructionToOperand(0x83, 0x81, 0, dst, src); |
1164 } | 1180 } |
1165 | 1181 |
1166 template <class ReferenceType> | 1182 template <class ReferenceType> |
| 1183 void AssemblerBase<ReferenceType>::inc(const Operand& dst) { |
| 1184 InstructionBuffer instr(this); |
| 1185 instr.EmitOpCodeByte(0xFE); |
| 1186 instr.EmitOperand(0, dst); |
| 1187 } |
| 1188 |
| 1189 template <class ReferenceType> |
1167 void AssemblerBase<ReferenceType>::sub(const Register8& dst, | 1190 void AssemblerBase<ReferenceType>::sub(const Register8& dst, |
1168 const Register8& src) { | 1191 const Register8& src) { |
1169 InstructionBuffer instr(this); | 1192 InstructionBuffer instr(this); |
1170 instr.EmitArithmeticInstruction(0x2A, dst, src); | 1193 instr.EmitArithmeticInstruction(0x2A, dst, src); |
1171 } | 1194 } |
1172 | 1195 |
1173 template <class ReferenceType> | 1196 template <class ReferenceType> |
1174 void AssemblerBase<ReferenceType>::sub(const Register8& dst, | 1197 void AssemblerBase<ReferenceType>::sub(const Register8& dst, |
1175 const Immediate& src) { | 1198 const Immediate& src) { |
1176 InstructionBuffer instr(this); | 1199 InstructionBuffer instr(this); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 | 1509 |
1487 return serializer_->FinalizeLabel( | 1510 return serializer_->FinalizeLabel( |
1488 location, reinterpret_cast<const uint8_t*>(&relative_value), | 1511 location, reinterpret_cast<const uint8_t*>(&relative_value), |
1489 sizeof(relative_value)); | 1512 sizeof(relative_value)); |
1490 } | 1513 } |
1491 } | 1514 } |
1492 | 1515 |
1493 } // namespace assm | 1516 } // namespace assm |
1494 | 1517 |
1495 #endif // SYZYGY_ASSM_ASSEMBLER_BASE_IMPL_H_ | 1518 #endif // SYZYGY_ASSM_ASSEMBLER_BASE_IMPL_H_ |
OLD | NEW |