Peter, I am trying to get memdisk to work with grub and have run into a problem. Grub loads memdisk into the 0x9000 segment and then starts it at location 0x90200. I run into problems in the first printf statement. It turns out that printf uses a switch statement that compiles into a jump table. When I reach this jump table, I believe the code is jumping into hyperspace due to the jump table using long addresses. The jump into the jump table is the instruction: jmpl 0x2220(,%eax,4) If you have a moment, can you give me a clue as to what is happening here? Thanks for your help. Gregg
On Mon, 2002-08-26 at 12:52, H. Peter Anvin wrote:> Gregg Lebovitz wrote: > > Peter, > > > > I am trying to get memdisk to work with grub and have run into a > > problem. Grub loads memdisk into the 0x9000 segment and then starts it > > at location 0x90200. I run into problems in the first printf statement. > > It turns out that printf uses a switch statement that compiles into a > > jump table. When I reach this jump table, I believe the code is jumping > > into hyperspace due to the jump table using long addresses. > > > > The jump into the jump table is the instruction: > > > > jmpl 0x2220(,%eax,4) > > > > If you have a moment, can you give me a clue as to what is happening > > here? > > > > It's just a standard jump, using a 32-bit addresses, which is legal in > real mode, as long as the value is <= 0xffff.So if I understand you correctly, even though the value A at 0x2220 + (%eax * 4) is a 32 bit address, it will be used to jump to a location within the current segment (as long as the 32bit address A is less then 0xffff). Gregg> > -hpa > >
Peter, Thank you for your help. The code should be working, so I need to figure out some other reason why I am ending up in never never land. Oh, well... Gregg On Mon, 2002-08-26 at 13:42, H. Peter Anvin wrote:> Gregg Lebovitz wrote: > > > > So if I understand you correctly, even though the value A at 0x2220 + > > (%eax * 4) is a 32 bit address, it will be used to jump to a location > > within the current segment (as long as the 32bit address A is less then > > 0xffff). > > > > Yes. > > -hpa > >
Gregg Lebovitz wrote:> Peter, > > The last time we exchanged mail, I was trying to get memdisk working > with grub. It turned out that the problem with grub, is it uses the > multiboot "semantics" and assumes the setup portion of the kernel is > less than 8192 bytes. >That's just broken. Completely, utterly broken, and it's just plain WRONG. The setup code is allowed to be 31.5K in size by specification. I WILL NOT support Grub braindamage -- that just encourages the Grub people to do more sh*t that we have to support in the kernel. We've had enough problem with Grub braindamage as it is. -hpa