* Odd behavior in x86/pc booting process with minor modifications
@ 2008-01-27 14:52 Vesa Jääskeläinen
2008-01-27 16:56 ` Bean
0 siblings, 1 reply; 2+ messages in thread
From: Vesa Jääskeläinen @ 2008-01-27 14:52 UTC (permalink / raw)
To: The development of GRUB 2
Hi,
I was playing around with IDT and needed some code space in startup.S
and in realmode.S. GRUB just hanged for some reason during the bootup
when I just had query instruction for current IDT descriptor and some
storage for it after GDT tables.
I then reverted that code and added as many NOPs as that code would take
there and it was still hanging... then I removed some NOPs and hang went
away. I don't have good debugging capabilities other than qemu's log,
but it would seem like when grub is decompressing itself there is minor
code flow difference, though this could only be because binary is a bit
different... so I am not sure about that theory... anyway if there are
good ideas on how to debug this, or even better solutions to possible
problem :). Any ideas are welcome.
So how to reproduce this problem:
1. open kern/i386/pc/startup.S
2. find codestart
// actual location is not so important
3. find first sti instruction
4. go 1 line backwards
5. add about 15 NOP's
6. recompile and make image
7. try it out, it should hang without displaying grub shell or menu.
Thanks,
Vesa Jääskeläinen
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Odd behavior in x86/pc booting process with minor modifications
2008-01-27 14:52 Odd behavior in x86/pc booting process with minor modifications Vesa Jääskeläinen
@ 2008-01-27 16:56 ` Bean
0 siblings, 0 replies; 2+ messages in thread
From: Bean @ 2008-01-27 16:56 UTC (permalink / raw)
To: The development of GRUB 2
On Jan 27, 2008 10:52 PM, Vesa Jääskeläinen <chaac@nic.fi> wrote:
> Hi,
>
> I was playing around with IDT and needed some code space in startup.S
> and in realmode.S. GRUB just hanged for some reason during the bootup
> when I just had query instruction for current IDT descriptor and some
> storage for it after GDT tables.
>
> I then reverted that code and added as many NOPs as that code would take
> there and it was still hanging... then I removed some NOPs and hang went
> away. I don't have good debugging capabilities other than qemu's log,
> but it would seem like when grub is decompressing itself there is minor
> code flow difference, though this could only be because binary is a bit
> different... so I am not sure about that theory... anyway if there are
> good ideas on how to debug this, or even better solutions to possible
> problem :). Any ideas are welcome.
>
> So how to reproduce this problem:
>
> 1. open kern/i386/pc/startup.S
> 2. find codestart
>
> // actual location is not so important
> 3. find first sti instruction
> 4. go 1 line backwards
>
> 5. add about 15 NOP's
>
> 6. recompile and make image
> 7. try it out, it should hang without displaying grub shell or menu.
This is actually caused by memory overlap. in grub-mkimage, it will
compress from offset 0x4A0 (GRUB_KERNEL_MACHINE_RAW_SIZE), which
corresponds to 0x6A0 of core.img. this is inside of lzo decompression
code which ends at 0x6A2 (you can verify this by adding a text string
at the end of lzo1x.S). it's a very delicate situation. when you add
more code, it push the lzo decompression code further back, making
more code inside compression zone, and it's bound to go wrong. The fix
is to increase the value of GRUB_KERNEL_MACHINE_RAW_SIZE.
--
Bean
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-27 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-27 14:52 Odd behavior in x86/pc booting process with minor modifications Vesa Jääskeläinen
2008-01-27 16:56 ` Bean
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.