[Efi332] newlib stack size requirement?

bowtievette at aol.com bowtievette
Fri Aug 19 01:55:04 UTC 2005


Yeah, 32k for a stack for printf is rediculous. If it needs that much something is wrong. Testing if thats the case is easy though. Just allocate a huge stack, fill it with 0xFFFF's and see how much it uses. To me it seems unlikely that this is the problem though. 
Does sprintf work? Probably not since it probably relies on the same low level code.
 
-----Original Message-----
From: David Eicher <sailors3 at comcast.net>
To: efi332 at diy-efi.org
Sent: Thu, 18 Aug 2005 18:20:34 -0700
Subject: RE: [Efi332] newlib stack size requirement?


Hi Jeff,
 
I?m just wondering how much deeper libc will take me into the stack (worst case) to make sure my stack is sized correctly. Vfprintf looks like this:
 
int 
_DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
       struct _reent *data _AND
       FILE * fp           _AND
       _CONST char *fmt0   _AND
       va_list ap)
{
      70:  94 21 f8 d0        stwu    r1,-1840(r1)
 
So it is using just 1840 bytes, I was afraid it was bigger than that.  
 
Code like this is executing in the locale.c file:
 
struct lconv *
_DEFUN_VOID(localeconv)
{
 170:     94 21 ff e0         stwu    r1,-32(r1)
 174:     7c 08 02 a6       mflr    r0
 178:     42 9f 00 05        bcl-    20,4*cr7+so,17c <localeconv+0xc>
 17c:     93 c1 00 18       stw     r30,24(r1)
 180:     7f c8 02 a6        mflr    r30
 184:     90 01 00 24       stw     r0,36(r1)
 188:     80 1e ff f0          lwz     r0,-16(r30)
 18c:     7f c0 f2 14         add     r30,r0,r30
  return _localeconv_r (_REENT);
}
 190:     80 01 00 24       lwz     r0,36(r1)
 194:     81 3e 80 10       lwz     r9,-32752(r30)
 198:     7c 08 03 a6       mtlr    r0
 19c:     83 c1 00 18       lwz     r30,24(r1)
 1a0:     80 69 00 00       lwz     r3,0(r9)
 1a4:     3
 
Look at that instruction at address 194: What is that??? A 32k offset on some access. I guess that is the one I thought at first might have been a stack access. It must be something else but haven?t checked to see where it goes. 
 
It looks like I?m probably okay on stack at 4k unless some of the other lib calls are nested and big stack users.
 
Regards,
 
Dave
 
 



From: efi332-bounces at diy-efi.org [mailto:efi332-bounces at diy-efi.org] On Behalf Of BowTieVette at aol.com
Sent: Thursday, August 18, 2005 8:46 AM
To: efi332 at diy-efi.org
Subject: Re: [Efi332] newlib stack size requirement?
 
In a message dated 8/18/2005 10:14:04 AM Eastern Standard Time, sailors3 at comcast.net writes:
Does anyone know how large a stack is required for newlib libc, libmbx, and
libgloss?
Not exactly sure what you mean by that Dave. Stack usage is a runtime dependent thing that depends on what functions you are currently running from those libraries. 
_______________________________________________
Efi332 mailing list
Efi332 at diy-efi.org
http://lists.diy-efi.org/mailman/listinfo/efi332
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.diy-efi.org/pipermail/efi332/attachments/20050818/9575db52/attachment.html 



More information about the Efi332 mailing list