Strip everything from ntoskrnl

svn path=/trunk/; revision=1746
This commit is contained in:
David Welch 2001-03-29 17:24:43 +00:00
parent 877f965575
commit fbb680dffd
5 changed files with 114 additions and 31 deletions

View file

@ -323,12 +323,12 @@ entry:
and eax, 0xffff ; clear carry and eax, 0xffff ; clear carry
shl eax,8 shl eax,8
mov [_multiboot_mem_upper],eax mov [_multiboot_mem_upper],eax
;; xor eax,eax xor eax,eax
;; mov al, 0x30 mov al, 0x30
;; out 0x70, al out 0x70, al
;; in al, 0x71 in al, 0x71
;; and eax, 0xffff ; clear carry and eax, 0xffff ; clear carry
;; add [_multiboot_mem_lower],eax add [_multiboot_mem_lower],eax
.done_mem: .done_mem:
pop ebx pop ebx

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.26 2001/03/25 18:56:12 dwelch Exp $ # $Id: Makefile,v 1.27 2001/03/29 17:24:43 dwelch Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -27,7 +27,8 @@ include $(PATH_TO_TOP)/rules.mak
all: $(EXE_PREFIX)depends$(EXE_POSTFIX) \ all: $(EXE_PREFIX)depends$(EXE_POSTFIX) \
$(OBJECTS_PATH) \ $(OBJECTS_PATH) \
$(TARGETNAME).nostrip.exe \ $(TARGETNAME).nostrip.exe \
$(TARGETNAME).exe $(TARGETNAME).exe \
$(TARGETNAME).sym
$(EXE_PREFIX)depends$(EXE_POSTFIX): depends.c $(EXE_PREFIX)depends$(EXE_POSTFIX): depends.c
$(HOST_CC) -o depends$(EXE_POSTFIX) depends.c $(HOST_CC) -o depends$(EXE_POSTFIX) depends.c
@ -500,9 +501,6 @@ $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA)
- $(RM) temp.exp - $(RM) temp.exp
$(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
$(STRIP) \
--strip-debug \
$(TARGETNAME).o
$(CC) \ $(CC) \
-Wl,-T,ntoskrnl.lnk \ -Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \ -nostartfiles -nostdlib \
@ -523,7 +521,7 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
--kill-at --kill-at
- $(RM) base.tmp - $(RM) base.tmp
$(CC) \ $(CC) \
-Wl,-T,ntoskrnl.lnk \ -Wl,-T,ntoskrnl.lnk -Wl,-s\
-nostartfiles -nostdlib \ -nostartfiles -nostdlib \
-mdll \ -mdll \
-o $(TARGETNAME).exe \ -o $(TARGETNAME).exe \
@ -534,8 +532,9 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
-Wl,temp.exp \ -Wl,temp.exp \
$(TARGETNAME).o -lgcc $(TARGETNAME).o -lgcc
- $(RM) temp.exp - $(RM) temp.exp
$(NM) --numeric-sort $(TARGETNAME).exe > $(TARGETNAME).sym
$(TARGETNAME).sym: $(TARGETNAME).nostrip.exe
$(NM) --numeric-sort $(TARGETNAME).nostrip.exe > $(TARGETNAME).sym
$(TARGETNAME).o: $(OBJECTS) $(TARGETNAME).o: $(OBJECTS)
$(LD) \ $(LD) \

View file

@ -24,7 +24,7 @@
use of profiling together with nested functions use of profiling together with nested functions
- the ELF `fixup' function uses GCC's regparm feature - the ELF `fixup' function uses GCC's regparm feature
- some (future) systems might want to pass parameters in registers. */ - some (future) systems might want to pass parameters in registers. */
/* dwelch: Alerted for ReactOS to output the files to port 0xe9 for processing /* dwelch: Altered for ReactOS to output the files to port 0xe9 for processing
by bochs. */ by bochs. */

View file

@ -65,9 +65,14 @@ _multiboot_entry:
movl %cr0, %edx movl %cr0, %edx
orl $0x80000000, %edx orl $0x80000000, %edx
movl %edx, %cr0 movl %edx, %cr0
movl $l2, %edx
/*
* Do an absolute jump because we now want to execute at 0xc0000000
*/
movl $.l2, %edx
jmp *%edx jmp *%edx
l2: .l2:
/* /*
* Load the GDTR and IDTR with new tables located above * Load the GDTR and IDTR with new tables located above
* 0xc0000000 * 0xc0000000

View file

@ -1,6 +1,23 @@
/* $Id: section.c,v 1.52 2001/03/25 02:34:28 dwelch Exp $ /*
* ReactOS kernel
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: section.c,v 1.53 2001/03/29 17:24:43 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c * FILE: ntoskrnl/mm/section.c
* PURPOSE: Implements section objects * PURPOSE: Implements section objects
@ -36,6 +53,9 @@ static GENERIC_MAPPING MmpSectionMapping = {
#define TAG_MM_SECTION_SEGMENT TAG('M', 'M', 'S', 'S') #define TAG_MM_SECTION_SEGMENT TAG('M', 'M', 'S', 'S')
#define TAG_SECTION_PAGE_TABLE TAG('M', 'S', 'P', 'T') #define TAG_SECTION_PAGE_TABLE TAG('M', 'S', 'P', 'T')
#define SHARE_COUNT(E) ((E) & 0xFFF)
#define MAX_SHARE_COUNT 0xFFF
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID VOID
@ -58,6 +78,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject)
if (FileObject->SectionObjectPointers->ImageSectionObject != NULL) if (FileObject->SectionObjectPointers->ImageSectionObject != NULL)
{ {
PMM_IMAGE_SECTION_OBJECT ImageSectionObject; PMM_IMAGE_SECTION_OBJECT ImageSectionObject;
ULONG i; ULONG i;
ImageSectionObject = ImageSectionObject =
@ -161,6 +182,7 @@ MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
Table->Pages[TableOffset] = Entry; Table->Pages[TableOffset] = Entry;
} }
ULONG ULONG
MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
ULONG Offset) ULONG Offset)
@ -184,6 +206,49 @@ MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
return(Entry); return(Entry);
} }
VOID
MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
ULONG Offset)
{
ULONG Entry;
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
if (Entry == 0)
{
DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
KeBugCheck(0);
}
if (SHARE_COUNT(Entry) == MAX_SHARE_COUNT)
{
DPRINT1("Maximum share count reached\n");
KeBugCheck(0);
}
Entry++;
MmSetPageEntrySectionSegment(Segment, Offset, Entry);
}
VOID
MmUnsharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
ULONG Offset)
{
ULONG Entry;
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
if (Entry == 0)
{
DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
KeBugCheck(0);
}
if (SHARE_COUNT(Entry) == 0)
{
DPRINT1("Zero share count for unshare\n");
KeBugCheck(0);
}
Entry--;
MmSetPageEntrySectionSegment(Segment, Offset, Entry);
}
NTSTATUS NTSTATUS
MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace, MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
MEMORY_AREA* MemoryArea, MEMORY_AREA* MemoryArea,
@ -271,7 +336,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
*/ */
if (!NT_SUCCESS(PageOp->Status)) if (!NT_SUCCESS(PageOp->Status))
{ {
return(Status); return(PageOp->Status);
} }
MmLockAddressSpace(AddressSpace); MmLockAddressSpace(AddressSpace);
MmLockSection(Section); MmLockSection(Section);
@ -286,6 +351,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Page = (PVOID)(Entry & 0xFFFFF000); Page = (PVOID)(Entry & 0xFFFFF000);
MmReferencePage(Page); MmReferencePage(Page);
// MmSharePageEntrySectionSegment(Segment, Offset.u.LowPart);
Status = MmCreateVirtualMapping(PsGetCurrentProcess(), Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
@ -435,7 +501,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
/* /*
* FIXME: What do we know in this case? * FIXME: What do we know in this case?
*/ */
DPRINT("IoPageRead failed (Status %x)\n", Status); DPRINT1("IoPageRead failed (Status %x)\n", Status);
/* /*
* Cleanup and release locks * Cleanup and release locks
@ -471,6 +537,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
*/ */
Entry = (ULONG)Page; Entry = (ULONG)Page;
MmSetPageEntrySectionSegment(Segment, Offset.QuadPart, Entry); MmSetPageEntrySectionSegment(Segment, Offset.QuadPart, Entry);
// MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
Status = MmCreateVirtualMapping(PsGetCurrentProcess(), Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
@ -502,6 +569,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Page = (PVOID)Entry; Page = (PVOID)Entry;
MmReferencePage(Page); MmReferencePage(Page);
// MmSharePageEntrySectionSegment(Segment, Offset.QuadPart);
Status = MmCreateVirtualMapping(PsGetCurrentProcess(), Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
@ -1694,24 +1762,35 @@ VOID STATIC
MmFreeSectionPage(PVOID Context, PVOID Address, ULONG PhysAddr) MmFreeSectionPage(PVOID Context, PVOID Address, ULONG PhysAddr)
{ {
PMEMORY_AREA MArea; PMEMORY_AREA MArea;
ULONG Entry;
MArea = (PMEMORY_AREA)Context; MArea = (PMEMORY_AREA)Context;
if (PhysAddr != 0) if (PhysAddr != 0)
{ {
if (MmGetReferenceCountPage((PVOID)PhysAddr) == 1) ULONG Offset;
Offset =
((ULONG)PAGE_ROUND_DOWN(Address) - (ULONG)MArea->BaseAddress) +
MArea->Data.SectionData.ViewOffset;
Entry = MmGetPageEntrySectionSegment(MArea->Data.SectionData.Segment,
Offset);
/*
* Just dereference private pages
*/
if (PhysAddr != (Entry & 0xFFFFF000))
{ {
ULONG Offset; MmDereferencePage((PVOID)PhysAddr);
}
Offset = else
((ULONG)PAGE_ROUND_DOWN(Address) - (ULONG)MArea->BaseAddress) + {
MArea->Data.SectionData.ViewOffset; #if 0
MmUnsharePageEntrySectionSegment(MArea->Data.SectionData.Segment,
MmSetPageEntrySectionSegment(MArea->Data.SectionData.Segment, Offset);
Offset, MmDereferencePage((PVOID)PhysAddr);
0); #endif
} }
MmDereferencePage((PVOID)PhysAddr);
} }
} }