[FREELDR]

- Move read-only data into data section (allows to boot with GRUB again).
- Discard .drectve sections.
- Silence "set but not used" warnings.

svn path=/trunk/; revision=52557
This commit is contained in:
Dmitry Gorbachev 2011-07-07 19:19:44 +00:00
parent e462a7a6d3
commit 2a66163177
8 changed files with 17 additions and 19 deletions

View file

@ -34,7 +34,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
{ {
PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
EXTENDED_GEOMETRY ExtGeometry; //EXTENDED_GEOMETRY ExtGeometry;
GEOMETRY Geometry; GEOMETRY Geometry;
ULONG Size; ULONG Size;
@ -69,7 +69,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST)); DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
/* Get the disk geometry */ /* Get the disk geometry */
ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY); //ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
if(MachDiskGetDriveGeometry(DriveNumber, &Geometry)) if(MachDiskGetDriveGeometry(DriveNumber, &Geometry))
{ {

View file

@ -32,17 +32,18 @@ SECTIONS
*(.data) *(.data)
*(.data2) *(.data2)
*(SORT(.data$*)) *(SORT(.data$*))
*(.rdata)
*(SORT(.rdata$*))
*(.eh_frame)
__data_end__ = . ; __data_end__ = . ;
__bss_start__ = . ; __bss_start__ = . ;
*(.bss) *(.bss)
*(COMMON) *(COMMON)
__bss_end__ = . ; __bss_end__ = . ;
} }
.rdata BLOCK(__section_alignment__) : /DISCARD/ :
{ {
*(.rdata) *(.drectve)
*(SORT(.rdata$*))
*(.eh_frame)
} }
.stab BLOCK(__section_alignment__) (NOLOAD) : .stab BLOCK(__section_alignment__) (NOLOAD) :
{ {

View file

@ -1196,12 +1196,12 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information)
LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
{ {
PEXT2_FILE_INFO FileHandle; PEXT2_FILE_INFO FileHandle;
ULONG DeviceId; //ULONG DeviceId;
if (OpenMode != OpenReadOnly) if (OpenMode != OpenReadOnly)
return EACCES; return EACCES;
DeviceId = FsGetDeviceId(*FileId); //DeviceId = FsGetDeviceId(*FileId);
DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path); DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path);

View file

@ -536,7 +536,7 @@ static BOOLEAN NtfsCompareFileName(PCHAR FileName, PNTFS_INDEX_ENTRY IndexEntry)
static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PCHAR FileName, ULONGLONG *OutMFTIndex) static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PCHAR FileName, ULONGLONG *OutMFTIndex)
{ {
PNTFS_MFT_RECORD MftRecord; PNTFS_MFT_RECORD MftRecord;
ULONG Magic; //ULONG Magic;
PNTFS_ATTR_CONTEXT IndexRootCtx; PNTFS_ATTR_CONTEXT IndexRootCtx;
PNTFS_ATTR_CONTEXT IndexBitmapCtx; PNTFS_ATTR_CONTEXT IndexBitmapCtx;
PNTFS_ATTR_CONTEXT IndexAllocationCtx; PNTFS_ATTR_CONTEXT IndexAllocationCtx;
@ -557,7 +557,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
if (NtfsReadMftRecord(Volume, MFTIndex, MftRecord)) if (NtfsReadMftRecord(Volume, MFTIndex, MftRecord))
{ {
Magic = MftRecord->Magic; //Magic = MftRecord->Magic;
IndexRootCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ROOT, L"$I30"); IndexRootCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ROOT, L"$I30");
if (IndexRootCtx == NULL) if (IndexRootCtx == NULL)

View file

@ -180,12 +180,11 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset) ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset)
{ {
ULONG Idx;
ULONG LineCharCount = 0; ULONG LineCharCount = 0;
// Loop through counting chars until we hit the end of the // Loop through counting chars until we hit the end of the
// file or we encounter a new line char // file or we encounter a new line char
for (Idx=0; (CurrentOffset < IniFileSize); CurrentOffset++) for (; (CurrentOffset < IniFileSize); CurrentOffset++)
{ {
// Increment the line character count // Increment the line character count
LineCharCount++; LineCharCount++;
@ -193,7 +192,6 @@ ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffs
// Check for new line char // Check for new line char
if (IniFileData[CurrentOffset] == '\n') if (IniFileData[CurrentOffset] == '\n')
{ {
CurrentOffset++;
break; break;
} }
} }

View file

@ -225,14 +225,13 @@ BOOLEAN UiInitialize(BOOLEAN ShowGui)
BOOLEAN SetupUiInitialize(VOID) BOOLEAN SetupUiInitialize(VOID)
{ {
VIDEODISPLAYMODE UiDisplayMode;
CHAR DisplayModeText[260]; CHAR DisplayModeText[260];
ULONG Depth, Length; ULONG Depth, Length;
DisplayModeText[0] = '\0'; DisplayModeText[0] = '\0';
UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoSetDisplayMode(DisplayModeText, TRUE);
MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth);
UiVtbl = TuiVtbl; UiVtbl = TuiVtbl;

View file

@ -41,7 +41,7 @@ void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG *TssBasePage) ULONG *TssBasePage)
{ {
ULONG TssSize; ULONG TssSize;
ULONG TssPages; //ULONG TssPages;
ULONG_PTR Pcr = 0; ULONG_PTR Pcr = 0;
ULONG_PTR Tss = 0; ULONG_PTR Tss = 0;
ULONG BlockSize, NumPages; ULONG BlockSize, NumPages;
@ -61,7 +61,7 @@ void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Allocate TSS */ /* Allocate TSS */
TssSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1); TssSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1);
TssPages = TssSize / MM_PAGE_SIZE; //TssPages = TssSize / MM_PAGE_SIZE;
Tss = (ULONG_PTR)MmAllocateMemoryWithType(TssSize, LoaderMemoryData); Tss = (ULONG_PTR)MmAllocateMemoryWithType(TssSize, LoaderMemoryData);

View file

@ -224,7 +224,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG LastPageIndex, LastPageType, MemoryMapStartPage; ULONG LastPageIndex, LastPageType, MemoryMapStartPage;
PPAGE_LOOKUP_TABLE_ITEM MemoryMap; PPAGE_LOOKUP_TABLE_ITEM MemoryMap;
ULONG NoEntries; ULONG NoEntries;
PKTSS Tss; //PKTSS Tss;
BOOLEAN Status; BOOLEAN Status;
// //
@ -353,7 +353,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */ /* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */
WinLdrMapSpecialPages(PcrBasePage); WinLdrMapSpecialPages(PcrBasePage);
Tss = (PKTSS)(KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT)); //Tss = (PKTSS)(KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT));
// Unmap what is not needed from kernel page table // Unmap what is not needed from kernel page table
MempDisablePages(); MempDisablePages();