Nicolas Cannasse schrieb:
>> The problem is not the 64KB, its the 1MB, which is the default
>> stack_size for Windows. If the actual stack at creation time of the vm
>> is lower than (1MB -64kb) than result for c_stack_max is negative.
>
> Ok, got it, so a better fix would be to know the actual stack size for
> the current thread on Windows, right ? Since we don't want to reach
> 1MB stack if the stack is only 320KB as you 0x50000 example shows...
>
> Any API function for that ?
>

I don't know any - but in my simplistic view the stack is over when ESP
is zero. In your approach, you calculate the remaining stack size at
creation of the VM from the address of the vm var on the stack (= ~ESP)
and a desired stack size of 1MB and minimum frame of 64KB. if we
calculate the stack_size = min(ESP, 1MB) - 64KB it should do the trick ?

Adrian.

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to