66 DPRINT((0,
"HandleInDebuggerFault(): ###### page fault @ %.8X while inside debugger, eip: %x\n",
address,
ptr->eip));
71 DPRINT((0,
"HandleInDebuggerFault(): ###### page fault @ %.8X while in page fault handler\n",
address));
73 DPRINT((0,
"!!! machine is halted !!!\n"));
86 DPRINT((0,
"%.8X (%.4X:%.8X %.8X %s %s %s task=%.8X )\n",
91 (
ptr->error_code&1)?
"PLP":
"NP",
92 (
ptr->error_code&2)?
"WRITE":
"READ",
93 (
ptr->error_code&4)?
"USER-MODE":
"KERNEL-MODE",
98 DPRINT((0,
"HandleInDebuggerFault(): unexpected pagefault in command handler!\n",
address));
102 DPRINT((0,
"HandleInDebuggerFault(): unexpected pagefault in command handler while in PrintkCallback()!\n",
address));
130 DPRINT((0,
"!!! machine is halted !!!\n"));
158 __asm__ __volatile__(
"movl %%cr2,%0" 166 DPRINT((0,
"return handleindebuggerfault\n"));
184 DPRINT((0,
"tsk: %x\t", tsk));
186 DPRINT((0,
"tsk address not valid: tsk: %x\n", tsk));
193 else vma = &(tsk->AddressSpace);
196 DPRINT((0,
"vma not valid: vma: %x\n", vma));
200 current_entry = vma->MAreaListHead.
Flink;
202 DPRINT((0,
"vma: %x, current_entry: %x, kernel arena: %x\n", vma, current_entry,
my_init_mm));
203 while(current_entry != &vma->MAreaListHead)
219 current->Type == MEMORY_AREA_VIRTUAL_MEMORY ||
220 current->Type == MEMORY_AREA_PAGED_POOL ||
221 current->Type == MEMORY_AREA_SHARED_DATA
278 current_entry = current_entry->Flink;
282 DPRINT((0,
"return 0 6\n"));
294 NewIntEHandler:\n\t \ 301 // setup default data selectors\n\t \ 306 * Load the PCR selector.\n\t \ 309 movl %eax, _OLD_PCR\n\t \ 310 movl _PCR_SEL, %eax\n\t \ 313 // get frame ptr\n\t \ 314 lea 40(%esp),%eax\n\t \ 316 call _HandlePageFault\n\t \ 320 movl _OLD_PCR, %eax\n\t \ 325 je call_old_inte_handler\n\t \ 328 je call_handler_unknown_reason\n\t \ 333 // remove error code. will be restored later when we call\n\t \ 334 // original handler again.\n\t \ 336 // call debugger loop\n\t \ 338 jmp NewInt31Handler\n\t \ 340 call_old_inte_handler:\n\t \ 344 // chain to old handler\n\t \ 346 jmp *_OldIntEHandler\n\t \ 348 call_handler_unknown_reason:\n\t \ 352 // remove error code. will be restored later when we call\n\t \ 353 // original handler again.\n\t \ 355 // call debugger loop\n\t \ 357 jmp NewInt31Handler\n\t \ 367 ULONG LocalIntEHandler;
374 __asm__ __volatile__(
"mov $NewIntEHandler,%0" 375 :
"=r" (LocalIntEHandler)
volatile BOOLEAN bInDebuggerShell
ULONG SetGlobalInt(ULONG dwInt, ULONG NewIntHandler)
void Print(USHORT Window, LPSTR p)
#define REASON_INTERNAL_ERROR
PMADDRESS_SPACE my_init_mm
#define MEMORY_AREA_SECTION_VIEW
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
struct _LIST_ENTRY * Flink
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
void IntelStackWalk(ULONG pc, ULONG ebp, ULONG esp)
PEPROCESS NTAPI IoGetCurrentProcess(VOID)
BOOLEAN bInPageFaultHandler
struct task_struct * current
void NewInt31Handler(void)
GLsizei const GLfloat * value
void InstallIntEHook(void)
ULONG HandleInDebuggerFault(FRAME *ptr, ULONG address)
ULONG HandlePageFault(FRAME *ptr)
void DeInstallIntEHook(void)
__asm__("\n\t \
NewIntEHandler:\n\t \
pushfl\n\t \
cli\n\t \
cld\n\t \
pushal\n\t \
pushl %ds\n\t \
\n\t \
// setup default data selectors\n\t \
movw %ss,%ax\n\t \
movw %ax,%ds\n\t \
\n\t \
/*\n\t \
* Load the PCR selector.\n\t \
*/\n\t \
movl %fs, %eax\n\t \
movl %eax, _OLD_PCR\n\t \
movl _PCR_SEL, %eax\n\t \
movl %eax, %fs\n\t \
\n\t \
// get frame ptr\n\t \
lea 40(%esp),%eax\n\t \
pushl %eax\n\t \
call _HandlePageFault\n\t \
addl $4,%esp\n\t \
\n\t \
pushl %eax\n\t \
movl _OLD_PCR, %eax\n\t \
movl %eax, %fs\n\t \
popl %eax\n\t \
\n\t \
cmpl $0,%eax\n\t \
je call_old_inte_handler\n\t \
\n\t \
cmpl $2,%eax\n\t \
je call_handler_unknown_reason\n\t \
\n\t \
popl %ds\n\t \
popal\n\t \
popfl\n\t \
// remove error code. will be restored later when we call\n\t \
// original handler again.\n\t \
addl $4,%esp\n\t \
// call debugger loop\n\t \
pushl $" STR(REASON_PAGEFAULT) "\n\t \
jmp NewInt31Handler\n\t \
\n\t \
call_old_inte_handler:\n\t \
popl %ds\n\t \
popal\n\t \
popfl\n\t \
// chain to old handler\n\t \
.byte 0x2e\n\t \
jmp *_OldIntEHandler\n\t \
\n\t \
call_handler_unknown_reason:\n\t \
popl %ds\n\t \
popal\n\t \
popfl\n\t \
// remove error code. will be restored later when we call\n\t \
// original handler again.\n\t \
addl $4,%esp\n\t \
// call debugger loop\n\t \
pushl $" STR(REASON_INTERNAL_ERROR) "\n\t \
jmp NewInt31Handler\n\t \
")
base of all file and directory entries
BOOLEAN IsAddressValid(ULONG address)