ReactOS  0.4.13-dev-482-ge57f103
gpfault.c File Reference
#include "remods.h"
#include "precomp.h"
Include dependency graph for gpfault.c:

Go to the source code of this file.

Functions

void HandleGPFault (FRAME *ptr)
 
 __asm__ ("\n\t \ NewGPFaultHandler:\n\t \ pushfl\n\t \ cli\n\t \ cld\n\t \ pushal\n\t \ pushl %ds\n\t \ \n\t \ // test for v86 mode\n\t \ testl $0x20000,40(%esp)\n\t \ jnz notv86\n\t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \ .byte 0x2e\n\t \ jmp *_OldGPFaultHandler\n\t \ notv86:\n\t \ // setup default data selectors\n\t \ movw %ss,%ax\n\t \ movw %ax,%ds\n\t \ \n\t \ // get frame ptr\n\t \ lea 40(%esp),%eax\n\t \ pushl %eax\n\t \ call _HandleGPFault\n\t \ addl $4,%esp\n\t \ \n \t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \ // remove error code from stack and replace with reason code\n\t \ movl $" STR(REASON_GP_FAULT) ",(%esp)\n\t \ // call debugger loop\n\t \ jmp NewInt31Handler\n\t \ ")
 
void InstallGPFaultHook (void)
 
void DeInstallGPFaultHook (void)
 

Variables

ULONG OldGPFaultHandler = 0
 
char tempGP [1024]
 

Function Documentation

◆ __asm__()

__asm__ ( "\n\t \ NewGPFaultHandler:\n\t \ pushfl\n\t \ cli\n\t \ cld\n\t \ pushal\n\t \ pushl %ds\n\t \\n\t \ // test for v86 mode\n\t \ testl  $0x20000,
40(%esp)\n\t \ jnz notv86\n\t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \ .byte 0x2e\n\t \ jmp *_OldGPFaultHandler\n\t \ notv86:\n\t \//setup default data selectors\n\t \ movw %  ss,
%ax\n\t \ movw %  ax,
%ds\n\t \\n\t \//get frame ptr\n\t \ lea   40%esp,
%eax\n\t \ pushl %eax\n\t \ call _HandleGPFault\n\t \ addl  $4,
%esp\n\t \\n \t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \//remove error code from stack and replace with reason code\n\t \ movl $" STR(REASON_GP_FAULT) "  ,
(%esp)\n\t \//call debugger loop\n\t \ jmp NewInt31Handler\n\t \ "   
)

Referenced by InstallGPFaultHook().

◆ DeInstallGPFaultHook()

void DeInstallGPFaultHook ( void  )

Definition at line 126 of file gpfault.c.

127 {
128  ENTER_FUNC();
129 
130  MaskIrqs();
132  {
136  }
137  UnmaskIrqs();
138 
139  LEAVE_FUNC();
140 }
#define TRUE
Definition: types.h:120
ULONG SetGlobalInt(ULONG dwInt, ULONG NewIntHandler)
Definition: hooks.c:95
#define LEAVE_FUNC()
Definition: debug.h:43
void MaskIrqs(void)
Definition: hooks.c:68
BOOLEAN RemoveAllSWBreakpoints(BOOLEAN bEvenPermanents)
Definition: bp.c:463
ULONG OldGPFaultHandler
Definition: gpfault.c:41
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
void UnmaskIrqs(void)
Definition: hooks.c:82

Referenced by CleanUpPICE().

◆ HandleGPFault()

void HandleGPFault ( FRAME ptr)

Definition at line 53 of file gpfault.c.

54 {
55  DPRINT((0,"HandleGPFault(): ptr = %x at eip: %x\n",ptr, ptr->eip));
56 }
static PVOID ptr
Definition: dispmode.c:27
void DPRINT(...)
Definition: polytest.cpp:61

◆ InstallGPFaultHook()

void InstallGPFaultHook ( void  )

Definition at line 102 of file gpfault.c.

103 {
104  ULONG LocalGPFaultHandler;
105 
106  ENTER_FUNC();
107 
108  MaskIrqs();
109  if(!OldGPFaultHandler)
110  {
111  __asm__("mov $NewGPFaultHandler,%0"
112  :"=r" (LocalGPFaultHandler)
113  :
114  :"eax");
115  OldGPFaultHandler=SetGlobalInt(0x0D,(ULONG)LocalGPFaultHandler);
116  }
117  UnmaskIrqs();
118 
119  LEAVE_FUNC();
120 }
ULONG SetGlobalInt(ULONG dwInt, ULONG NewIntHandler)
Definition: hooks.c:95
#define LEAVE_FUNC()
Definition: debug.h:43
void MaskIrqs(void)
Definition: hooks.c:68
__asm__("\n\t \ NewGPFaultHandler:\n\t \ pushfl\n\t \ cli\n\t \ cld\n\t \ pushal\n\t \ pushl %ds\n\t \ \n\t \ // test for v86 mode\n\t \ testl $0x20000,40(%esp)\n\t \ jnz notv86\n\t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \ .byte 0x2e\n\t \ jmp *_OldGPFaultHandler\n\t \ notv86:\n\t \ // setup default data selectors\n\t \ movw %ss,%ax\n\t \ movw %ax,%ds\n\t \ \n\t \ // get frame ptr\n\t \ lea 40(%esp),%eax\n\t \ pushl %eax\n\t \ call _HandleGPFault\n\t \ addl $4,%esp\n\t \ \n \t \ popl %ds\n\t \ popal\n\t \ popfl\n\t \ // remove error code from stack and replace with reason code\n\t \ movl $" STR(REASON_GP_FAULT) ",(%esp)\n\t \ // call debugger loop\n\t \ jmp NewInt31Handler\n\t \ ")
ULONG OldGPFaultHandler
Definition: gpfault.c:41
unsigned int ULONG
Definition: retypes.h:1
#define ENTER_FUNC()
Definition: debug.h:42
void UnmaskIrqs(void)
Definition: hooks.c:82

Referenced by InitPICE().

Variable Documentation

◆ OldGPFaultHandler

ULONG OldGPFaultHandler = 0

Definition at line 41 of file gpfault.c.

Referenced by DeInstallGPFaultHook(), and InstallGPFaultHook().

◆ tempGP

char tempGP[1024]

Definition at line 43 of file gpfault.c.