Hi,

so, umm, what help are you asking for? :)

The chktsk goes down the stack and probes every page to make sure its
accessible before it is actually overrun (I guess a costly measure to avoid
stack overflows). I found its source code here:

http://read.pudn.com/downloads63/sourcecode/embed/220997/FATFS/X86/ch
kstk.asm__.htm

So, it looks like the 66,000 is too much of a stack size. M$ says it is
supposed to be 1MB, but I'm not sure what cegcc linker default's is. So I'd
poke around the EXE file to see what it says for the binary stack size.
According to pecoff_v8, there are two fields that control the stack size,
SizeOfStackReserve, SizeOfStackCommit.

Thanks,
  Pawel.

2009/6/6 Danny Backx <danny.ba...@scarlet.be>
>
> I've been poking in the stack limit problem that Johnny reported.
>
> Test program attached, it can be used with e.g.
>  i386-mingw32ce-gcc -DSTACK_SIZE=6000 -o stack6000.exe stack.c
>  i386-mingw32ce-gcc -DSTACK_SIZE=66000 -o stack66000.exe stack.c
>
> The stack6000 execution succeeds and leaves the expected contents in
> out.txt :
>  In main
>  Size : 6000
>  After memset
> The stack66000 execution creates a dialog on the screen saying
>        Application Error
>        Application stack66000.EXE encountered a serious error and must shut
> down
> It also adds one line to out.txt :
>  In main
>
> I've built a linux gcc 4.4.0, as expected the same application has no
> problems on linux.
>
> A difference between the assembly code generated for the two platforms
> (see attached source files) is that the CE version calls a function
> __chkstk to probe the stack (see gcc/config/i386/cygwin.asm), the linux
> version does not.
>
> large:                          (Linux)
>        pushl   %ebp
>        movl    %esp, %ebp
>        subl    $66024, %esp
>        movl    $.LC0, %eax
>        movl    $66000, 8(%esp)
>        movl    %eax, 4(%esp)
>        movl    $outbuf, (%esp)
>        call    sprintf
>        movl    $outbuf, (%esp)
>        call    Print
>
>
> _large:                         (CE)
>        pushl   %ebp
>        movl    %esp, %ebp
>        movl    $66024, %eax
>        call    ___chkstk
>        movl    $66000, 8(%esp)
>        movl    $LC0, 4(%esp)
>        movl    $_outbuf, (%esp)
>        call    _sprintf
>        movl    $_outbuf, (%esp)
>        call    _Print
>
> I've tried porting the piece of Linux assembler in the CE code. This
> requires adding an underscore at some lines, removing dots at others.
> The end result is the same though : crash.
>
> Help ! :-(
>
>        Danny
> --
> Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Cegcc-devel mailing list
> Cegcc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cegcc-devel
>



--
With best of best regards
Pawel S. Veselov

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to