Author: fireball
Date: Tue Dec 5 00:36:54 2006
New Revision: 25066
URL: http://svn.reactos.org/svn/reactos?rev=25066&view=rev
Log:
Create a place for work on creating a bootloader capable of booting Windows NT (from 4.0 up to 5.2).
Base is FreeLdr from trunk r25063.
Added:
branches/winldr/
- copied from r25065, trunk/reactos/boot/freeldr/freeldr/
Author: mist
Date: Mon Dec 4 18:33:06 2006
New Revision: 25063
URL: http://svn.reactos.org/svn/reactos?rev=25063&view=rev
Log:
ReactOS Intel Mac compatibility commits, part 2/2
== LBA Functionality BIOS Bug ==
When the BIOS is asked whether it supports INT 13 extensions, it will answer yes if the device is a hard disk, but it will pretend that even the function to ask about this functionality is unsupported if asked about a CD drive. This is similar to what is documented in the code already: Some BIOSes return "doesn't support INT 13 extensions" for CDs.
Code has been added to use INT 13 extensions (and therefore LBA read as opposed to CHS) even if the BIOS claims this is unsupported, if the device is a CD-ROM. The check for the drive type is done by comparing with 0x90: If the device number is 0x90 or above, it's a CD drive. (On Insyde's BIOS, it's 0x90, on most others, it's 0x9F).
(Ironically, Insyde's BIOS cannot even do CHS on CDs, so if the bootloader correctly asks for LBA support, it will get a "no" and will fail when trying to do CHS: When querying the max. CHS values, the BIOS returns 0 sectors per track, which will make conversions from LBA to CHS impossible.)
== LBA Read BIOS Bug ==
When trying to read from CD using the LBA function INT 13/42, the BIOS function will return as it is supposed to, with CF and AH cleared, but with an unchanged buffer. This is because freeldr passes a "disk address packets" that structure contains an extra 64 bit value at the end and is therefore 24 bytes long instead of 16. This is perfectly fine, and a BIOS should ignore any extra data in the structure, but Insyde's BIOS, which doesn't support the extra field (and thus the EDD-3.0 standard) just ignores the complete task and returns in this case.
The extra field has been removed from the structure in freeldr, as it is not used anyway. The structure is now 16 bytes long.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c Mon Dec 4 18:33:06 2006
@@ -30,8 +30,10 @@
USHORT TransferBufferOffset; // 04h - Transfer buffer offset (seg:off)
USHORT TransferBufferSegment; // Transfer buffer segment (seg:off)
ULONGLONG LBAStartBlock; // 08h - Starting absolute block number
- ULONGLONG TransferBuffer64; // 10h - (EDD-3.0, optional) 64-bit flat address of transfer buffer
+ //ULONGLONG TransferBuffer64; // 10h - (EDD-3.0, optional) 64-bit flat address of transfer buffer
// used if DWORD at 04h is FFFFh:FFFFh
+ // Commented since some earlier BIOSes refuse to work with
+ // such extended structure
} PACKED I386_DISK_ADDRESS_PACKET, *PI386_DISK_ADDRESS_PACKET;
/////////////////////////////////////////////////////////////////////////////////////////////
@@ -84,7 +86,6 @@
Packet->TransferBufferOffset = ((ULONG)Buffer) & 0x0F;
Packet->TransferBufferSegment = ((ULONG)Buffer) >> 4;
Packet->LBAStartBlock = SectorNumber;
- Packet->TransferBuffer64 = 0;
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
// Return:
@@ -274,6 +275,18 @@
{
DbgPrint((DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber));
return LastSupported;
+ }
+
+ // Some BIOSes report that extended disk access functions are not supported
+ // when booting from a CD (e.g. Phoenix BIOS v6.00PG and Insyde BIOS shipping
+ // with Intel Macs). Therefore we just return TRUE if we're booting from a CD -
+ // we can assume that all El Torito capable BIOSes support INT 13 extensions.
+ // We simply detect whether we're booting from CD by checking whether the drive
+ // number is >= 0x90. It's 0x90 on the Insyde BIOS, and 0x9F on most other BIOSes.
+ if (DriveNumber >= 0x90)
+ {
+ LastSupported = TRUE;
+ return TRUE;
}
LastDriveNumber = DriveNumber;
@@ -323,27 +336,13 @@
return FALSE;
}
- // Note:
- // The original check is too strict because some BIOSes report that
- // extended disk access functions are not suported when booting
- // from a CD (e.g. Phoenix BIOS v6.00PG). Argh!
-#if 0
if (!(RegsOut.w.cx & 0x0001))
{
// CX = API subset support bitmap
// Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported
+ printf("Suspicious API subset support bitmap 0x%x on device 0x%lx\n", RegsOut.w.cx, DriveNumber);
LastSupported = FALSE;
return FALSE;
- }
-#endif
-
- // Use this relaxed check instead (most BIOSes seem to use 0x9f as CD-Rom)
- if (RegsOut.w.cx == 0x0000 && DriveNumber != 0x9f)
- {
- // CX = API subset support bitmap
- printf("Suspicious API subset support bitmap 0x%x on device 0x%lx\n", RegsOut.w.cx, DriveNumber);
- LastSupported = FALSE;
- return LastSupported;
}
LastSupported = TRUE;
Author: mist
Date: Mon Dec 4 18:00:11 2006
New Revision: 25062
URL: http://svn.reactos.org/svn/reactos?rev=25062&view=rev
Log:
ReactOS Intel Mac compatibility commits, part 1/2, by Michael Steil.
== A20 Gate and the Keyboard Controller ==
In order to turn on the A20 gate, the keyboard controller has to be emptied. This is done in freeldr by reading bytes until the keyboard controller signals it's empty. Intel Macs don't have PS/2 keyboard controller and the status register always reads back 0xFF, so the "there is data" bit will never be cleared. (The same problem has been in GRUB as well as in Darwin's BIOS loader.)
Added code that doesn't bother to clear the keyboard buffer if the status port reads back 0xFF.
== Serial Port BIOS Bug ==
Insyde's BIOS reports that there is a COM1 serial port at 0x3F8 (as stored in 0040:0000 in memory), but there is none in Intel Macs, so freeldr spins infinitely while trying to empty the serial port's buffer.
Added code that makes sure the loop only gets executed up to 200 times
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S
trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/arch.S Mon Dec 4 18:00:11 2006
@@ -219,8 +219,11 @@
empty_8042:
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
inb $0x64,%al
+ cmp $0xff, %al // legacy-free machine without keyboard
+ jz empty_8042_ret // controllers on Intel Macs read back 0xFF
testb $0x02,%al
jnz empty_8042
+empty_8042_ret:
ret
/*
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c Mon Dec 4 18:00:11 2006
@@ -987,7 +987,7 @@
{
CHAR Buffer[4];
ULONG i;
- ULONG TimeOut = 200;
+ ULONG TimeOut;
UCHAR LineControl;
/* Shutdown mouse or something like that */
@@ -995,9 +995,19 @@
WRITE_PORT_UCHAR((PUCHAR)Port + 4, (LineControl & ~0x02) | 0x01);
StallExecutionProcessor(100000);
- /* Clear buffer */
+ /*
+ * Clear buffer
+ * Maybe there is no serial port although BIOS reported one (this
+ * is the case on Apple hardware), or the serial port is misbehaving,
+ * therefore we must give up after some time.
+ */
+ TimeOut = 200;
while (READ_PORT_UCHAR((PUCHAR)Port + 5) & 0x01)
- READ_PORT_UCHAR((PUCHAR)Port);
+ {
+ if (--TimeOut == 0)
+ return MOUSE_TYPE_NONE;
+ READ_PORT_UCHAR((PUCHAR)Port);
+ }
/*
* Send modem control with 'Data Terminal Ready', 'Request To Send' and
@@ -1009,6 +1019,7 @@
StallExecutionProcessor(10000);
/* Read first four bytes, which contains Microsoft Mouse signs */
+ TimeOut = 200;
for (i = 0; i < 4; i++)
{
while (((READ_PORT_UCHAR((PUCHAR)Port + 5) & 1) == 0) && (TimeOut > 0))
Author: janderwald
Date: Mon Dec 4 01:43:22 2006
New Revision: 25058
URL: http://svn.reactos.org/svn/reactos?rev=25058&view=rev
Log:
-fix compiling with msvc
Modified:
trunk/reactos/base/applications/network/route/route.c
Modified: trunk/reactos/base/applications/network/route/route.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/route/route.c (original)
+++ trunk/reactos/base/applications/network/route/route.c Mon Dec 4 01:43:22 2006
@@ -12,9 +12,9 @@
*/
#include <stdio.h>
+#include <winsock2.h>
#include <windows.h>
#include <iphlpapi.h>
-#include <winsock2.h>
#include <tchar.h>
#define IPBUF 17
@@ -23,13 +23,13 @@
static int Usage()
{
_ftprintf( stderr,
- _T("route usage:\n"
- "route print\n"
- " prints the route table\n"
- "route add <target> [mask <mask>] <gw> [metric <m>]\n"
- " adds a route\n"
- "route delete <target> <gw>\n"
- " deletes a route\n") );
+ _T("route usage:\n")
+ _T("route print\n")
+ _T(" prints the route table\n")
+ _T("route add <target> [mask <mask>] <gw> [metric <m>]\n")
+ _T(" adds a route\n")
+ _T("route delete <target> <gw>\n")
+ _T(" deletes a route\n") );
return 1;
}
@@ -87,11 +87,10 @@
/* FIXME - sort by the index! */
while (pAdapterInfo)
{
- _tprintf(_T("0x%lu ........................... "
-#ifdef UNICODE
- "%hs\n"),
-#else
- "%s\n"),
+#ifdef UNICODE
+ _tprintf(_T("0x%lu ........................... %hs\n"),
+#else
+ _tprintf(_T("0x%lu ........................... %s\n"),
#endif
pAdapterInfo->Index, pAdapterInfo->Description);
pAdapterInfo = pAdapterInfo->Next;
@@ -212,13 +211,13 @@
if( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) )
{
_ftprintf( stderr,
- _T("route add usage:\n"
- "route add <target> [mask <mask>] <gw> [metric <m>]\n"
- " Adds a route to the IP route table.\n"
- " <target> is the network or host to add a route to.\n"
- " <mask> is the netmask to use (autodetected if unspecified)\n"
- " <gw> is the gateway to use to access the network\n"
- " <m> is the metric to use (lower is preferred)\n") );
+ _T("route add usage:\n")
+ _T("route add <target> [mask <mask>] <gw> [metric <m>]\n")
+ _T(" Adds a route to the IP route table.\n")
+ _T(" <target> is the network or host to add a route to.\n")
+ _T(" <mask> is the netmask to use (autodetected if unspecified)\n")
+ _T(" <gw> is the gateway to use to access the network\n")
+ _T(" <m> is the metric to use (lower is preferred)\n") );
return 1;
}
@@ -237,11 +236,11 @@
if( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) )
{
_ftprintf( stderr,
- _T("route delete usage:\n"
- "route delete <target> <gw>\n"
- " Removes a route from the IP route table.\n"
- " <target> is the network or host to add a route to.\n"
- " <gw> is the gateway to remove the route from.\n") );
+ _T("route delete usage:\n")
+ _T("route delete <target> <gw>\n")
+ _T(" Removes a route from the IP route table.\n")
+ _T(" <target> is the network or host to add a route to.\n")
+ _T(" <gw> is the gateway to remove the route from.\n") );
return 1;
}