page ,132 subttl "Single Byte INT3 Breakpoin" ;++ ; ; Routine Description: ; ; Handle INT 3 breakpoint. ; ; The trap is caused by a single byte INT 3 instruction. A ; BREAKPOINT exception with additional parameter indicating ; READ access is raised for this trap if previous mode is user. ; ; Arguments: ; ; At entry, the saved CS:EIP point to the instruction immediately ; following the INT 3 instruction. ; No error code is provided with the error. ; ; Return value: ; ; None ; ;-- ASSUME DS:NOTHING, SS:NOTHING, ES:NOTHING
KiTrap03DebugService: ; ; If caller is user mode, we want interrupts back on. ; . all relevant state has already been saved ; . user mode code always runs with ints on ; ; If caller is kernel mode, we want them off! ; . some state still in registers, must prevent races ; . kernel mode code can run with ints off ; ; ; Arguments: ; eax - ServiceClass - which call is to be performed ; ecx - Arg1 - generic first argument ; edx - Arg2 - generic second argument ;
.errnz (EFLAGS_V86_MASK AND 0FF00FFFFh) test byte ptr [ebp]+TsEFlags+2,EFLAGS_V86_MASK/010000h jnz kit03_30 ; fault occured in V86 mode => Usermode
.errnz (MODE_MASK AND 0FFFFFF00h) test byte ptr [ebp]+TsSegCs,MODE_MASK jz kit03_10
cmp word ptr [ebp]+TsSegCs,KGDT_R3_CODE OR RPL_MASK jne kit03_30
kit03_05: sti kit03_10:
; ; Set up exception record and arguments for raising breakpoint exception ;
public CommonDispatchException align dword CommonDispatchException proc cPublicFpo 0, ExceptionRecordLength/4 ; ; Set up exception record for raising exception ;
sub esp, ExceptionRecordLength ; allocate exception record mov dword ptr [esp]+ErExceptionCode, eax ; set up exception code xor eax, eax mov dword ptr [esp]+ErExceptionFlags, eax ; set exception flags mov dword ptr [esp]+ErExceptionRecord, eax ; set associated exception record mov dword ptr [esp]+ErExceptionAddress, ebx mov dword ptr [esp]+ErNumberParameters, ecx ; set number of parameters cmp ecx, 0 je short de00
lea ebx, [esp + ErExceptionInformation] mov [ebx], edx mov [ebx+4], esi mov [ebx+8], edi de00: ; ; set up arguments and call _KiDispatchException ;
mov ecx, esp ; (ecx)->exception record
.errnz (EFLAGS_V86_MASK AND 0FF00FFFFh) test byte ptr [ebp]+TsEFlags+2,EFLAGS_V86_MASK/010000h jz short de10
mov eax,0FFFFh jmp short de20
de10: mov eax,[ebp]+TsSegCs de20: and eax,MODE_MASK