Hi,

when reading the multiboot specs, I ran into a few issues I didn't
understand, so I the included example kernel to print more
information.

However, I'd like to have these issues clarified, so I can submit a
clean patch to kernel.c/multiboot.h which prints all the fields
mentioned in the specification. 

A preliminary patch is attached.


========================================================================

---8<-------------------------------------------------------------------
   If bit 7 in the `flags' is set, then the `drives_*' fields are
valid, and indicate the address of the physical address of the first
drive structure and the size of drive structures. `drives_addr' is the
address, and `drives_length' is the total size of drive structures.
Note that `drives_length' may be zero. 
---8<-------------------------------------------------------------------

Hmm. So i have valid drives_* according to bit 7, and the values are:
   drives_length = 0
   drives_addr   = 0x30620

Am I right assuming that if (drives_length == 0), then the drives_addr
must be considered bogus? Thats a cautious assumption, but I think the
spec should say so explicitly :)


========================================================================

---8<-------------------------------------------------------------------
   If bit 8 in the `flags' is set, then the `config_table' field is
valid, and indicates the address of the ROM configuration table
returned by the "GET CONFIGURATION" BIOS call. If the BIOS call fails,
then the size of the table must be _zero_.
---8<-------------------------------------------------------------------

I get config_table == 0 on this machine.

So if "the size of the table" must be zero, where do I get that size
from, and what value should the address config_table field have in
that case?

Or should that read

   "If the BIOS call fails, then the *address* of the table
    (contained in config_table) must be zero."

?


========================================================================

Note that in grub/docs/ there are these files in CVS:

   boot.S
   kernel.c
   multiboot.h

and

   boot.S.texi
   kernel.c.texi
   multiboot.h.texi

while the latter three are automatically generated anyway. My patch
only patches the former three, so you'll have to regenerate the texi
files before you see the new source in texinfo.


Regards,

Uli

Index: docs/boot.S
===================================================================
RCS file: /cvsroot/grub/grub/docs/boot.S,v
retrieving revision 1.2
diff -u -3 -p -r1.2 boot.S
--- docs/boot.S	11 Jan 2001 23:33:09 -0000	1.2
+++ docs/boot.S	5 Jul 2004 19:47:58 -0000
@@ -77,4 +77,4 @@ halt_message:
 
 	/* Our stack area.  */
 	.comm	stack, STACK_SIZE
-	
\ No newline at end of file
+
Index: docs/kernel.c
===================================================================
RCS file: /cvsroot/grub/grub/docs/kernel.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 kernel.c
--- docs/kernel.c	11 Jan 2001 07:28:16 -0000	1.3
+++ docs/kernel.c	5 Jul 2004 19:47:59 -0000
@@ -150,6 +152,55 @@ cmain (unsigned long magic, unsigned lon
 		(unsigned) mmap->length_low,
 		(unsigned) mmap->type);
     }
+
+  /* Are drives_* valid? */
+  if (CHECK_FLAG (mbi->flags, 7))
+    {
+      printf ("drives_* are valid: %d at 0x%x\n", 
+	      mbi->drives_length, mbi->drives_addr);
+
+      unsigned long iter_addr = mbi->drives_addr;
+      while (iter_addr < mbi->drives_addr + mbi->drives_length)
+	{
+	  drive_info_t *di;
+	  di = (drive_info_t *) iter_addr;
+	  printf ("  size=%d no=0x%x mode=%d CHS=%d:%d:%d\n",
+		  di->size, di->drive_number, di->drive_mode,
+		  di->drive_cylinders, di->drive_heads, di->drive_sectors);
+	  addr = addr + di->size;
+	}
+    }
+
+  /* Is config_table valid? */
+  if (CHECK_FLAG (mbi->flags, 8))
+    {
+      printf ("config_table is at %x\n", mbi->config_table);
+    }
+
+  /* Is boot_loader_name valid? */
+  if (CHECK_FLAG (mbi->flags, 9))
+    {
+      printf ("boot loader name = %s\n", mbi->boot_loader_name);
+    }
+
+  /* Is apm_table valid? */
+  if (CHECK_FLAG (mbi->flags, 10))
+    {
+      printf ("APM table at 0x%x\n", mbi->apm_table);
+    }
+
+  /* Is graphics table valid? */
+  if (CHECK_FLAG (mbi->flags, 11))
+    {
+      printf ("VBE ctrl_info at 0x%x, mode_info at 0x%x, mode=0x%x\n"
+	      "    interface seg = 0x%x, off = 0x%x, len = 0x%x\n",
+	      mbi->vbe_control_info, mbi->vbe_mode_info,
+	      mbi->vbe_mode,
+	      mbi->vbe_interface_seg, mbi->vbe_interface_off, 
+	      mbi->vbe_interface_len
+	      );
+    }
+
 }    
 
 /* Clear the screen and initialize VIDEO, XPOS and YPOS.  */
Index: docs/multiboot.h
===================================================================
RCS file: /cvsroot/grub/grub/docs/multiboot.h,v
retrieving revision 1.2
diff -u -3 -p -r1.2 multiboot.h
--- docs/multiboot.h	11 Jan 2001 23:33:09 -0000	1.2
+++ docs/multiboot.h	5 Jul 2004 19:47:59 -0000
@@ -93,6 +93,17 @@ typedef struct multiboot_info
   } u;
   unsigned long mmap_length;
   unsigned long mmap_addr;
+  unsigned long drives_length;
+  unsigned long drives_addr;
+  unsigned long config_table;
+  unsigned long boot_loader_name;
+  unsigned long apm_table;
+  unsigned long vbe_control_info;
+  unsigned long vbe_mode_info;
+  unsigned long vbe_mode;
+  unsigned long vbe_interface_seg;
+  unsigned long vbe_interface_off;
+  unsigned long vbe_interface_len;
 } multiboot_info_t;
 
 /* The module structure.  */
@@ -116,4 +127,17 @@ typedef struct memory_map
   unsigned long type;
 } memory_map_t;
 
+/* The drive info structure.
+ * FIXME: __attribute__ ((packed)) required? */
+typedef struct drive_info
+{
+  unsigned long size;
+  unsigned char drive_number;
+  unsigned char drive_mode;
+  unsigned short drive_cylinders;
+  unsigned char drive_heads;
+  unsigned char drive_sectors;
+  unsigned short drive_ports[0];
+} drive_info_t;
+
 #endif /* ! ASM */
_______________________________________________
Bug-grub mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-grub

Reply via email to