mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
Do not crash on software breakpoint in kdb.
svn path=/trunk/; revision=41264
This commit is contained in:
parent
81fa6557af
commit
877b413520
1 changed files with 108 additions and 5 deletions
|
@ -15,16 +15,24 @@
|
|||
#define PAGE_TABLE_MASK 0x3ff
|
||||
#define BIG_PAGE_SIZE (1<<22)
|
||||
#define CR4_PAGE_SIZE_BIT 0x10
|
||||
#define PDE_PRESENT_BIT 1
|
||||
#define PDE_W_BIT 2
|
||||
#define PDE_PRESENT_BIT 0x01
|
||||
#define PDE_W_BIT 0x02
|
||||
#define PDE_PWT_BIT 0x08
|
||||
#define PDE_PCD_BIT 0x10
|
||||
#define PDE_ACCESSED_BIT 0x20
|
||||
#define PDE_DIRTY_BIT 0x40
|
||||
#define PDE_PS_BIT 0x80
|
||||
|
||||
#define MI_KDBG_TMP_PAGE_1 (HYPER_SPACE + 0x400000 - PAGE_SIZE)
|
||||
#define MI_KDBG_TMP_PAGE_0 (MI_KDBG_TMP_PAGE_1 - PAGE_SIZE)
|
||||
|
||||
/* VARIABLES ***************************************************************/
|
||||
|
||||
extern ULONG MmGlobalKernelPageDirectory[1024];
|
||||
static BOOLEAN KdpPhysAccess = FALSE;
|
||||
|
||||
#if 0
|
||||
extern ULONG MmGlobalKernelPageDirectory[1024];
|
||||
ULONG_PTR IdentityMapAddrHigh, IdentityMapAddrLow;
|
||||
extern PFN_TYPE NTAPI MmAllocEarlyPage();
|
||||
|
||||
ULONGLONG
|
||||
FASTCALL
|
||||
|
@ -66,7 +74,6 @@ KdpPhysRead(ULONG_PTR Addr, LONG Len)
|
|||
return Result;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpPhysWrite(ULONG_PTR Addr, LONG Len, ULONGLONG Value)
|
||||
|
@ -104,6 +111,91 @@ KdpPhysWrite(ULONG_PTR Addr, LONG Len, ULONGLONG Value)
|
|||
__invlpg((PVOID)Addr);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static
|
||||
ULONG_PTR
|
||||
KdpPhysMap(ULONG_PTR PhysAddr, LONG Len)
|
||||
{
|
||||
MMPTE TempPte;
|
||||
PMMPTE PointerPte;
|
||||
ULONG_PTR VirtAddr;
|
||||
|
||||
TempPte.u.Long = PDE_PRESENT_BIT | PDE_W_BIT | PDE_PWT_BIT |
|
||||
PDE_PCD_BIT | PDE_ACCESSED_BIT | PDE_DIRTY_BIT;
|
||||
|
||||
if ((PhysAddr & (PAGE_SIZE - 1)) + Len > PAGE_SIZE)
|
||||
{
|
||||
TempPte.u.Hard.PageFrameNumber = (PhysAddr >> PAGE_SHIFT) + 1;
|
||||
PointerPte = MiAddressToPte(MI_KDBG_TMP_PAGE_1);
|
||||
*PointerPte = TempPte;
|
||||
VirtAddr = (ULONG_PTR)PointerPte << 10;
|
||||
__invlpg((PVOID)VirtAddr);
|
||||
}
|
||||
|
||||
TempPte.u.Hard.PageFrameNumber = PhysAddr >> PAGE_SHIFT;
|
||||
PointerPte = MiAddressToPte(MI_KDBG_TMP_PAGE_0);
|
||||
*PointerPte = TempPte;
|
||||
VirtAddr = (ULONG_PTR)PointerPte << 10;
|
||||
__invlpg((PVOID)VirtAddr);
|
||||
|
||||
return VirtAddr + (PhysAddr & (PAGE_SIZE - 1));
|
||||
}
|
||||
|
||||
static
|
||||
ULONGLONG
|
||||
KdpPhysRead(ULONG_PTR PhysAddr, LONG Len)
|
||||
{
|
||||
ULONG_PTR Addr;
|
||||
ULONGLONG Result = 0;
|
||||
|
||||
Addr = KdpPhysMap(PhysAddr, Len);
|
||||
|
||||
switch (Len)
|
||||
{
|
||||
case 8:
|
||||
Result = *((PULONGLONG)Addr);
|
||||
break;
|
||||
case 4:
|
||||
Result = *((PULONG)Addr);
|
||||
break;
|
||||
case 2:
|
||||
Result = *((PUSHORT)Addr);
|
||||
break;
|
||||
case 1:
|
||||
Result = *((PUCHAR)Addr);
|
||||
break;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
KdpPhysWrite(ULONG_PTR PhysAddr, LONG Len, ULONGLONG Value)
|
||||
{
|
||||
ULONG_PTR Addr;
|
||||
|
||||
Addr = KdpPhysMap(PhysAddr, Len);
|
||||
|
||||
switch (Len)
|
||||
{
|
||||
case 8:
|
||||
*((PULONGLONG)Addr) = Value;
|
||||
break;
|
||||
case 4:
|
||||
*((PULONG)Addr) = Value;
|
||||
break;
|
||||
case 2:
|
||||
*((PUSHORT)Addr) = Value;
|
||||
break;
|
||||
case 1:
|
||||
*((PUCHAR)Addr) = Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
KdpTranslateAddress(ULONG_PTR Addr, PULONG_PTR ResultAddr)
|
||||
|
@ -199,6 +291,7 @@ KdpSafeWriteMemory(ULONG_PTR Addr, LONG Len, ULONGLONG Value)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
VOID
|
||||
NTAPI
|
||||
KdpEnableSafeMem()
|
||||
|
@ -245,3 +338,13 @@ KdpEnableSafeMem()
|
|||
|
||||
KdpPhysAccess = TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpEnableSafeMem(VOID)
|
||||
{
|
||||
KdpPhysAccess = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue