Don't map NOLOAD sections

svn path=/trunk/; revision=1748
This commit is contained in:
David Welch 2001-03-30 15:14:53 +00:00
parent 74412de062
commit 381057612c
6 changed files with 54 additions and 31 deletions

View file

@ -12,7 +12,7 @@
#define IMAGE_SECTION_CHAR_EXECUTABLE 0x20000000 #define IMAGE_SECTION_CHAR_EXECUTABLE 0x20000000
#define IMAGE_SECTION_CHAR_READABLE 0x40000000 #define IMAGE_SECTION_CHAR_READABLE 0x40000000
#define IMAGE_SECTION_CHAR_WRITABLE 0x80000000 #define IMAGE_SECTION_CHAR_WRITABLE 0x80000000
#define IMAGE_SECTION_NOLOAD 0x00000002
#define IMAGE_DOS_MAGIC 0x5a4d #define IMAGE_DOS_MAGIC 0x5a4d
#define IMAGE_PE_MAGIC 0x00004550 #define IMAGE_PE_MAGIC 0x00004550

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.44 2001/02/17 17:41:17 ekohl Exp $ # $Id: makefile,v 1.45 2001/03/30 15:14:52 dwelch Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -8,7 +8,7 @@ TARGET = kernel32
KERNEL32_BASE = 0x77f00000 KERNEL32_BASE = 0x77f00000
CFLAGS = -DKERNEL32_BASE=$(KERNEL32_BASE) CFLAGS := -DKERNEL32_BASE=$(KERNEL32_BASE) -g
DLLTARGET=$(TARGET).dll DLLTARGET=$(TARGET).dll

View file

@ -313,6 +313,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
PULONG stack; PULONG stack;
NTSTATUS Status; NTSTATUS Status;
ULONG Esp0; ULONG Esp0;
ULONG StackLimit;
static char *TypeStrings[] = static char *TypeStrings[] =
{ {
"Divide Error", "Divide Error",
@ -438,6 +439,15 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
DbgPrint("stack<%p>: ", stack); DbgPrint("stack<%p>: ", stack);
if (PsGetCurrentThread() != NULL)
{
StackLimit = (ULONG)PsGetCurrentThread()->Tcb.StackBase;
}
else
{
StackLimit = (ULONG)&init_stack_top;
}
for (i = 0; i < 18; i = i + 6) for (i = 0; i < 18; i = i + 6)
{ {
DbgPrint("%.8x %.8x %.8x %.8x\n", DbgPrint("%.8x %.8x %.8x %.8x\n",
@ -446,7 +456,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
stack[i+4], stack[i+5]); stack[i+4], stack[i+5]);
} }
DbgPrint("Frames:\n"); DbgPrint("Frames:\n");
for (i = 0; i < 32; i++) for (i = 0; i < 32 && ((ULONG)&stack[i] < StackLimit); i++)
{ {
if (stack[i] > ((unsigned int) &_text_start__) && if (stack[i] > ((unsigned int) &_text_start__) &&
!(stack[i] >= ((ULONG)&init_stack) && !(stack[i] >= ((ULONG)&init_stack) &&
@ -508,10 +518,12 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
for(;;); for(;;);
} }
VOID KeDumpStackFrames(PVOID _Stack, ULONG NrFrames) VOID
KeDumpStackFrames(PVOID _Stack, ULONG NrFrames)
{ {
PULONG Stack = (PULONG)_Stack; PULONG Stack = (PULONG)_Stack;
ULONG i; ULONG i;
ULONG StackLimit;
Stack = (PVOID)(((ULONG)Stack) & (~0x3)); Stack = (PVOID)(((ULONG)Stack) & (~0x3));
DbgPrint("Stack: %x\n", Stack); DbgPrint("Stack: %x\n", Stack);
@ -521,13 +533,20 @@ VOID KeDumpStackFrames(PVOID _Stack, ULONG NrFrames)
PsGetCurrentThread()->Tcb.StackLimit); PsGetCurrentThread()->Tcb.StackLimit);
} }
DbgPrint("Frames:\n"); if (PsGetCurrentThread() != NULL)
for (i=0; i<NrFrames; i++) {
StackLimit = (ULONG)PsGetCurrentThread()->Tcb.StackBase;
}
else
{
StackLimit = (ULONG)&init_stack_top;
}
DbgPrint("Frames:\n");
for (i=0; i<NrFrames && ((ULONG)&Stack[i] < StackLimit); i++)
{ {
// if (Stack[i] > KERNEL_BASE && Stack[i] < ((ULONG)&etext))
if (Stack[i] > KERNEL_BASE) if (Stack[i] > KERNEL_BASE)
{ {
// DbgPrint("%.8x ",Stack[i]);
print_address((PVOID)Stack[i]); print_address((PVOID)Stack[i]);
DbgPrint(" "); DbgPrint(" ");
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: section.c,v 1.53 2001/03/29 17:24:43 dwelch Exp $ /* $Id: section.c,v 1.54 2001/03/30 15:14:53 dwelch Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c * FILE: ntoskrnl/mm/section.c
@ -1557,7 +1557,6 @@ MmMapViewOfSegment(PEPROCESS Process,
FALSE); FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
MmUnlockAddressSpace(AddressSpace);
return(Status); return(Status);
} }
@ -1680,6 +1679,8 @@ NtMapViewOfSection(HANDLE SectionHandle,
{ {
PVOID SBaseAddress; PVOID SBaseAddress;
if (!(Section->Segments[i].Characteristics & IMAGE_SECTION_NOLOAD))
{
SBaseAddress = (PVOID) SBaseAddress = (PVOID)
((ULONG)Section->ImageBase + ((ULONG)Section->ImageBase +
(ULONG)Section->Segments[i].VirtualAddress); (ULONG)Section->Segments[i].VirtualAddress);
@ -1703,6 +1704,7 @@ NtMapViewOfSection(HANDLE SectionHandle,
return(Status); return(Status);
} }
} }
}
*BaseAddress = Section->ImageBase; *BaseAddress = Section->ImageBase;
} }
else else

View file

@ -80,10 +80,12 @@ SECTIONS
*(COMMON) *(COMMON)
__bss_end__ = . ; __bss_end__ = . ;
} }
/*
.reloc BLOCK(__section_alignment__) : .reloc BLOCK(__section_alignment__) :
{ {
*(.reloc) *(.reloc)
} }
*/
.stab BLOCK(__section_alignment__) (NOLOAD) : .stab BLOCK(__section_alignment__) (NOLOAD) :
{ {
[ .stab ] [ .stab ]