[filedisk] Add GRUB4DOS module
authorShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sun, 30 May 2010 06:16:19 +0000 (02:16 -0400)
committerShao Miller <Shao.Miller@yrdsb.edu.on.ca>
Sun, 30 May 2010 06:16:19 +0000 (02:16 -0400)
Distinguish between the case of GRUB4DOS RAM disks and
GRUB4DOS sector-mapped (file-backed) disks.  A new probe
routine is added (which currently does nothing).

WinVBlock.dev
src/include/grub4dos.h
src/winvblock/filedisk/grub4dos.c [new file with mode: 0644]
src/winvblock/filedisk/makelib.bat
src/winvblock/probe.c
src/winvblock/ramdisk/grub4dos.c

index f1aca3c..cc9fd5a 100644 (file)
@@ -1,7 +1,7 @@
 [Project]\r
 FileName=WinVBlock.dev\r
 Name=WinVBlock\r
-UnitCount=55\r
+UnitCount=56\r
 PchHead=-1\r
 PchSource=-1\r
 Ver=3\r
@@ -631,3 +631,13 @@ Priority=1000
 OverrideBuildCmd=0\r
 BuildCmd=\r
 \r
+[Unit56]\r
+FileName=src\winvblock\filedisk\grub4dos.c\r
+CompileCpp=1\r
+Folder=WinVBlock/FileDisk\r
+Compile=1\r
+Link=1\r
+Priority=1000\r
+OverrideBuildCmd=0\r
+BuildCmd=\r
+\r
index 5f15d4d..11e3c39 100644 (file)
 /**
  * @file
  *
- * GRUB4DOS RAM disk specifics
+ * GRUB4DOS disk specifics
  *
  */
 
-extern void grub4dos__find (
+/* From GRUB4DOS 0.4.4's stage2/shared.h */
+winvblock__def_struct ( grub4dos__drive_mapping )
+{
+  winvblock__uint8 SourceDrive;
+  winvblock__uint8 DestDrive;
+  winvblock__uint8 MaxHead;
+  winvblock__uint8 MaxSector:6;
+  winvblock__uint8 RestrictionX:1;
+  winvblock__uint16 DestMaxCylinder:13;
+  winvblock__uint16 SourceODD:1;
+  winvblock__uint16 DestODD:1;
+  winvblock__uint16 DestLBASupport:1;
+  winvblock__uint8 DestMaxHead;
+  winvblock__uint8 DestMaxSector:6;
+  winvblock__uint8 RestrictionY:1;
+  winvblock__uint8 InSituOption:1;
+  winvblock__uint64 SectorStart;
+  winvblock__uint64 SectorCount;
+};
+
+extern void ramdisk_grub4dos__find (
+  void
+ );
+extern void filedisk_grub4dos__find (
   void
  );
 
diff --git a/src/winvblock/filedisk/grub4dos.c b/src/winvblock/filedisk/grub4dos.c
new file mode 100644 (file)
index 0000000..444e814
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2009-2010, Shao Miller <shao.miller@yrdsb.edu.on.ca>.
+ *
+ * This file is part of WinVBlock, derived from WinAoE.
+ *
+ * WinVBlock is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WinVBlock is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WinVBlock.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file
+ *
+ * GRUB4DOS file-backed disk specifics
+ *
+ */
+
+#include <stdio.h>
+#include <ntddk.h>
+
+#include "winvblock.h"
+#include "portable.h"
+#include "irp.h"
+#include "driver.h"
+#include "device.h"
+#include "disk.h"
+#include "bus.h"
+#include "filedisk.h"
+#include "debug.h"
+#include "probe.h"
+#include "grub4dos.h"
+
+void
+filedisk_grub4dos__find (
+  void
+ )
+{
+}
index ff4e7bb..7e49573 100644 (file)
@@ -2,7 +2,7 @@
 \r
 set libname=filedisk\r
 \r
-set c=filedisk.c\r
+set c=filedisk.c grub4dos.c\r
 \r
 echo !INCLUDE $(NTMAKEENV)\makefile.def        > makefile\r
 \r
index dae76ed..b14310d 100644 (file)
@@ -82,6 +82,7 @@ probe__disks (
   if ( probed )
     return;
   memdisk__find (  );
-  grub4dos__find (  );
+  ramdisk_grub4dos__find (  );
+  filedisk_grub4dos__find (  );
   probed = TRUE;
 }
index fa479bd..3882cc5 100644 (file)
 #include "ramdisk.h"
 #include "debug.h"
 #include "probe.h"
-
-/* From GRUB4DOS 0.4.4's stage2/shared.h */
-winvblock__def_struct ( grub4dos_drive_mapping )
-{
-  winvblock__uint8 SourceDrive;
-  winvblock__uint8 DestDrive;
-  winvblock__uint8 MaxHead;
-  winvblock__uint8 MaxSector:6;
-  winvblock__uint8 RestrictionX:1;
-  winvblock__uint16 DestMaxCylinder:13;
-  winvblock__uint16 SourceODD:1;
-  winvblock__uint16 DestODD:1;
-  winvblock__uint16 DestLBASupport:1;
-  winvblock__uint8 DestMaxHead;
-  winvblock__uint8 DestMaxSector:6;
-  winvblock__uint8 RestrictionY:1;
-  winvblock__uint8 InSituOption:1;
-  winvblock__uint64 SectorStart;
-  winvblock__uint64 SectorCount;
-};
+#include "grub4dos.h"
 
 void
-grub4dos__find (
+ramdisk_grub4dos__find (
   void
  )
 {
@@ -68,7 +49,7 @@ grub4dos__find (
   int_vector_ptr InterruptVector;
   winvblock__uint32 Int13Hook;
   safe_mbr_hook_ptr SafeMbrHookPtr;
-  grub4dos_drive_mapping_ptr Grub4DosDriveMapSlotPtr;
+  grub4dos__drive_mapping_ptr Grub4DosDriveMapSlotPtr;
   winvblock__uint32 i = 8;
   winvblock__bool FoundGrub4DosMapping = FALSE;
   ramdisk__type_ptr ramdisk_ptr;
@@ -100,10 +81,10 @@ grub4dos__find (
          continue;
        }
       Grub4DosDriveMapSlotPtr =
-       ( grub4dos_drive_mapping_ptr ) ( PhysicalMemory +
-                                        ( ( ( winvblock__uint32 )
-                                            InterruptVector->
-                                            Segment ) << 4 ) + 0x20 );
+       ( grub4dos__drive_mapping_ptr ) ( PhysicalMemory +
+                                         ( ( ( winvblock__uint32 )
+                                             InterruptVector->
+                                             Segment ) << 4 ) + 0x20 );
       while ( i-- )
        {
          DBG ( "GRUB4DOS SourceDrive: 0x%02x\n",