Hello!

I'm trying to understand why "map" doesn't work for me.
A side effect of my efforts is the attached patch.
It makes it possible to examine the mapping table before it is activated.

"map" without arguments will show the mapping table.

ChangeLog:
        * stage2/builtins.c (map_func): if no arguments have been given
        display the mapping table
        * docs/user-ref.texi: document it

The new "map" command already shows interesting things (possibly bugs) in
the map code:

grub> map (hd2) (hd1)
grub> map (hd2) (hd0)
grub> map
    Real    Emulated
    0x81 -> 0x82    
    0x80 -> 0x82

What will our handler do with requests to 0x82? Will it use 0x80 or 0x81~?

Also it seems that the mapping is only activated when chainloader is used
and it has no effect on GRUB itself. Should it be fixed or documented?

Pavel Roskin

Index: docs/user-ref.texi
--- docs/user-ref.texi  Thu Nov 18 01:00:24 1999
+++ docs/user-ref.texi  Wed Dec  8 23:53:05 1999
@@ -888,6 +888,9 @@
 
 The example exchanges the order between the first hard disk and the
 second hard disk.
+
+If no arguments are given to the command, the current mapping table is
+displayed.
 @end deffn
 
 @deffn Command module file @dots{}
Index: stage2/builtins.c
--- stage2/builtins.c   Sat Nov 13 04:39:42 1999
+++ stage2/builtins.c   Wed Dec  8 23:48:11 1999
@@ -1620,6 +1620,18 @@
   unsigned long to, from;
   int i;
   
+  if (!*arg)
+    {
+      grub_printf ("    Real    Emulated\n");
+      for (i = 0; i < DRIVE_MAP_SIZE; i++)
+       {
+         if (!bios_drive_map[i])
+           break;
+         grub_printf ("    0x%x -> 0x%x\n", bios_drive_map[i] & 0xFF,
+                      bios_drive_map[i] >> 8);
+       }
+      return 0;
+    }
   to_drive = arg;
   from_drive = skip_to (0, arg);
 
@@ -1667,10 +1679,11 @@
   "map",
   map_func,
   BUILTIN_CMDLINE,
-  "map TO_DRIVE FROM_DRIVE",
+  "map [TO_DRIVE FROM_DRIVE]",
   "Map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary"
   " when you chain-load some operating systems, such as DOS, if such an"
-  " OS resides at a non-first drive."
+  " OS resides at a non-first drive. When no arguments are given, print"
+  " the current mapping table."
 };
   
 

Reply via email to