Rev 379 | Rev 425 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 379 | Rev 380 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | debug_set_event_data: |
19 | debug_set_event_data: |
20 | ; in: ebx = pointer |
20 | ; in: ebx = pointer |
21 | ; destroys eax |
21 | ; destroys eax |
22 | mov eax, [CURRENT_TASK] |
22 | mov eax, [CURRENT_TASK] |
23 | shl eax, 8 |
23 | shl eax, 8 |
24 | mov [eax+0x80000+APPDATA.dbg_event_mem], ebx |
24 | mov [eax+SLOT_BASE+APPDATA.dbg_event_mem], ebx |
25 | ret |
25 | ret |
Line 26... | Line 26... | ||
26 | 26 | ||
27 | get_debuggee_slot: |
27 | get_debuggee_slot: |
28 | ; in: ebx=PID |
28 | ; in: ebx=PID |
Line 35... | Line 35... | ||
35 | test eax, eax |
35 | test eax, eax |
36 | jz .ret_bad |
36 | jz .ret_bad |
37 | shl eax, 5 |
37 | shl eax, 5 |
38 | push ebx |
38 | push ebx |
39 | mov ebx, [CURRENT_TASK] |
39 | mov ebx, [CURRENT_TASK] |
40 | cmp [0x80000+eax*8+APPDATA.debugger_slot], ebx |
40 | cmp [SLOT_BASE+eax*8+APPDATA.debugger_slot], ebx |
41 | pop ebx |
41 | pop ebx |
42 | jnz .ret_bad |
42 | jnz .ret_bad |
43 | ; clc ; automatically |
43 | ; clc ; automatically |
44 | ret |
44 | ret |
45 | .ret_bad: |
45 | .ret_bad: |
Line 49... | Line 49... | ||
49 | debug_detach: |
49 | debug_detach: |
50 | ; in: ebx=pid |
50 | ; in: ebx=pid |
51 | ; destroys eax,ebx |
51 | ; destroys eax,ebx |
52 | call get_debuggee_slot |
52 | call get_debuggee_slot |
53 | jc .ret |
53 | jc .ret |
54 | and dword [eax*8+0x80000+APPDATA.debugger_slot], 0 |
54 | and dword [eax*8+SLOT_BASE+APPDATA.debugger_slot], 0 |
55 | call do_resume |
55 | call do_resume |
56 | .ret: |
56 | .ret: |
57 | sti |
57 | sti |
58 | ret |
58 | ret |
Line 225... | Line 225... | ||
225 | 225 | ||
226 | debug_set_drx: |
226 | debug_set_drx: |
227 | call get_debuggee_slot |
227 | call get_debuggee_slot |
228 | jc .errret |
228 | jc .errret |
229 | mov ebp, eax |
229 | mov ebp, eax |
230 | lea eax, [eax*8+0x80000+APPDATA.dbg_regs] |
230 | lea eax, [eax*8+SLOT_BASE+APPDATA.dbg_regs] |
231 | ; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3 |
231 | ; [eax]=dr0, [eax+4]=dr1, [eax+8]=dr2, [eax+C]=dr3 |
232 | ; [eax+10]=dr7 |
232 | ; [eax+10]=dr7 |
233 | add edx, std_application_base_address |
233 | add edx, std_application_base_address |
234 | jc .errret |
234 | jc .errret |
Line 356... | Line 356... | ||
356 | mov edi, [timer_ticks] |
356 | mov edi, [timer_ticks] |
357 | add edi, 500 ; 5 sec timeout |
357 | add edi, 500 ; 5 sec timeout |
358 | .1: |
358 | .1: |
359 | mov eax, ebp |
359 | mov eax, ebp |
360 | shl eax, 8 |
360 | shl eax, 8 |
361 | mov edx, [0x80000+eax+APPDATA.dbg_event_mem] |
361 | mov edx, [SLOT_BASE+eax+APPDATA.dbg_event_mem] |
362 | test edx, edx |
362 | test edx, edx |
363 | jz .ret |
363 | jz .ret |
364 | ; read buffer header |
364 | ; read buffer header |
365 | push ecx |
365 | push ecx |
366 | push eax |
366 | push eax |
Line 412... | Line 412... | ||
412 | pop ecx |
412 | pop ecx |
413 | call write_process_memory |
413 | call write_process_memory |
414 | ; new debug event |
414 | ; new debug event |
415 | mov eax, ebp |
415 | mov eax, ebp |
416 | shl eax, 8 |
416 | shl eax, 8 |
417 | or byte [0x80000+eax+APPDATA.event_mask+1], 1 ; set flag 100h |
417 | or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h |
418 | .ret: |
418 | .ret: |
419 | ret |
419 | ret |
Line 420... | Line 420... | ||
420 | 420 | ||
421 | debug_exc: |
421 | debug_exc: |
Line 430... | Line 430... | ||
430 | jns @f |
430 | jns @f |
431 | ; this is exception from task switch |
431 | ; this is exception from task switch |
432 | ; set DRx registers for task and continue |
432 | ; set DRx registers for task and continue |
433 | mov eax, [CURRENT_TASK] |
433 | mov eax, [CURRENT_TASK] |
434 | shl eax, 8 |
434 | shl eax, 8 |
435 | add eax, 0x80000+APPDATA.dbg_regs |
435 | add eax, SLOT_BASE+APPDATA.dbg_regs |
436 | mov ecx, [eax+0] |
436 | mov ecx, [eax+0] |
437 | mov dr0, ecx |
437 | mov dr0, ecx |
438 | mov ecx, [eax+4] |
438 | mov ecx, [eax+4] |
439 | mov dr1, ecx |
439 | mov dr1, ecx |
440 | mov ecx, [eax+8] |
440 | mov ecx, [eax+8] |
Line 453... | Line 453... | ||
453 | mov dr6, eax |
453 | mov dr6, eax |
454 | ; test if debugging |
454 | ; test if debugging |
455 | cli |
455 | cli |
456 | mov eax, [CURRENT_TASK] |
456 | mov eax, [CURRENT_TASK] |
457 | shl eax, 8 |
457 | shl eax, 8 |
458 | mov eax, [0x80000+eax+APPDATA.debugger_slot] |
458 | mov eax, [SLOT_BASE+eax+APPDATA.debugger_slot] |
459 | test eax, eax |
459 | test eax, eax |
460 | jnz .debug |
460 | jnz .debug |
461 | sti |
461 | sti |
462 | ; not debuggee => say error and terminate |
462 | ; not debuggee => say error and terminate |
463 | add esp, 28h+4 |
463 | add esp, 28h+4 |