Merge 14551:14980 from trunk
Modified: branches/xmlbuildsystem/reactos/apps/utils/net/finger/net.c
Modified: branches/xmlbuildsystem/reactos/apps/utils/net/ftp/fake.c
Modified: branches/xmlbuildsystem/reactos/apps/utils/net/ftp/ftp.c
Modified: branches/xmlbuildsystem/reactos/apps/utils/ps/ps.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/FREELDR.INI
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/Makefile
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/Makefile.powerpc
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/fat.asm
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/arch.S
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/archmach.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/boot.S
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/linux.S
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/machpc.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/machxbox.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/bootmgr.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/custom.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/disk/disk.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/disk/partition.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/drivemap.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/ext2.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/ext2.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/fat.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/fat.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/fs.c
Deleted: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/fsrec.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/iso.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/iso.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/ntfs.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/fs/ntfs.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/bootmgr.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/disk.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/drivemap.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/freeldr.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/fs.h
Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/fsrec.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/inifile.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/linux.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/machine.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/miscboot.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/multiboot.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/oslist.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/reactos.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/ui.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/include/version.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/inifile/ini.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/inifile/ini_init.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/inifile/inifile.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/inifile/parse.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/linuxboot.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/machine.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/miscboot.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/options.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/oslist.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/arcname.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/binhive.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/reactos.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/registry.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/registry.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/reactos/setupldr.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/ui/tui.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/ui/tui.h
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/ui/tuimenu.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/ui/ui.c
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/version.c
Modified: branches/xmlbuildsystem/reactos/bootdata/hivesft.inf
Modified: branches/xmlbuildsystem/reactos/bootdata/hivesys.inf
Modified: branches/xmlbuildsystem/reactos/bootdata/packages/reactos.dff
Modified: branches/xmlbuildsystem/reactos/bootdata/txtsetup.sif
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/detect.c
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/fdo.c
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/misc.c
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/pdo.c
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/serenum.c
Modified: branches/xmlbuildsystem/reactos/drivers/bus/serenum/serenum.h
Added: branches/xmlbuildsystem/reactos/drivers/dd/green/
Deleted: branches/xmlbuildsystem/reactos/drivers/dd/sdisk/
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/circularbuffer.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/create.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/devctrl.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/info.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/misc.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/pnp.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/rw.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/serial.c
Modified: branches/xmlbuildsystem/reactos/drivers/dd/serial/serial.h
Modified: branches/xmlbuildsystem/reactos/drivers/fs/ms/create.c
Modified: branches/xmlbuildsystem/reactos/drivers/fs/np/fsctrl.c
Modified: branches/xmlbuildsystem/reactos/drivers/fs/vfat/fsctl.c
Modified: branches/xmlbuildsystem/reactos/drivers/fs/vfat/shutdown.c
[truncated at 100 lines; 721 more skipped]
Modified: branches/xmlbuildsystem/reactos/apps/utils/net/finger/net.c
--- branches/xmlbuildsystem/reactos/apps/utils/net/finger/net.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/apps/utils/net/finger/net.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -33,7 +33,6 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-
 #include <sys/types.h>
 #include <winsock2.h>
 #include "unistd.h"
@@ -52,14 +51,14 @@
 	struct hostent *hp, def;
 	struct servent *sp;
 	struct sockaddr_in sin;
-	int s;
+	SOCKET s;
 	char *alist[1], *host;
 
 	/* If this is a local request */
 	if (!(host = rindex(name, '@')))
 		return;
 
-	*host++ = 0;
+	*host++ = '\0';
 	if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
 		def.h_name = host;
 		def.h_addr_list = alist;
@@ -80,7 +79,7 @@
 	sin.sin_family = hp->h_addrtype;
 	bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
 	sin.sin_port = sp->s_port;
-	if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
+	if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
 		perror("finger: socket");
 		return;
 	}

Modified: branches/xmlbuildsystem/reactos/apps/utils/net/ftp/fake.c
--- branches/xmlbuildsystem/reactos/apps/utils/net/ftp/fake.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/apps/utils/net/ftp/fake.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -235,7 +235,7 @@
   static char input[256];
   HANDLE in;
   HANDLE err;
-  int    count;
+  DWORD    count;
 
   in = GetStdHandle (STD_INPUT_HANDLE);
   err = GetStdHandle (STD_ERROR_HANDLE);

Modified: branches/xmlbuildsystem/reactos/apps/utils/net/ftp/ftp.c
--- branches/xmlbuildsystem/reactos/apps/utils/net/ftp/ftp.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/apps/utils/net/ftp/ftp.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -97,7 +97,7 @@
 sig_t	lostpeer();
 off_t	restart_point = 0;
 
-int cin, cout;
+SOCKET cin, cout;
 int	dataconn(char *mode);
 
 int command(char *fmt, ...);
@@ -113,7 +113,8 @@
 char *hookup(char *host, int port)
 {
 	register struct hostent *hp = 0;
-	int s,len;
+	int len;
+	SOCKET s;
 	static char hostnamebuf[80];
 
 	bzero((char *)&hisctladdr, sizeof (hisctladdr));
@@ -136,7 +137,7 @@
 	}
 	hostname = hostnamebuf;
 	s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
-	if (s < 0) {
+	if (s == INVALID_SOCKET) {
 		perror("ftp: socket");
 		code = -1;
 		return (0);
@@ -1327,8 +1328,8 @@
 		char name[MAXHOSTNAMELEN];
 		struct sockaddr_in mctl;
 		struct sockaddr_in hctl;
-		FILE *in;
-		FILE *out;
+		SOCKET in;
+		SOCKET out;
 		int tpe;
 		int cpnd;
 		int sunqe;
@@ -1371,10 +1372,10 @@
 	hisctladdr = op->hctl;
 	ip->mctl = myctladdr;
 	myctladdr = op->mctl;
-	(int) ip->in = cin; // What the hell am I looking at...?
-	cin = (int) op->in;
-	(int) ip->out = cout; // Same again...
-	cout = (int) op->out;
+	ip->in = cin;
+	cin = op->in;
+	ip->out = cout;
+	cout = op->out;
 	ip->tpe = type;
 	type = op->tpe;
 	if (!type)

Modified: branches/xmlbuildsystem/reactos/apps/utils/ps/ps.c
--- branches/xmlbuildsystem/reactos/apps/utils/ps/ps.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/apps/utils/ps/ps.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -110,8 +110,8 @@
     DWORD r;
     ANSI_STRING astring;
     HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
-    PSYSTEM_PROCESSES SystemProcesses = NULL;
-    PSYSTEM_PROCESSES CurrentProcess;
+    PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL;
+    PSYSTEM_PROCESS_INFORMATION CurrentProcess;
     ULONG BufferSize, ReturnSize;
     NTSTATUS Status;
     char buf[256];
@@ -140,7 +140,7 @@
 
     /* For every process print the information. */
     CurrentProcess = SystemProcesses;
-    while (CurrentProcess->NextEntryDelta != 0)
+    while (CurrentProcess->NextEntryOffset != 0)
     {
         int hour, hour1, thour, thour1;
         unsigned char minute, minute1, tmin, tmin1;
@@ -159,53 +159,53 @@
 	minute1  = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
 	seconds1 = (ptime.QuadPart / 10000000LL) % 60LL;
 
-	RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ProcessName, TRUE);
+	RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE);
 
         wsprintf(buf,"P%8d %8d %3d:%02d:%02d  %3d:%02d:%02d   ProcName: %s\n",
-                 CurrentProcess->ProcessId, CurrentProcess->InheritedFromProcessId,
+                 CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId,
                  hour, minute, seconds, hour1, minute1, seconds1,
                  astring.Buffer);
         WriteFile(stdout, buf, lstrlen(buf), &r, NULL);
         
         RtlFreeAnsiString(&astring);
 
-	for (ti = 0; ti < CurrentProcess->ThreadCount; ti++)
+	for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++)
 	   {
 		struct status *statt;
 		struct waitres *waitt;
 		char szWindowName[30] = {" "};
 
-		ptime = CurrentProcess->Threads[ti].KernelTime;
+		ptime = CurrentProcess->TH[ti].KernelTime;
 		thour = (ptime.QuadPart / (10000000LL * 3600LL));
 		tmin  = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
 		tsec  = (ptime.QuadPart / 10000000LL) % 60LL;
 
-		ptime  = CurrentProcess->Threads[ti].UserTime;
+		ptime  = CurrentProcess->TH[ti].UserTime;
 		thour1 = (ptime.QuadPart / (10000000LL * 3600LL));
 		tmin1  = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
 		tsec1  = (ptime.QuadPart / 10000000LL) % 60LL;
 
 		statt = thread_stat;
-                while (statt->state != CurrentProcess->Threads[ti].State  && statt->state >= 0)
+                while (statt->state != CurrentProcess->TH[ti].ThreadState  && statt->state >= 0)
                 	statt++;
 
 		waitt = waitreason;
-                while (waitt->state != CurrentProcess->Threads[ti].WaitReason  && waitt->state >= 0)
+                while (waitt->state != CurrentProcess->TH[ti].WaitReason  && waitt->state >= 0)
                         waitt++;
 
 		wsprintf (buf1, 
 		          "t%         %8d %3d:%02d:%02d  %3d:%02d:%02d   %s %s\n",
-		          CurrentProcess->Threads[ti].ClientId.UniqueThread,
+		          CurrentProcess->TH[ti].ClientId.UniqueThread,
 		          thour, tmin, tsec, thour1, tmin1, tsec1,
 		          statt->desc , waitt->desc);
         	WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
 
-		EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
+		EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread,
 		                  (ENUMWINDOWSPROC) EnumThreadProc,
 		                  (LPARAM)(LPTSTR) szWindowName );
 	   }
-	   CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +
-	                     CurrentProcess->NextEntryDelta);
+	   CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
+	                     CurrentProcess->NextEntryOffset);
 	} 
   	return (0);
 }

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/FREELDR.INI
--- branches/xmlbuildsystem/reactos/boot/freeldr/FREELDR.INI	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/FREELDR.INI	2005-05-05 19:15:25 UTC (rev 15017)
@@ -51,8 +51,7 @@
 ; [OS-General] Section Commands:
 ;
 ; BootType		- sets the boot type: ReactOS, Linux, BootSector, Partition, Drive
-; BootDrive		- sets the boot drive: 0 - first floppy, 1 - second floppy, 0x80 - first hard disk, 0x81 - second hard disk
-; BootPartition		- sets the boot partition
+; BootPath		- ARC path e.g. multi(0)disk(0)rdisk(x)partition(y)
 ; DriveMap		- maps a BIOS drive number to another (i.e. DriveMap=hd1,hd0 maps harddisk1 to harddisk0 or DriveMap=fd1,fd0)
 
 ; [BootSector OSType] Section Commands:
@@ -134,8 +133,7 @@
 
 [Linux]
 BootType=Linux
-BootDrive=hd1
-BootPartition=1
+BootPath=multi(0)disk(0)rdisk(1)partition(1)
 Kernel=/vmlinuz
 Initrd=/initrd.img
 CommandLine="root=/dev/sdb1"
@@ -146,13 +144,11 @@
 
 [MSWinders]
 BootType=Partition
-BootDrive=hd0
-BootPartition=1
+BootPath=multi(0)disk(0)rdisk(0)partition(1)
 ;DriveMap=hd1,hd0
 ;DriveMap=hd2,hd0
 ;DriveMap=hd3,hd0
 
 [DriveD]
 BootType=Partition
-BootDrive=hd1
-BootPartition=1
+BootPath=multi(0)disk(0)rdisk(1)partition(1)

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/Makefile
--- branches/xmlbuildsystem/reactos/boot/freeldr/Makefile	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/Makefile	2005-05-05 19:15:25 UTC (rev 15017)
@@ -20,6 +20,7 @@
 PATH_TO_TOP = ../..
 
 include rules.mak
+include $(PATH_TO_TOP)/config
 
 all:
 	$(MAKE) -C tools

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/Makefile.powerpc
--- branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/Makefile.powerpc	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/Makefile.powerpc	2005-05-05 19:15:25 UTC (rev 15017)
@@ -27,8 +27,8 @@
 	rm freeldr.tmp
 
 ofwldr: $(OBJS)
-	mppcw32-ld --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
-	mppcw32-objcopy $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
+	$(LD) -melf32ppc --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
+	$(OBJCOPY) $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
 	$(TOOLS)/hack-coff $@
 
 clean:

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/fat.asm
--- branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/fat.asm	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/bootsect/fat.asm	2005-05-05 19:15:25 UTC (rev 15017)
@@ -89,9 +89,6 @@
         mov es,ax								; Make ES correct
 
 
-		cmp BYTE [BYTE bp+BootDrive],BYTE 0xff	; If they have specified a boot drive then use it
-		jne GetDriveParameters
-
         mov [BYTE bp+BootDrive],dl				; Save the boot drive
 
 

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/arch.S
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/arch.S	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/arch.S	2005-05-05 19:15:25 UTC (rev 15017)
@@ -47,10 +47,10 @@
 	.code32
 
 	/* Store the boot drive */
-	movb	%dl,(_BootDrive)
+	movb	%dl,(_i386BootDrive)
 
 	/* Store the boot partition */
-	movb	%dh,(_BootPartition)
+	movb	%dh,(_i386BootPartition)
 
 	/* GO! */
 	xorl	%eax,%eax
@@ -275,9 +275,11 @@
  * other boot loaders like Grub
  */
 
+#define MB_INFO_SIZE                90
 #define MB_INFO_FLAGS_OFFSET        0
 #define MB_INFO_BOOT_DEVICE_OFFSET  12
 #define MB_INFO_COMMAND_LINE_OFFSET 16
+#define CMDLINE_SIZE                256
 
 /*
  * We want to execute at 0x8000 (to be compatible with bootsector
@@ -285,7 +287,6 @@
  * above 1MB. So we let Grub load us there and then relocate
  * ourself to 0x8000
  */
-#define CMDLINE_BASE 0x7000
 #define FREELDR_BASE 0x8000
 #define INITIAL_BASE 0x200000
 
@@ -328,6 +329,31 @@
 	movw	%dx,%ds
 	movw	%dx,%es
 
+	/* Check for valid multiboot signature */
+	cmpl	$MULTIBOOT_BOOTLOADER_MAGIC,%eax
+	jne	mbfail
+
+	/* Store multiboot info in a safe place */
+	movl	%ebx,%esi
+	movl	$(mb_info + INITIAL_BASE - FREELDR_BASE),%edi
+	movl	$MB_INFO_SIZE,%ecx
+	rep movsb
+
+	/* Save commandline */
+	movl	MB_INFO_FLAGS_OFFSET(%ebx),%edx
+	testl	$MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
+	jz	mb3
+	movl	MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
+	movl	$(cmdline + INITIAL_BASE - FREELDR_BASE),%edi
+	movl	$CMDLINE_SIZE,%ecx
+mb2:	lodsb
+	stosb
+	testb	%al,%al
+	jz	mb3
+	dec	%ecx
+	jnz	mb2
+mb3:
+
 	/* Copy to low mem */
 	movl	$INITIAL_BASE,%esi
 	movl	$FREELDR_BASE,%edi
@@ -342,8 +368,8 @@
 
 	/* Clear prefetch queue & correct CS,
 	 * jump to low mem */
-	ljmp	$PMODE_CS, $mb2
-mb2:
+	ljmp	$PMODE_CS, $mb4
+mb4:
 	/* Reload segment selectors */
 	movw	$PMODE_DS,%dx
 	movw	%dx,%ds
@@ -353,39 +379,28 @@
 	movw	%dx,%ss
 	movl	$STACK32ADDR,%esp
 
-	/* Check for valid multiboot signature */
-	cmpl	$MULTIBOOT_BOOTLOADER_MAGIC,%eax
-	jne	mbfail
-
+	movl	$mb_info,%ebx
 	/* See if the boot device was passed in */
 	movl	MB_INFO_FLAGS_OFFSET(%ebx),%edx
 	testl	$MB_INFO_FLAG_BOOT_DEVICE,%edx
-	jz	mb3
+	jz	mb5
 	/* Retrieve boot device info */
 	movl	MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax
 	shrl	$16,%eax
 	incb	%al
-	movb	%al,_BootPartition
-	movb	%ah,_BootDrive
-	jmp	mb4
-mb3:	/* No boot device known, assume first partition of first harddisk */
-	movb	$0x80,_BootDrive
-	movb	$1,_BootPartition
-mb4:
-
-	/* Check for a command line */
+	movb	%al,_i386BootPartition
+	movb	%ah,_i386BootDrive
+	jmp	mb6
+mb5:	/* No boot device known, assume first partition of first harddisk */
+	movb	$0x80,_i386BootDrive
+	movb	$1,_i386BootPartition
+mb6:
+	/* Check for command line */
+	mov	$cmdline,%eax
+	testl	$MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
+	jnz	mb7
 	xorl	%eax,%eax
-	testl	$MB_INFO_FLAG_COMMAND_LINE,%edx
-	jz	mb6
-	/* Copy command line to low mem*/
-	movl	MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
-	movl	$CMDLINE_BASE,%edi
-mb5:	lodsb
-	stosb
-	testb	%al,%al
-	jnz	mb5
-	movl	$CMDLINE_BASE,%eax
-mb6:
+mb7:
 
 	/* GO! */
 	pushl	%eax	
@@ -462,8 +477,14 @@
 	.word	0x3ff		/* Limit */
 	.long	0			/* Base Address */
 
-EXTERN(_BootDrive)
+EXTERN(_i386BootDrive)
 	.long	0
 
-EXTERN(_BootPartition)
+EXTERN(_i386BootPartition)
 	.long	0
+
+mb_info:
+	.fill	MB_INFO_SIZE, 1, 0
+
+cmdline:
+	.fill	CMDLINE_SIZE, 1, 0

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/archmach.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/archmach.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/archmach.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -27,7 +27,7 @@
 #include "rtl.h"
 
 VOID
-MachInit(VOID)
+MachInit(char *CmdLine)
 {
   ULONG PciId;
 
@@ -39,11 +39,11 @@
   PciId = READ_PORT_ULONG((ULONG*) 0xcfc);
   if (0x02a510de == PciId)
     {
-      XboxMachInit();
+      XboxMachInit(CmdLine);
     }
   else
     {
-      PcMachInit();
+      PcMachInit(CmdLine);
     }
 
   HalpCalibrateStallExecution();

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/boot.S
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/boot.S	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/boot.S	2005-05-05 19:15:25 UTC (rev 15017)
@@ -31,7 +31,7 @@
 	.code16
 
 	/* Set the boot drive */
-	movb	(_BootDrive),%dl
+	movb	(_i386BootDrive),%dl
 
 	/* Load segment registers */
 	cli

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hardware.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hardware.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -101,9 +101,9 @@
 typedef struct _CM_PNP_BIOS_DEVICE_NODE
 {
   USHORT Size;
-  UCHAR  Node;
+  CHAR  Node;
   ULONG ProductId;
-  UCHAR  DeviceType[3];
+  CHAR  DeviceType[3];
   USHORT DeviceAttributes;
 } __attribute__((packed)) CM_PNP_BIOS_DEVICE_NODE, *PCM_PNP_BIOS_DEVICE_NODE;
 
@@ -258,7 +258,7 @@
   Error = RegSetValue(ComponentKey,
 		      "Component Information",
 		      REG_BINARY,
-		      (PUCHAR)&CompInfo,
+		      (PCHAR)&CompInfo,
 		      sizeof(CM_COMPONENT_INFORMATION));
   if (Error != ERROR_SUCCESS)
     {
@@ -287,7 +287,7 @@
   LONG Error;
 
   InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
-  if (InstData == NULL || strncmp(InstData->Signature, "$PnP", 4))
+  if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
     {
       DbgPrint((DPRINT_HWDETECT, "PnP-BIOS not supported\n"));
       return;
@@ -335,7 +335,7 @@
   Error = RegSetValue(BusKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)"PNP BIOS",
+		      "PNP BIOS",
 		      9);
   if (Error != ERROR_SUCCESS)
     {
@@ -413,7 +413,7 @@
   Error = RegSetValue(BusKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR) FullResourceDescriptor,
+		      (PCHAR) FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -495,7 +495,7 @@
   Error = RegSetValue(DiskKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR) FullResourceDescriptor,
+		      (PCHAR) FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -516,7 +516,7 @@
   ULONG i;
   ULONG Checksum;
   ULONG Signature;
-  char Identifier[20];
+  CHAR Identifier[20];
   LONG Error;
 
   /* Read the MBR */
@@ -568,7 +568,7 @@
   Error = RegSetValue(DiskKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR) Identifier,
+		      Identifier,
 		      20);
   if (Error != ERROR_SUCCESS)
     {
@@ -673,7 +673,7 @@
   Error = RegSetValue(SystemKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR) FullResourceDescriptor,
+		      (PCHAR) FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -829,7 +829,7 @@
     Error = RegSetValue(PeripheralKey,
 			"Configuration Data",
 			REG_FULL_RESOURCE_DESCRIPTOR,
-			(PUCHAR) FullResourceDescriptor,
+			(PCHAR) FullResourceDescriptor,
 			Size);
     MmFreeMemory(FullResourceDescriptor);
     if (Error != ERROR_SUCCESS)
@@ -845,7 +845,7 @@
     Error = RegSetValue(PeripheralKey,
 			"Identifier",
 			REG_SZ,
-			(PUCHAR)Identifier,
+			(PCHAR)Identifier,
 			strlen(Identifier) + 1);
     if (Error != ERROR_SUCCESS)
     {
@@ -939,7 +939,7 @@
   Error = RegSetValue(ControllerKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR) FullResourceDescriptor,
+		      (PCHAR) FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -1280,7 +1280,7 @@
       Error = RegSetValue(PeripheralKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR)&FullResourceDescriptor,
+			  (PCHAR)&FullResourceDescriptor,
 			  sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
 			  sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
       if (Error != ERROR_SUCCESS)
@@ -1294,7 +1294,7 @@
       Error = RegSetValue(PeripheralKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)Identifier,
+			  Identifier,
 			  strlen(Identifier) + 1);
       if (Error != ERROR_SUCCESS)
 	{
@@ -1409,7 +1409,7 @@
       Error = RegSetValue(ControllerKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR) FullResourceDescriptor,
+			  (PCHAR) FullResourceDescriptor,
 			  Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -1426,7 +1426,7 @@
       Error = RegSetValue(ControllerKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)Buffer,
+			  Buffer,
 			  strlen(Buffer) + 1);
       if (Error != ERROR_SUCCESS)
 	{
@@ -1542,7 +1542,7 @@
       Error = RegSetValue(ControllerKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR) FullResourceDescriptor,
+			  (PCHAR) FullResourceDescriptor,
 			  Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -1559,7 +1559,7 @@
       Error = RegSetValue(ControllerKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)Buffer,
+			  Buffer,
 			  strlen(Buffer) + 1);
       if (Error != ERROR_SUCCESS)
 	{
@@ -1702,7 +1702,7 @@
     Error = RegSetValue(PeripheralKey,
 			"Configuration Data",
 			REG_FULL_RESOURCE_DESCRIPTOR,
-			(PUCHAR)FullResourceDescriptor,
+			(PCHAR)FullResourceDescriptor,
 			Size);
     MmFreeMemory(FullResourceDescriptor);
     if (Error != ERROR_SUCCESS)
@@ -1718,7 +1718,7 @@
     Error = RegSetValue(ControllerKey,
 			"Identifier",
 			REG_SZ,
-			(PUCHAR)Buffer,
+			Buffer,
 			strlen(Buffer) + 1);
     if (Error != ERROR_SUCCESS)
     {
@@ -1804,7 +1804,7 @@
   Error = RegSetValue(ControllerKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR)FullResourceDescriptor,
+		      (PCHAR)FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)
@@ -1972,7 +1972,7 @@
       Error = RegSetValue(ControllerKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR)&FullResourceDescriptor,
+			  (PCHAR)&FullResourceDescriptor,
 			  sizeof(CM_FULL_RESOURCE_DESCRIPTOR));
       if (Error != ERROR_SUCCESS)
 	{
@@ -2014,7 +2014,7 @@
 	  Error = RegSetValue(PeripheralKey,
 			      "Configuration Data",
 			      REG_FULL_RESOURCE_DESCRIPTOR,
-			      (PUCHAR)&FullResourceDescriptor,
+			      (PCHAR)&FullResourceDescriptor,
 			      sizeof(CM_FULL_RESOURCE_DESCRIPTOR) -
 			      sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
 	  if (Error != ERROR_SUCCESS)
@@ -2029,7 +2029,7 @@
 	  Error = RegSetValue(PeripheralKey,
 			      "Identifier",
 			      REG_SZ,
-			      (PUCHAR)"MICROSOFT PS2 MOUSE",
+			      "MICROSOFT PS2 MOUSE",
 			      20);
 	  if (Error != ERROR_SUCCESS)
 	    {
@@ -2098,7 +2098,7 @@
   Error = RegSetValue(ControllerKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)Buffer,
+		      Buffer,
 		      strlen(Buffer) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -2146,7 +2146,7 @@
   Error = RegSetValue(BusKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)"ISA",
+		      "ISA",
 		      4);
   if (Error != ERROR_SUCCESS)
     {
@@ -2175,7 +2175,7 @@
   Error = RegSetValue(BusKey,
 		      "Configuration Data",
 		      REG_FULL_RESOURCE_DESCRIPTOR,
-		      (PUCHAR) FullResourceDescriptor,
+		      (PCHAR) FullResourceDescriptor,
 		      Size);
   MmFreeMemory(FullResourceDescriptor);
   if (Error != ERROR_SUCCESS)

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -92,7 +92,7 @@
       Error = RegSetValue(BiosKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)"ACPI BIOS",
+			  "ACPI BIOS",
 			  10);
       if (Error != ERROR_SUCCESS)
 	{

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -95,7 +95,7 @@
       Error = RegSetValue(BiosKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)"APM",
+			  "APM",
 			  4);
       if (Error != ERROR_SUCCESS)
 	{

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwcpu.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -111,8 +111,8 @@
 DetectCPU(FRLDRHKEY CpuKey,
 	  FRLDRHKEY FpuKey)
 {
-  char VendorIdentifier[13];
-  char Identifier[64];
+  CHAR VendorIdentifier[13];
+  CHAR Identifier[64];
   ULONG FeatureSet;
   FRLDRHKEY CpuInstKey;
   FRLDRHKEY FpuInstKey;
@@ -195,7 +195,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "FeatureSet",
 		      REG_DWORD,
-		      (PUCHAR)&FeatureSet,
+		      (PCHAR)&FeatureSet,
 		      sizeof(ULONG));
   if (Error != ERROR_SUCCESS)
     {
@@ -208,7 +208,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)Identifier,
+		      Identifier,
 		      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -218,7 +218,7 @@
   Error = RegSetValue(FpuInstKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)Identifier,
+		      Identifier,
 		      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -231,7 +231,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "VendorIdentifier",
 		      REG_SZ,
-		      (PUCHAR)VendorIdentifier,
+		      VendorIdentifier,
 		      strlen(VendorIdentifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -250,7 +250,7 @@
       Error = RegSetValue(CpuInstKey,
 			  "~MHz",
 			  REG_DWORD,
-			  (PUCHAR)&CpuSpeed,
+			  (PCHAR)&CpuSpeed,
 			  sizeof(ULONG));
       if (Error != ERROR_SUCCESS)
 	{
@@ -339,7 +339,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "FeatureSet",
 		      REG_DWORD,
-		      (PUCHAR)&FeatureSet,
+		      (PCHAR)&FeatureSet,
 		      sizeof(ULONG));
   if (Error != ERROR_SUCCESS)
     {
@@ -352,7 +352,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)Identifier,
+		      Identifier,
 		      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -362,7 +362,7 @@
   Error = RegSetValue(FpuInstKey,
 		      "Identifier",
 		      REG_SZ,
-		      (PUCHAR)Identifier,
+		      Identifier,
 		      strlen(Identifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -375,7 +375,7 @@
   Error = RegSetValue(CpuInstKey,
 		      "VendorIdentifier",
 		      REG_SZ,
-		      (PUCHAR)VendorIdentifier,
+		      VendorIdentifier,
 		      strlen(VendorIdentifier) + 1);
   if (Error != ERROR_SUCCESS)
     {
@@ -394,7 +394,7 @@
       Error = RegSetValue(CpuInstKey,
 			  "~MHz",
 			  REG_DWORD,
-			  (PUCHAR)&CpuSpeed,
+			  (PCHAR)&CpuSpeed,
 			  sizeof(ULONG));
       if (Error != ERROR_SUCCESS)
 	{

Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -178,7 +178,7 @@
       Error = RegSetValue(TableKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)"PCI Real-mode IRQ Routing Table",
+			  "PCI Real-mode IRQ Routing Table",
 			  32);
       if (Error != ERROR_SUCCESS)
 	{
@@ -216,7 +216,7 @@
       Error = RegSetValue(TableKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR) FullResourceDescriptor,
+			  (PCHAR) FullResourceDescriptor,
 			  Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)
@@ -272,7 +272,7 @@
       Error = RegSetValue(BiosKey,
 			  "Identifier",
 			  REG_SZ,
-			  (PUCHAR)"PCI BIOS",
+			  "PCI BIOS",
 			  9);
       if (Error != ERROR_SUCCESS)
 	{
@@ -301,7 +301,7 @@
       Error = RegSetValue(BiosKey,
 			  "Configuration Data",
 			  REG_FULL_RESOURCE_DESCRIPTOR,
-			  (PUCHAR) FullResourceDescriptor,
+			  (PCHAR) FullResourceDescriptor,
 			  Size);
       MmFreeMemory(FullResourceDescriptor);
       if (Error != ERROR_SUCCESS)

Copied: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386.h (from rev 14980, trunk/reactos/boot/freeldr/freeldr/arch/i386/i386.h)
Property changes on: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386.h ___________________________________________________________________ Name: svn:keywords   + Author Date Id Revision Name: svn:eol-style   + native
Modified: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c
--- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c	2005-05-05 19:11:20 UTC (rev 15016)
+++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/arch/i386/i386disk.c	2005-05-05 19:15:25 UTC (rev 15017)
@@ -19,6 +19,8 @@
 
 #include "freeldr.h"
 #include "debug.h"
+#include "i386.h"
+#include "fsrec.h"
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FUNCTIONS
@@ -166,4 +168,244 @@
 	return TRUE;
 }
 
-#endif // defined __i386__
+BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) 
+{
+	PARTITION_TABLE_ENTRY	PartitionTableEntry;
+	UCHAR			VolumeType;
+
+	DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition));
+
+	// Check and see if it is a floppy drive
+	// If so then just assume FAT12 file system type
+	if (DiskIsDriveRemovable(i386BootDrive))
+	{
+		DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
+
+		*DriveNumber = i386BootDrive;
+		*StartSector = 0;
+		*SectorCount = 2 * 80 * 18; /* FIXME hardcoded for 1.44 Mb */
+		*FsType = FS_FAT;
+		return TRUE;
+	}
+
+	// Check for ISO9660 file system type
+	if (i386BootDrive >= 0x80 && FsRecIsIso9660(i386BootDrive))
+	{
+		DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
+
+		*DriveNumber = i386BootDrive;
+		*StartSector = 0;
+		*SectorCount = 0;
+		*FsType = FS_ISO9660;
+		return TRUE;
+	}
+
+	// Get the requested partition entry
+	if (i386BootPartition == 0)
+	{
+		// Partition requested was zero which means the boot partition
+		if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
+		{
+			return FALSE;
+		}
+	}
+	else
+	{
+		// Get requested partition
+		if (! MachDiskGetPartitionEntry(i386BootDrive, i386BootPartition, &PartitionTableEntry))
+		{
+			return FALSE;
+		}
+	}
+
+	// Check for valid partition
+	if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
+	{
+		return FALSE;
+	}
+
+	// Try to recognize the file system
+	if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
+	{
+		return FALSE;
+	}
+
+	*DriveNumber = i386BootDrive;
+	*StartSector = PartitionTableEntry.SectorCountBeforePartition;
+	*SectorCount = PartitionTableEntry.PartitionSectorCount;
+
+	//switch (PartitionTableEntry.SystemIndicator)
+	switch (VolumeType)
+	{
+	case PARTITION_FAT_12:
+	case PARTITION_FAT_16:
+	case PARTITION_HUGE:
+	case PARTITION_XINT13:
+	case PARTITION_FAT32:
+	case PARTITION_FAT32_XINT13:
+		*FsType = FS_FAT;
+		return TRUE;
+	case PARTITION_EXT2:
+		*FsType = FS_EXT2;
+		return TRUE;
+	case PARTITION_NTFS:
+		*FsType = FS_NTFS;
+		return TRUE;
+	default:
[truncated at 1000 lines; 84535 more skipped]