bug-grub
[Top][All Lists]
Advanced

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

ERR_BELOW_1MB tests signed address?


From: Mike Tsao
Subject: ERR_BELOW_1MB tests signed address?
Date: Thu, 31 May 2001 22:30:33 -0700

[Trying again... didn't go through last time I sent it...]

I built an ELF executable with a load address of 0xC0000000. Here's what
objdump said about it:

myfile:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000004d6  C0000000  C0000000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
[etc...]

GRUB had some trouble with it, complaining that "Loading below 1MB is not
supported." The commands I used to load it were root (hd0,0); makeactive;
kernel mydir/myfile (Bochs for Win32, FAT file system).

Changing the load address to 0x00200000 solved the problem.

I think this is the GRUB code that gave the error (5.96.1, stage2/boot.c,
lines 110-111):

if (((int) entry_addr) < 0x100000)
    errnum = ERR_BELOW_1MB;

Is this a bug? Is it customary to treat 32-bit addresses as signed integers?
If this is a bug, then the fix is straightforward -- for entry_addr and
similar variables, change the type (and explicit casts) to unsigned int. Or
maybe change the types to void*, which will have portability problems on
64-bit machines, but int would have had those problems, too.

I'd be happy to make the patch and test it, but first I'm concerned that
there's a reason why the team picked int rather than unsigned int, such that
my proposed fix wouldn't be appropriate.

--
Mike Tsao




reply via email to

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