LeaSourceAndOffset: pointer-to-int truncation fixed

This commit is contained in:
unknown 2015-10-30 13:27:02 -04:00
parent fbc9b80270
commit 69ebe1672b
3 changed files with 5 additions and 4 deletions

View File

@ -5444,7 +5444,7 @@ void Compile_Opcode_LRV ( void ) {
Jump[0] = RecompPos - 1;
/*
DecX86reg(x86_EAX);
LeaSourceAndOffset(x86_EAX, x86_EAX, (DWORD) &RSP_Vect[RSPOpC.rt].B[0]);
LeaSourceAndOffset(x86_EAX, x86_EAX, (size_t)&RSP_Vect[RSPOpC.rt].B[0]);
DecX86reg(x86_EAX);
*/
AddConstToX86Reg(x86_EAX, ((DWORD)&RSP_Vect[RSPOpC.rt].UB[0]) - 2);

View File

@ -1101,7 +1101,7 @@ void JsLabel32(char *Label, DWORD Value) {
** if we need this rewrite it into 1 function
**/
void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, int offset) {
void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, size_t offset) {
WORD x86Command = 0;
CPU_Message(" lea %s, [%s + %0Xh]",x86_Name(x86DestReg),x86_Name(x86SourceReg),offset);
@ -1130,7 +1130,8 @@ void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, int offset) {
DisplayError("LeaSourceAndOffset\nUnknown x86 Register");
}
if ((offset & 0xFFFFFF80) != 0 && (offset & 0xFFFFFF80) != 0xFFFFFF80) {
// To do: Check high DWORD of offset for 64-bit x86.
if ((offset & 0x00000000FFFFFF80) != 0 && (offset & ~0x7F) != ~0x7F) {
PUTDST16(RecompPos,x86Command);
PUTDST32(RecompPos,offset);
} else {

View File

@ -105,7 +105,7 @@ void JneLabel32 ( char * Label, DWORD Value );
void JnsLabel8 ( char * Label, BYTE Value );
void JnsLabel32 ( char * Label, DWORD Value );
void JsLabel32 ( char * Label, DWORD Value );
void LeaSourceAndOffset ( int x86DestReg, int x86SourceReg, int offset );
void LeaSourceAndOffset ( int x86DestReg, int x86SourceReg, size_t offset );
void MoveConstByteToN64Mem ( BYTE Const, int AddrReg );
void MoveConstHalfToN64Mem ( WORD Const, int AddrReg );
void MoveConstByteToVariable ( BYTE Const,void *Variable, char *VariableName );