[Etherboot-developers] More stack-ness
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Marc S. <el...@bu...> - 2002-09-21 15:13:27
|
On Sat, Sep 21, 2002 at 04:08:49PM +1000, Ken Yap wrote:
> >I just posted a patch that does this. I used a 4K stack and I copy
> >more than 3 arguments since it's easy to do so. I also made an
> >allowance so that we could return to etherboot if necessary.
>
> Sorry, your method is not good enough. You should not allocate a static
> area for the stack, it wastes space and if any more stuff is added to
> first32.c it will add pressure on space. Rather just point %esp to the
> top of the 6kB area allocated to first32 (RELOC+6144). That way, the
> stack only grows as much as needed. BTW, it's a 1kB stack you were
> allocating. If you had allocated 4kB, you would have run out of space
> already since the text size of first32 is already > 4kB.
First, I hope you noticed that there was an error in the way I handled
the stack if returning to etherboot. I forgot to account for pop'ing
the return value.
Second, thanks for making a fix. I tried this almost a year ago and
gave up because I didn't have time to look into it. I'm glad a
solution has been implemented.
Finally, I'm not sure we are talking about the same thing. The BSS
section is allocated after all of the code and data. Here's the end
of the memory may for my version of the loader:
000835a0 t vsprintf
000837c8 T sprintf
000837e8 T printf
00083944 d seg
0008395c D top_of_initrd
00083960 d rdmode
00083964 d emptytag.42
00083968 A __bss_start
00083968 A _edata
00083980 b prot_stack_top
00087980 b ip
00087980 b prot_stack
00087984 b op
00087988 b vgamode
0008798c b bp
00087990 b vendortags
00087994 b rdaddr
000879a0 B meminfo
00087c2c A _end
I'm not sure what you mean by putting pressure on first32 since all of
that code appears before this in the loader image.
However, when I look at this map (replacing 0x9's with 0x8's):
Memory layout assumed by mknbi and this program
0x07C00-0x07FFF 0.5 kB floppy boot sector if loaded from floppy
0x0F???-0x0FFFF ? kB large Etherboot data buffers (deprecated)
0x10000-0x8FFFF 512.0 kB kernel (from tagged image)
0x90000-0x901FF 0.5 kB Linux floppy boot sector (from Linux image)
0x90200-0x921FF 8.0 kB kernel setup (from Linux image)
0x92200-0x923FF 0.5 kB tagged image header ("directory")
0x92400-0x927FF 1.0 kB kernel parameters (generated by mknbi)
0x92800-0x93FFF 6.0 kB this program (generated by mknbi)
0x94000-0x9FFFF 48.0 kB Etherboot (top few kB may be used by BIOS)
Normally Etherboot starts at 0x94000
what I see is that anything longer than 6K trounces etherboot. Is
this what you mean?
|