cygwin.asm revision 52284
1189251Ssam/* stuff needed for libgcc1 on win32. */
2189251Ssam
3189251Ssam#ifdef L_chkstk
4189251Ssam
5252726Srpaulo	.global ___chkstk
6252726Srpaulo	.global	__alloca
7189251Ssam___chkstk:
8189251Ssam__alloca:
9189251Ssam	pushl  %ecx		/* save temp */
10189251Ssam	movl   %esp,%ecx	/* get sp */
11189251Ssam	addl   $0x8,%ecx	/* and point to return addr */
12189251Ssam
13189251Ssamprobe: 	cmpl   $0x1000,%eax	/* > 4k ?*/
14189251Ssam	jb    done		
15189251Ssam
16189251Ssam	subl   $0x1000,%ecx  		/* yes, move pointer down 4k*/
17189251Ssam	orl    $0x0,(%ecx)   		/* probe there */
18189251Ssam	subl   $0x1000,%eax  	 	/* decrement count */
19189251Ssam	jmp    probe           	 	/* and do it again */
20189251Ssam
21189251Ssamdone: 	subl   %eax,%ecx	   
22189251Ssam	orl    $0x0,(%ecx)	/* less that 4k, just peek here */
23189251Ssam
24189251Ssam	movl   %esp,%eax
25189251Ssam	movl   %ecx,%esp	/* decrement stack */
26189251Ssam
27189251Ssam	movl   (%eax),%ecx	/* recover saved temp */
28189251Ssam	movl   4(%eax),%eax	/* get return address */
29189251Ssam	jmp    *%eax	
30189251Ssam
31189251Ssam
32189251Ssam#endif
33189251Ssam