M
mclagett
Guest
I have the following code in a Visual C++ file:
void MachineForthEngine::Execute(int* pInstructionStream)
{
BYTE* pStart = m_pStart;
int* pOpCodes = pInstructionStream;
m_pVirtualCodePtr = m_pVirtualCodeTarget;
AssembleVirtualInstructions(pInstructionStream);
// now reset m_pVirtualCodePtr back to beginning
m_pVirtualCodePtr = m_pVirtualCodeTarget;
int baseForth = (int) m_forthImage;
int esSeg = baseForth + esSegPtr;
int csSeg = baseForth + csSegPtr;
int ssSeg = baseForth + ssSegPtr;
int dsSeg = baseForth + dsSegPtr;
int fsSeg = baseForth + fsSegPtr;
int gsSeg = baseForth + gsSegPtr;
__asm
{
__asm mov eax,esSeg
__asm mov [eax],es
__asm mov eax,csSeg
__asm mov [eax],cs
__asm mov eax,ssSeg
__asm mov [eax],ss
__asm mov eax,dsSeg
__asm mov [eax],ds
__asm mov eax,fsSeg
__asm mov [eax],fs
__asm mov eax,gsSeg
__asm mov [eax],gs
__asm mov eax,pStart
__asm call eax
}
int i = 1;
}
The code at pStart that I am trying to call is code that I hand assembled by writing bytes to memory. When I look at it in the disassembly winodw it appears to be perfectly valid asm code, This is the start of it:
06620668 50 push eax
06620669 51 push ecx
0662066A 52 push edx
0662066B 53 push ebx
0662066C 54 push esp
0662066D 55 push ebp
0662066E 56 push esi
0662066F 57 push edi
06620670 90 nop
06620671 90 nop
06620672 90 nop
06620673 90 nop
06620674 B8 EE EE EE EE mov eax,0EEEEEEEEh
06620679 BA FF FF FF FF mov edx,0FFFFFFFFh
0662067E BF DD DD DD DD mov edi,0DDDDDDDDh
06620683 BE CC CC CC CC mov esi,0CCCCCCCCh
06620688 BD BB BB BB BB mov ebp,0BBBBBBBBh
I am able to set a breakpoint on line 06620668. Yet when I Step Into the _asm call eax statement, it never hits the breakpoint and returns to the caller of Execute. I can't for the life of me get this breakpoint to activate even though I'm doing a call to the line where it is. I'm picking this project back up after a few years of letting it go. This use to work back in VisualStudio 2013 or 2015 (don't remember the last one I used). Anybody have any ideas?
Continue reading...
void MachineForthEngine::Execute(int* pInstructionStream)
{
BYTE* pStart = m_pStart;
int* pOpCodes = pInstructionStream;
m_pVirtualCodePtr = m_pVirtualCodeTarget;
AssembleVirtualInstructions(pInstructionStream);
// now reset m_pVirtualCodePtr back to beginning
m_pVirtualCodePtr = m_pVirtualCodeTarget;
int baseForth = (int) m_forthImage;
int esSeg = baseForth + esSegPtr;
int csSeg = baseForth + csSegPtr;
int ssSeg = baseForth + ssSegPtr;
int dsSeg = baseForth + dsSegPtr;
int fsSeg = baseForth + fsSegPtr;
int gsSeg = baseForth + gsSegPtr;
__asm
{
__asm mov eax,esSeg
__asm mov [eax],es
__asm mov eax,csSeg
__asm mov [eax],cs
__asm mov eax,ssSeg
__asm mov [eax],ss
__asm mov eax,dsSeg
__asm mov [eax],ds
__asm mov eax,fsSeg
__asm mov [eax],fs
__asm mov eax,gsSeg
__asm mov [eax],gs
__asm mov eax,pStart
__asm call eax
}
int i = 1;
}
The code at pStart that I am trying to call is code that I hand assembled by writing bytes to memory. When I look at it in the disassembly winodw it appears to be perfectly valid asm code, This is the start of it:
06620668 50 push eax
06620669 51 push ecx
0662066A 52 push edx
0662066B 53 push ebx
0662066C 54 push esp
0662066D 55 push ebp
0662066E 56 push esi
0662066F 57 push edi
06620670 90 nop
06620671 90 nop
06620672 90 nop
06620673 90 nop
06620674 B8 EE EE EE EE mov eax,0EEEEEEEEh
06620679 BA FF FF FF FF mov edx,0FFFFFFFFh
0662067E BF DD DD DD DD mov edi,0DDDDDDDDh
06620683 BE CC CC CC CC mov esi,0CCCCCCCCh
06620688 BD BB BB BB BB mov ebp,0BBBBBBBBh
I am able to set a breakpoint on line 06620668. Yet when I Step Into the _asm call eax statement, it never hits the breakpoint and returns to the caller of Execute. I can't for the life of me get this breakpoint to activate even though I'm doing a call to the line where it is. I'm picking this project back up after a few years of letting it go. This use to work back in VisualStudio 2013 or 2015 (don't remember the last one I used). Anybody have any ideas?
Continue reading...