Re: Newbie doubts about stack !

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

 



I tried your same code with gcc and come up with different values:

//0-16  = 24 (4*8)
//17-32 = 40 (5*8)
//33-48 = 56 (6*8)
//49-64 = 72 (7*8)

which do all line up on boundaries of 8. Which seems correct, If I remember 
correctly the smallest amount of memory you can request from the kernel is 32 
bytes from the slab allocator??? However, when I changed the char to an int 
inside of 'function' I got these results:

>     0  - 4     =    24
>     5  - 16    =   40
>     17 - 32    =   56

I couldn't find anything the gave me a 4byte offset on the stack under gcc.

As far as the extra 8 bytes on each one, I do recall that there is space for 
the next instruction pointer and return value. But I don't have a book handy 
and can't remember the details about this.

Tom
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux