Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1055 → Rev 1056

/kernel/trunk/core/debug.inc
415,59 → 415,28
.ret:
ret
 
debug_exc:
test byte [esp+8+2], 2
jnz v86_debug_exc
; int 1 = #DB
save_ring3_context
cld
mov ax, app_data ;os_data
mov ds, ax
mov es, ax
mov eax, dr6
push eax
xor eax, eax
mov dr6, eax
; test if debugging
cli
mov eax, [current_slot]
mov eax, [eax+APPDATA.debugger_slot]
test eax, eax
jnz .debug
sti
; not debuggee => say error and terminate
add esp, 0x20+4
mov [error_interrupt], 1
call show_error_parameters
mov edx, [TASK_BASE]
mov byte [edx+TASKDATA.state], 4
jmp change_task
.debug:
debug_ex:
; we are debugged process, notify debugger and suspend ourself
; eax=debugger PID
pop edx
mov edx, dr6 ; debug_message data=DR6_image
xor ebx, ebx
mov dr6, ebx
mov ebx, dr7
mov cl, not 1
.l1:
test bl, 1
jnz @f
mov cl, not 8
.l1: shl bl,2
jc @f
and dl, cl
@@:
shr ebx, 2
add cl, cl
inc ecx
cmp cl, not 10h
jnz .l1
push edx ; DR6 image
mov ecx, [TASK_BASE]
push dword [ecx+TASKDATA.pid] ; PID
push 12
pop ecx
push 3 ; 3 = debug exception
call debugger_notify
pop ecx
pop ecx
pop ecx
@@: sar cl,1
jc .l1
mov ecx,3 ; debug_message code=debug_exception
.notify:
push edx ; debug_message data
mov ebx, [TASK_BASE]
push [ebx+TASKDATA.pid] ; PID
push ecx ; debug_message code
mov ecx,12 ; debug_message size
call debugger_notify ;; only ONE using, inline ???
add esp,12
mov edx, [TASK_BASE]
mov byte [edx+TASKDATA.state], 1 ; suspended
call change_task