avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #19050] gcrt1.S should call main rather than jumping


From: Anatoly Sokolov
Subject: [avr-libc-dev] [bug #19050] gcrt1.S should call main rather than jumping to it
Date: Tue, 13 Feb 2007 16:51:49 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

Follow-up Comment #1, bug #19050 (project avr-libc):

Call main() as a normal function have some drawback:

1. Loss of two bytes of RAM for storing 'main' return address in stack.

2. Increase code size, if 'main' function has local variables.

Now stack frames for 'main' function is setup by a following code:
REG_Y (frame pointer)  = RAM_END - frame_size
SP = REG_Y

Size = 4 instruction.

If 'main' will be usual function, that in prologue will be a following code:

PUSH REG_Y
REG_Y = SP
REG_Y = REG_Y - frame_size
SP = REG_Y

Size - 7/8 instruction and loss of two bytes more of RAM. And 7/8 more
instructions in an epilogue of function.

3. If in 'main' function 'call-saved' registers (r2..r17) will be used, then
they will be saved in a stack. 
 

 

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?19050>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]