vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all, I'm writing a c application which involves assembly commands in it, under AIX 5.1 (power 604), with cc compiler. What is the stack size of this c application? What is the size of the stack frame each method receives in this c application? How can i adjust the latter sizes, and is it possible to adjust them through assembly run-time commands? How can i know what is the address of the "stack floor" in my machine? Thanks in advance... |
| ||||
| "AIX Programmer" <israelaix@hotmail.com> writes: >I'm writing a c application which involves assembly commands in it, >under AIX 5.1 (power 604), with cc compiler. >What is the stack size of this c application? Unless you manipulate the -bmaxdata ld argument, the stack and heap share a single 256 MB segment. The stack can grow until it bumps into the heap or vice versa. If you use -bmaxdata, the stack has its own 256 MB segment (less a little bit for the system). Go to <http://publibn.boulder.ibm.com/cgi-bin/ds_form?lang=en_US&viewset=AIX> and search for "Large program support" for more information. >What is the size of the stack frame each method receives in this c >application? C programs don't have methods - they have procedures or functions. The term "method" is usually reserved for object oriented programming languages. In any case, the compiler decides how much stack to reserve for each function by looking at the function's arguments, calls, and automatic variables. That is, there is no single size--it depends on what each function does. The following page might help: <http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/linkage_convent.htm> >How can i adjust the latter sizes, and is it possible to adjust them >through assembly run-time commands? You can allocate space on the stack using the C "alloca()" function. See the man page for malloc() for more information. That space is then available for your assembly code. <http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/libs/basetrf1/malloc.htm> Of course, you can also do it from assembly, but the less assembly you write, the more likely your code is to work correctly. The easiest way to find the correct assembly is to disassemble C code that uses alloca(). -- Dale Talcott, Rosen Center for Advanced Computing, Purdue University aeh@quest.cc.purdue.edu http://quest.cc.purdue.edu/~aeh/ |