ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2008
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
761 discussions
Start a n
N
ew thread
[ros-arm-bringup] 34668: - Don't re-map the MDL if it's already been built from non-paged pool. - Hackforce the partition type for disk ramdisks to be FAT32 for now.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 04:32:02 2008 New Revision: 34668 URL:
http://svn.reactos.org/svn/reactos?rev=34668&view=rev
Log: - Don't re-map the MDL if it's already been built from non-paged pool. - Hackforce the partition type for disk ramdisks to be FAT32 for now. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 04:32:02 2008 @@ -1109,7 +1109,7 @@ // Get the MDL and check if it's mapped // Mdl = Irp->MdlAddress; - if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) + if (Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | MDL_SOURCE_IS_NONPAGED_POOL)) { // // Use the mapped address @@ -1280,7 +1280,7 @@ DeviceExtension->Cylinders; PartitionInfo->HiddenSectors = DeviceExtension->HiddenSectors; PartitionInfo->PartitionNumber = 0; - PartitionInfo->PartitionType = *((PCHAR)BaseAddress + 450); + PartitionInfo->PartitionType = PARTITION_FAT32; //*((PCHAR)BaseAddress + 450); PartitionInfo->BootIndicator = (DeviceExtension->DiskType == RAMDISK_BOOT_DISK) ? TRUE: FALSE; PartitionInfo->RecognizedPartition = IsRecognizedPartition(PartitionInfo->
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34667: - We need to call MmMarkPageMapped for virtual mappings, except for those created thgouh MmCreateVirtualMappingForKernel (even though the other versions of the call can still do kernel mappings). - Refactored the virtual mapping function to support this. MmUnmapIoSpace now works properly.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 04:31:13 2008 New Revision: 34667 URL:
http://svn.reactos.org/svn/reactos?rev=34667&view=rev
Log: - We need to call MmMarkPageMapped for virtual mappings, except for those created thgouh MmCreateVirtualMappingForKernel (even though the other versions of the call can still do kernel mappings). - Refactored the virtual mapping function to support this. MmUnmapIoSpace now works properly. Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/stubs.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] Tue Jul 22 04:31:13 2008 @@ -480,10 +480,11 @@ NTSTATUS NTAPI -MmCreateVirtualMappingForKernel(IN PVOID Address, - IN ULONG Protection, - IN PPFN_NUMBER Pages, - IN ULONG PageCount) +MmCreateVirtualMappingInternal(IN PVOID Address, + IN ULONG Protection, + IN PPFN_NUMBER Pages, + IN ULONG PageCount, + IN BOOLEAN MarkAsMapped) { PMMPTE PointerPte, LastPte, PointerPde, LastPde; MMPTE TempPte, TempPde; @@ -560,6 +561,11 @@ while (PointerPte <= LastPte) { // + // Mark it as mapped + // + if (MarkAsMapped) MmMarkPageMapped(*Pages); + + // // Set the PFN // TempPte.u.Hard.L2.Small.BaseAddress = *Pages++; @@ -594,6 +600,24 @@ // UNIMPLEMENTED; return 0; +} + + +NTSTATUS +NTAPI +MmCreateVirtualMappingForKernel(IN PVOID Address, + IN ULONG Protection, + IN PPFN_NUMBER Pages, + IN ULONG PageCount) +{ + // + // Call the internal version + // + return MmCreateVirtualMappingInternal(Address, + Protection, + Pages, + PageCount, + FALSE); } NTSTATUS @@ -610,12 +634,13 @@ if (!(Process) || (Process == PsGetCurrentProcess())) { // - // Call the kernel version - // - return MmCreateVirtualMappingForKernel(Address, - Protection, - Pages, - PageCount); + // Call the internal version + // + return MmCreateVirtualMappingInternal(Address, + Protection, + Pages, + PageCount, + TRUE); } //
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34666: - Initialize BytesPerSector, SectorsPerTrack and NumberOfHeads to zero. - Calculate number of cylinders too now. - Save number of hidden sectors as well. - Implement support for IOCTL_DISK_GET_PARTITION_INFO (RamdiskGetPartitionInfo). - Implement support for IOCTL_DISK_GET_DRIVE_GEOMETRY (shared with IOCTL_CDROM_GET_GEOMETRY, IOCTL_STORAGE_GET_MEDIA_TYPES and IOCTL_DISK_GET_MEDIA_TYPES) - DiskLength should be a LARGE_INTEGER. - DiskOffset should be signed.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 03:52:18 2008 New Revision: 34666 URL:
http://svn.reactos.org/svn/reactos?rev=34666&view=rev
Log: - Initialize BytesPerSector, SectorsPerTrack and NumberOfHeads to zero. - Calculate number of cylinders too now. - Save number of hidden sectors as well. - Implement support for IOCTL_DISK_GET_PARTITION_INFO (RamdiskGetPartitionInfo). - Implement support for IOCTL_DISK_GET_DRIVE_GEOMETRY (shared with IOCTL_CDROM_GET_GEOMETRY, IOCTL_STORAGE_GET_MEDIA_TYPES and IOCTL_DISK_GET_MEDIA_TYPES) - DiskLength should be a LARGE_INTEGER. - DiskOffset should be signed. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c trunk/reactos/include/reactos/drivers/ntddrdsk.h Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 03:52:18 2008 @@ -82,19 +82,32 @@ typedef struct _RAMDISK_DRIVE_EXTENSION { + // + // Inherited base class + // RAMDISK_EXTENSION; + + // + // Data we get from the creator + // GUID DiskGuid; UNICODE_STRING GuidString; UNICODE_STRING SymbolicLinkName; ULONG DiskType; RAMDISK_CREATE_OPTIONS DiskOptions; - LONGLONG DiskLength; + LARGE_INTEGER DiskLength; LONG DiskOffset; WCHAR DriveLetter; + ULONG BasePage; + + // + // Data we get from the disk + // ULONG BytesPerSector; ULONG SectorsPerTrack; ULONG NumberOfHeads; - ULONG BasePage; + ULONG Cylinders; + ULONG HiddenSectors; } RAMDISK_DRIVE_EXTENSION, *PRAMDISK_DRIVE_EXTENSION; ULONG MaximumViewLength; @@ -415,7 +428,8 @@ BIOS_PARAMETER_BLOCK BiosBlock; ULONG BytesPerSector, SectorsPerTrack, Heads, BytesRead; PVOID BaseAddress; - LARGE_INTEGER CurrentOffset; + LARGE_INTEGER CurrentOffset, CylinderSize, DiskLength; + ULONG CylinderCount, SizeByCylinders; // // Check if we're a boot RAM disk @@ -623,6 +637,7 @@ // *NewDriveExtension = DriveExtension; DriveExtension->Type = RamdiskDrive; + DiskLength = Input->DiskLength; ExInitializeFastMutex(&DriveExtension->DiskListLock); IoInitializeRemoveLock(&DriveExtension->RemoveLock, TAG('R', 'a', 'm', 'd'), @@ -637,10 +652,13 @@ DriveExtension->AttachedDevice = RamdiskBusFdo; DriveExtension->DiskType = Input->DiskType; DriveExtension->DiskOptions = Input->Options; - DriveExtension->DiskLength = Input->DiskLength; + DriveExtension->DiskLength = DiskLength; DriveExtension->DiskOffset = Input->DiskOffset; DriveExtension->BasePage = Input->BasePage; - + DriveExtension->BytesPerSector = 0; + DriveExtension->SectorsPerTrack = 0; + DriveExtension->NumberOfHeads = 0; + // // Make sure we don't free it later // @@ -699,18 +717,7 @@ goto FailCreate; } } - - // - // Sanity check for debugging - // - DPRINT1("[RAMDISK] Loaded...\n" - "Bytes per Sector: %d\n" - "Sectors per Track: %d\n" - "Number of Heads: %d\n", - DriveExtension->BytesPerSector, - DriveExtension->SectorsPerTrack, - DriveExtension->NumberOfHeads); - + // // Check if the drive settings haven't been set yet // @@ -740,7 +747,37 @@ DriveExtension->NumberOfHeads = 16; } } - + + // + // Calculate the cylinder size + // + CylinderSize.QuadPart = DriveExtension->BytesPerSector * + DriveExtension->SectorsPerTrack * + DriveExtension->NumberOfHeads; + CylinderCount = DiskLength.QuadPart / CylinderSize.QuadPart; + SizeByCylinders = CylinderSize.QuadPart * CylinderCount; + DriveExtension->Cylinders = CylinderCount; + if ((DiskLength.HighPart > 0) || (SizeByCylinders < DiskLength.LowPart)) + { + // + // Align cylinder size up + // + DriveExtension->Cylinders++; + } + + // + // Sanity check for debugging + // + DPRINT1("[RAMDISK] Loaded...\n" + "Bytes per Sector: %d\n" + "Sectors per Track: %d\n" + "Number of Heads: %d\n" + "Number of Cylinders: %d\n", + DriveExtension->BytesPerSector, + DriveExtension->SectorsPerTrack, + DriveExtension->NumberOfHeads, + DriveExtension->Cylinders); + // // Acquire the disk lock // @@ -1191,6 +1228,84 @@ NTSTATUS NTAPI +RamdiskGetPartitionInfo(IN PIRP Irp, + IN PRAMDISK_DRIVE_EXTENSION DeviceExtension) +{ + NTSTATUS Status; + PPARTITION_INFORMATION PartitionInfo; + PVOID BaseAddress; + LARGE_INTEGER Zero = {{0}}; + ULONG Length; + PIO_STACK_LOCATION IoStackLocation; + + // + // Validate the length + // + IoStackLocation = IoGetCurrentIrpStackLocation(Irp); + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(PARTITION_INFORMATION)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + return Status; + } + + // + // Map the partition table + // + BaseAddress = RamdiskMapPages(DeviceExtension, Zero, PAGE_SIZE, &Length); + if (!BaseAddress) + { + // + // No memory + // + Status = STATUS_INSUFFICIENT_RESOURCES; + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; + return Status; + } + + // + // Fill out the information + // + PartitionInfo = Irp->AssociatedIrp.SystemBuffer; + PartitionInfo->StartingOffset.QuadPart = DeviceExtension->BytesPerSector; + PartitionInfo->PartitionLength.QuadPart = DeviceExtension->BytesPerSector * + DeviceExtension->SectorsPerTrack * + DeviceExtension->NumberOfHeads * + DeviceExtension->Cylinders; + PartitionInfo->HiddenSectors = DeviceExtension->HiddenSectors; + PartitionInfo->PartitionNumber = 0; + PartitionInfo->PartitionType = *((PCHAR)BaseAddress + 450); + PartitionInfo->BootIndicator = (DeviceExtension->DiskType == + RAMDISK_BOOT_DISK) ? TRUE: FALSE; + PartitionInfo->RecognizedPartition = IsRecognizedPartition(PartitionInfo-> + PartitionType); + PartitionInfo->RewritePartition = FALSE; + + DPRINT1("Partition length: %I64d\n", PartitionInfo->PartitionLength); + DPRINT1("Type: %lx. Recognized: %d\n", + PartitionInfo->PartitionType, PartitionInfo->RecognizedPartition); + + // + // Unmap the partition table + // + RamdiskUnmapPages(DeviceExtension, BaseAddress, Zero, Length); + + // + // Done + // + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = sizeof(PARTITION_INFORMATION); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI RamdiskOpenClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { @@ -1301,8 +1416,10 @@ NTSTATUS Status; PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp); PRAMDISK_BUS_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; + PRAMDISK_DRIVE_EXTENSION DriveExtension = (PVOID)DeviceExtension; ULONG Information; PCDROM_TOC Toc; + PDISK_GEOMETRY DiskGeometry; // // Grab the remove lock @@ -1377,8 +1494,35 @@ case IOCTL_DISK_GET_DRIVE_GEOMETRY: case IOCTL_CDROM_GET_DRIVE_GEOMETRY: - UNIMPLEMENTED; - while (TRUE); + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(DISK_GEOMETRY)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Fill it out + // + DiskGeometry = Irp->AssociatedIrp.SystemBuffer; + DiskGeometry->Cylinders.QuadPart = DriveExtension->Cylinders; + DiskGeometry->BytesPerSector = DriveExtension->BytesPerSector; + DiskGeometry->SectorsPerTrack = DriveExtension->SectorsPerTrack; + DiskGeometry->TracksPerCylinder = DriveExtension->NumberOfHeads; + DiskGeometry->MediaType = DriveExtension->DiskOptions.Fixed ? + FixedMedia : RemovableMedia; + + // + // We're done + // + Status = STATUS_SUCCESS; + Information = sizeof(DISK_GEOMETRY); break; // @@ -1427,7 +1571,6 @@ // // Validate the length // - DPRINT1("Output: %lx\n", IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength); if (IoStackLocation->Parameters.DeviceIoControl. OutputBufferLength < sizeof(CDROM_TOC)) { @@ -1447,7 +1590,6 @@ // // Fill it out // - DPRINT1("TOC: %d\n", RAMDISK_TOC_SIZE); Toc->Length[0] = 0; Toc->Length[1] = RAMDISK_TOC_SIZE - sizeof(Toc->Length); Toc->FirstTrack = 1; @@ -1471,76 +1613,109 @@ case IOCTL_DISK_GET_PARTITION_INFO: + // + // Validate the length + // + if (IoStackLocation->Parameters.DeviceIoControl. + OutputBufferLength < sizeof(PARTITION_INFORMATION)) + { + // + // Invalid length + // + Status = STATUS_BUFFER_TOO_SMALL; + break; + } + + // + // Check if we need to do this sync or async + // + if (DriveExtension->DiskType > RAMDISK_MEMORY_MAPPED_DISK) + { + // + // Call the helper function + // + Status = RamdiskGetPartitionInfo(Irp, DriveExtension); + } + else + { + // + // Do it asynchronously later + // + goto CallWorker; + } + + // + // We're done + // + Information = Irp->IoStatus.Information; + break; + + case IOCTL_DISK_GET_DRIVE_LAYOUT: + UNIMPLEMENTED; while (TRUE); break; - case IOCTL_DISK_GET_DRIVE_LAYOUT: + case IOCTL_DISK_GET_LENGTH_INFO: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_DISK_GET_LENGTH_INFO: + case IOCTL_DISK_IS_WRITABLE: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_DISK_IS_WRITABLE: + case IOCTL_SCSI_MINIPORT: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_SCSI_MINIPORT: + case IOCTL_STORAGE_QUERY_PROPERTY: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_STORAGE_QUERY_PROPERTY: + case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID: + case IOCTL_MOUNTDEV_QUERY_STABLE_GUID: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_MOUNTDEV_QUERY_STABLE_GUID: + case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: + case IOCTL_VOLUME_SET_GPT_ATTRIBUTES: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_VOLUME_SET_GPT_ATTRIBUTES: + case IOCTL_VOLUME_GET_GPT_ATTRIBUTES: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_VOLUME_GET_GPT_ATTRIBUTES: + case IOCTL_VOLUME_OFFLINE: UNIMPLEMENTED; while (TRUE); break; - case IOCTL_VOLUME_OFFLINE: - - UNIMPLEMENTED; - while (TRUE); - break; - default: // @@ -1559,6 +1734,7 @@ // // Queue the request to our worker thread // +CallWorker: Status = SendIrpToThread(DeviceObject, Irp); CompleteRequest: Modified: trunk/reactos/include/reactos/drivers/ntddrdsk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/drivers/nt…
============================================================================== --- trunk/reactos/include/reactos/drivers/ntddrdsk.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/drivers/ntddrdsk.h [iso-8859-1] Tue Jul 22 03:52:18 2008 @@ -66,8 +66,8 @@ GUID DiskGuid; ULONG DiskType; RAMDISK_CREATE_OPTIONS Options; - ULONGLONG DiskLength; - ULONG DiskOffset; + LARGE_INTEGER DiskLength; + LONG DiskOffset; union { struct
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34665: - We have to unpack the BIOS block before actually reading it. - Now we correctly read 512 bytes per sector instead of 0. - We are almost there!
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 02:12:05 2008 New Revision: 34665 URL:
http://svn.reactos.org/svn/reactos?rev=34665&view=rev
Log: - We have to unpack the BIOS block before actually reading it. - Now we correctly read 512 bytes per sector instead of 0. - We are almost there! Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 02:12:05 2008 @@ -412,6 +412,7 @@ WCHAR LocalBuffer[16]; UNICODE_STRING SymbolicLinkName, DriveString, GuidString, DeviceName; PPACKED_BOOT_SECTOR BootSector; + BIOS_PARAMETER_BLOCK BiosBlock; ULONG BytesPerSector, SectorsPerTrack, Heads, BytesRead; PVOID BaseAddress; LARGE_INTEGER CurrentOffset; @@ -668,9 +669,10 @@ // Get the data // BootSector = (PPACKED_BOOT_SECTOR)BaseAddress; - BytesPerSector = BootSector->PackedBpb.BytesPerSector[0]; - SectorsPerTrack = BootSector->PackedBpb.SectorsPerTrack[0]; - Heads = BootSector->PackedBpb.Heads[0]; + FatUnpackBios(&BiosBlock, &BootSector->PackedBpb); + BytesPerSector = BiosBlock.BytesPerSector; + SectorsPerTrack = BiosBlock.SectorsPerTrack; + Heads = BiosBlock.Heads; // // Save it
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34664: - Implement MmRawDeleteVirtualMapping. - RamdiskUnmapPages works now.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 02:11:33 2008 New Revision: 34664 URL:
http://svn.reactos.org/svn/reactos?rev=34664&view=rev
Log: - Implement MmRawDeleteVirtualMapping. - RamdiskUnmapPages works now. Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c Modified: trunk/reactos/ntoskrnl/mm/arm/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/arm/stubs.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/arm/stubs.c [iso-8859-1] Tue Jul 22 02:11:33 2008 @@ -226,10 +226,30 @@ NTAPI MmRawDeleteVirtualMapping(IN PVOID Address) { - // - // TODO - // - UNIMPLEMENTED; + PMMPTE PointerPte, PointerPde; + + // + // Get the PDE + // + PointerPde = MiGetPdeAddress(Address); + if (PointerPde->u.Hard.L1.Fault.Type == FaultPte) return; + + // + // Get the PTE + // + PointerPte = MiGetPteAddress(Address); + ASSERT(PointerPte->u.Hard.L2.Small.Type == SmallPte); + + // + // Destroy the PTE + // + PointerPte->u.Hard.AsUlong = 0; + ASSERT(PointerPte->u.Hard.L2.Fault.Type == FaultPte); + + // + // Flush the TLB + // + KiFlushSingleTb(TRUE, Address); } VOID
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34663: - Jesus, Fix yet another math bug in RamdiskMapPages (we were lucky not to hit it, that's all). - Implement RamdiskUnmapPages. - Need to implement MmRawDeleteVirtualMapping to make this last step work.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 01:54:25 2008 New Revision: 34663 URL:
http://svn.reactos.org/svn/reactos?rev=34663&view=rev
Log: - Jesus, Fix yet another math bug in RamdiskMapPages (we were lucky not to hit it, that's all). - Implement RamdiskUnmapPages. - Need to implement MmRawDeleteVirtualMapping to make this last step work. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:54:25 2008 @@ -315,7 +315,7 @@ // // Calculate pages spanned for the mapping // - ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(Offset.QuadPart, Length); + ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(ActualOffset.QuadPart, Length); DPRINT1("Length in pages: %d\n", ActualLength); // @@ -344,16 +344,57 @@ return MappedBase; } -PVOID +VOID NTAPI RamdiskUnmapPages(IN PRAMDISK_DRIVE_EXTENSION DeviceExtension, IN PVOID BaseAddress, IN LARGE_INTEGER Offset, IN ULONG Length) { - UNIMPLEMENTED; - while (TRUE); - return NULL; + LARGE_INTEGER ActualOffset; + SIZE_T ActualLength; + ULONG PageOffset; + + // + // We only support boot disks for now + // + ASSERT(DeviceExtension->DiskType == RAMDISK_BOOT_DISK); + + // + // Calculate the actual offset in the drive + // + ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; + DPRINT1("Disk offset is: %d and Offset is: %I64d. Total: %I64d\n", + DeviceExtension->DiskOffset, Offset, ActualOffset); + + // + // Calculate pages spanned for the mapping + // + ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(ActualOffset.QuadPart, Length); + DPRINT1("Length in pages: %d\n", ActualLength); + + // + // And convert this back to bytes + // + ActualLength <<= PAGE_SHIFT; + DPRINT1("Length in bytes: %d\n", ActualLength); + + // + // Get the offset within the page + // + PageOffset = BYTE_OFFSET(ActualOffset.QuadPart); + DPRINT1("Page offset: %lx\n", PageOffset); + + // + // Calculate actual base address where we mapped this + // + BaseAddress = (PVOID)((ULONG_PTR)BaseAddress - PageOffset); + DPRINT1("Unmapping at: %p\n", BaseAddress); + + // + // Unmap the I/O space we got from the loader + // + MmUnmapIoSpace(BaseAddress, ActualLength); } NTSTATUS
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34662: - Epic Fail? Fix another math bug...it actually works now! - Fix another wrong debug print.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 01:46:09 2008 New Revision: 34662 URL:
http://svn.reactos.org/svn/reactos?rev=34662&view=rev
Log: - Epic Fail? Fix another math bug...it actually works now! - Fix another wrong debug print. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:46:09 2008 @@ -296,8 +296,8 @@ // // Convert to pages // - ActualPages.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); - DPRINT1("Offset in pages is: %d\n", ActualOffset); + ActualPages.QuadPart = ActualOffset.QuadPart >> PAGE_SHIFT; + DPRINT1("Offset in pages is: %I64x\n", ActualPages); // // Now add the base page
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34661: - Double fail: Fix a math bug, calculate the actual offset in the mapping and return it, and don't forget to return the total length read too.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 01:40:00 2008 New Revision: 34661 URL:
http://svn.reactos.org/svn/reactos?rev=34661&view=rev
Log: - Double fail: Fix a math bug, calculate the actual offset in the mapping and return it, and don't forget to return the total length read too. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:40:00 2008 @@ -276,6 +276,7 @@ { PHYSICAL_ADDRESS PhysicalAddress; PVOID MappedBase; + ULONG PageOffset; SIZE_T ActualLength; LARGE_INTEGER ActualOffset; LARGE_INTEGER ActualPages; @@ -295,13 +296,13 @@ // // Convert to pages // - ActualOffset.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); + ActualPages.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); DPRINT1("Offset in pages is: %d\n", ActualOffset); // // Now add the base page // - ActualPages.QuadPart = DeviceExtension->BasePage + ActualOffset.QuadPart; + ActualPages.QuadPart = DeviceExtension->BasePage + ActualPages.QuadPart; DPRINT1("Ramdisk mapped at page: %d, actual page is: %I64d\n", DeviceExtension->BasePage, ActualPages); @@ -324,9 +325,21 @@ DPRINT1("Length in bytes: %d\n", ActualLength); // + // Get the offset within the page + // + PageOffset = BYTE_OFFSET(ActualOffset.QuadPart); + DPRINT1("Page offset: %lx\n", PageOffset); + + // // Map the I/O Space from the loader // MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); + + // + // Return actual offset within the page as well as the length + // + if (MappedBase) MappedBase = (PVOID)((ULONG_PTR)MappedBase + PageOffset); + *OutputLength = Length; DPRINT1("Mapped at: %p\n", MappedBase); return MappedBase; }
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34660: - Fail: was using the wrong structure (the boot sector is a BOOT_SECTOR which contains the BIOS Parameter Block, not a BPB directly). - Fix wrong debug print too.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 01:31:31 2008 New Revision: 34660 URL:
http://svn.reactos.org/svn/reactos?rev=34660&view=rev
Log: - Fail: was using the wrong structure (the boot sector is a BOOT_SECTOR which contains the BIOS Parameter Block, not a BPB directly). - Fix wrong debug print too. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:31:31 2008 @@ -289,7 +289,7 @@ // Calculate the actual offset in the drive // ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; - DPRINT1("Disk offset is: %I64d and Offset is: %I64d. Total: %I64d\n", + DPRINT1("Disk offset is: %d and Offset is: %I64d. Total: %I64d\n", DeviceExtension->DiskOffset, Offset, ActualOffset); // @@ -328,10 +328,7 @@ // MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); DPRINT1("Mapped at: %p\n", MappedBase); - - UNIMPLEMENTED; - while (TRUE); - return NULL; + return MappedBase; } PVOID @@ -360,7 +357,7 @@ PVOID Buffer; WCHAR LocalBuffer[16]; UNICODE_STRING SymbolicLinkName, DriveString, GuidString, DeviceName; - PPACKED_BIOS_PARAMETER_BLOCK Parameters; + PPACKED_BOOT_SECTOR BootSector; ULONG BytesPerSector, SectorsPerTrack, Heads, BytesRead; PVOID BaseAddress; LARGE_INTEGER CurrentOffset; @@ -616,10 +613,10 @@ // // Get the data // - Parameters = (PPACKED_BIOS_PARAMETER_BLOCK)BaseAddress; - BytesPerSector = Parameters->BytesPerSector[0]; - SectorsPerTrack = Parameters->SectorsPerTrack[0]; - Heads = Parameters->Heads[0]; + BootSector = (PPACKED_BOOT_SECTOR)BaseAddress; + BytesPerSector = BootSector->PackedBpb.BytesPerSector[0]; + SectorsPerTrack = BootSector->PackedBpb.SectorsPerTrack[0]; + Heads = BootSector->PackedBpb.Heads[0]; // // Save it @@ -648,6 +645,17 @@ } // + // Sanity check for debugging + // + DPRINT1("[RAMDISK] Loaded...\n" + "Bytes per Sector: %d\n" + "Sectors per Track: %d\n" + "Number of Heads: %d\n", + DriveExtension->BytesPerSector, + DriveExtension->SectorsPerTrack, + DriveExtension->NumberOfHeads); + + // // Check if the drive settings haven't been set yet // if ((DriveExtension->BytesPerSector == 0) || @@ -676,7 +684,7 @@ DriveExtension->NumberOfHeads = 16; } } - + // // Acquire the disk lock //
16 years, 5 months
1
0
0
0
[ros-arm-bringup] 34659: - Save base page where loader mapped the ramdisk. - Try to implement RamdiskMapPages for boot disks as it seems we're calling them now... - The math works and the I/O mapping too, but I'm not sure we're reading correct data, so still left this unimplemented for now.
by ros-arm-bringup@svn.reactos.org
Author: ros-arm-bringup Date: Tue Jul 22 01:21:11 2008 New Revision: 34659 URL:
http://svn.reactos.org/svn/reactos?rev=34659&view=rev
Log: - Save base page where loader mapped the ramdisk. - Try to implement RamdiskMapPages for boot disks as it seems we're calling them now... - The math works and the I/O mapping too, but I'm not sure we're reading correct data, so still left this unimplemented for now. Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c Modified: trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/class/ramd…
============================================================================== --- trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/class/ramdisk/ramdisk.c [iso-8859-1] Tue Jul 22 01:21:11 2008 @@ -94,6 +94,7 @@ ULONG BytesPerSector; ULONG SectorsPerTrack; ULONG NumberOfHeads; + ULONG BasePage; } RAMDISK_DRIVE_EXTENSION, *PRAMDISK_DRIVE_EXTENSION; ULONG MaximumViewLength; @@ -273,7 +274,61 @@ IN ULONG Length, OUT PULONG OutputLength) { - DPRINT1("Mapping %lx bytes at %I64x\n", Length, Offset.QuadPart); + PHYSICAL_ADDRESS PhysicalAddress; + PVOID MappedBase; + SIZE_T ActualLength; + LARGE_INTEGER ActualOffset; + LARGE_INTEGER ActualPages; + + // + // We only support boot disks for now + // + ASSERT(DeviceExtension->DiskType == RAMDISK_BOOT_DISK); + + // + // Calculate the actual offset in the drive + // + ActualOffset.QuadPart = DeviceExtension->DiskOffset + Offset.QuadPart; + DPRINT1("Disk offset is: %I64d and Offset is: %I64d. Total: %I64d\n", + DeviceExtension->DiskOffset, Offset, ActualOffset); + + // + // Convert to pages + // + ActualOffset.QuadPart = BYTES_TO_PAGES(ActualOffset.QuadPart); + DPRINT1("Offset in pages is: %d\n", ActualOffset); + + // + // Now add the base page + // + ActualPages.QuadPart = DeviceExtension->BasePage + ActualOffset.QuadPart; + DPRINT1("Ramdisk mapped at page: %d, actual page is: %I64d\n", + DeviceExtension->BasePage, ActualPages); + + // + // Calculate final amount of bytes + // + PhysicalAddress.QuadPart = ActualPages.QuadPart << PAGE_SHIFT; + DPRINT1("Physical Address is: %I64x\n", PhysicalAddress); + + // + // Calculate pages spanned for the mapping + // + ActualLength = ADDRESS_AND_SIZE_TO_SPAN_PAGES(Offset.QuadPart, Length); + DPRINT1("Length in pages: %d\n", ActualLength); + + // + // And convert this back to bytes + // + ActualLength <<= PAGE_SHIFT; + DPRINT1("Length in bytes: %d\n", ActualLength); + + // + // Map the I/O Space from the loader + // + MappedBase = MmMapIoSpace(PhysicalAddress, ActualLength, MmCached); + DPRINT1("Mapped at: %p\n", MappedBase); + UNIMPLEMENTED; while (TRUE); return NULL; @@ -532,6 +587,7 @@ DriveExtension->DiskOptions = Input->Options; DriveExtension->DiskLength = Input->DiskLength; DriveExtension->DiskOffset = Input->DiskOffset; + DriveExtension->BasePage = Input->BasePage; // // Make sure we don't free it later
16 years, 5 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
77
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Results per page:
10
25
50
100
200