Error in CHKSTK.ASM
-
Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line:
probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no
I wonder what kind of error that cause this? Thanks in advance -
Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line:
probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no
I wonder what kind of error that cause this? Thanks in advanceThe code you posted is not enough to find out what is wrong. What, e.g., is the value ecx gets initialized with? Don't try it, just do it! ;-)
-
The code you posted is not enough to find out what is wrong. What, e.g., is the value ecx gets initialized with? Don't try it, just do it! ;-)
the ecx value is 206832, and the eax value is 15741120 I don't understand what does the ecx and the eax mean and how it gets initialized. However, before the debug window bring me to CHKSTK.ASM, the error dialog box said 'Unhandled exception... ..Stack Overflow'. thanks
-
Dear all, I run my program using F5 (which will stops in certain line when an error found), and it stops at file CHKSTK.ASM in this highlighted line:
probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no
I wonder what kind of error that cause this? Thanks in advanceThe error said stack overflow. You are looking in the wrong place. chkstk.asm is where the program actually ran out of stack memory, but your problem is a design issue. When the error happens look at the call stack in the debugger to see what function(s) were called to produce the overflow. You either: 1. Tried to allocate too much memory from the stack. e.g. void badfunc( void ) { long badvar[128*1024]; ... } or, 2. Got caught in a deep function call loop that ended with the same effect as 1. e.g. for small values this is fine, for larger values it will blow the stack long badrecurse( long R ) { long r = 1; // alloc 4 bytes off stack - each iteration! if( R > 1 ) r = badrecurse(R-1); return(R * r); } ...cmk Save the whales - collect the whole set