replaced Flash RAM breakpoints in x64

This commit is contained in:
unknown 2015-09-15 18:55:27 -04:00
parent 59b1880324
commit 88a82537c7
1 changed files with 14 additions and 35 deletions

View File

@ -70,25 +70,14 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len)
FlipBuffer[count] = 0xFF; FlipBuffer[count] = 0xFF;
} }
#ifdef _M_IX86 for (count = 0; (int)count < len; count += 4)
_asm
{ {
mov edi, dest register DWORD eax;
lea ecx, [FlipBuffer]
mov edx, 0
mov ebx, len
memcpyloop: eax = *(unsigned __int32 *)&FlipBuffer[count];
mov eax, dword ptr [ecx + edx] // eax = swap32by8(eax); // ; bswap eax
;bswap eax *(unsigned __int32 *)(dest + count) = eax;
mov dword ptr [edi + edx],eax
add edx, 4
cmp edx, ebx
jb memcpyloop
} }
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
break; break;
case FLASHRAM_MODE_STATUS: case FLASHRAM_MODE_STATUS:
if (StartOffset != 0 && len != 8) if (StartOffset != 0 && len != 8)
@ -198,28 +187,18 @@ void CFlashram::WriteToFlashCommand(DWORD FlashRAM_Command)
} }
{ {
BYTE FlipBuffer[128]; BYTE FlipBuffer[128];
memset(FlipBuffer,0,sizeof(FlipBuffer)); register size_t edx;
#ifdef _M_IX86
DWORD dwWritten;
BYTE * FlashRamPointer = m_FlashRamPointer; BYTE * FlashRamPointer = m_FlashRamPointer;
_asm
{
lea edi, [FlipBuffer]
mov ecx, FlashRamPointer
mov edx, 0
memcpyloop: memset(FlipBuffer,0,sizeof(FlipBuffer));
mov eax, dword ptr [ecx + edx] for (edx = 0; edx < 128; edx += 4)
;bswap eax {
mov dword ptr [edi + edx],eax register DWORD eax;
add edx, 4
cmp edx, 128 eax = *(unsigned __int32 *)&FlashRamPointer[edx];
jb memcpyloop // eax = swap32by8(eax); // ; bswap eax
*(unsigned __int32 *)(FlipBuffer + edx) = eax;
} }
#else
g_Notify->BreakPoint(__FILEW__,__LINE__);
#endif
SetFilePointer(m_hFile,m_FlashRAM_Offset,NULL,FILE_BEGIN); SetFilePointer(m_hFile,m_FlashRAM_Offset,NULL,FILE_BEGIN);
WriteFile(m_hFile,FlipBuffer,128,&dwWritten,NULL); WriteFile(m_hFile,FlipBuffer,128,&dwWritten,NULL);