Rev 1376 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1376 | Rev 2382 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 1376 $ |
8 | $Revision: 2382 $ |
9 | 9 | ||
10 | 10 | ||
11 | ; diamond, 2006 |
11 | ; diamond, 2006 |
12 | sys_debug_services: |
12 | sys_debug_services: |
- | 13 | cmp ebx, 9 |
|
13 | cmp ebx, 9 |
14 | ja @f |
14 | ja @f |
15 | jmp dword [sys_debug_services_table+ebx*4] |
15 | jmp dword [sys_debug_services_table+ebx*4] |
16 | @@: |
16 | @@: ret |
17 | ret |
17 | iglobal |
18 | iglobal |
18 | align 4 |
19 | align 4 |
Line 91... | Line 92... | ||
91 | test cl, cl |
92 | test cl, cl |
92 | jz .1 |
93 | jz .1 |
93 | cmp cl, 5 |
94 | cmp cl, 5 |
94 | jnz .ret |
95 | jnz .ret |
95 | mov cl, 2 |
96 | mov cl, 2 |
- | 97 | .2: |
|
96 | .2: mov [CURRENT_TASK+eax+TASKDATA.state], cl |
98 | mov [CURRENT_TASK+eax+TASKDATA.state], cl |
97 | .ret: |
99 | .ret: |
98 | sti |
100 | sti |
99 | ret |
101 | ret |
100 | .1: |
102 | .1: |
101 | inc ecx |
103 | inc ecx |
Line 106... | Line 108... | ||
106 | cmp cl, 1 |
108 | cmp cl, 1 |
107 | jz .1 |
109 | jz .1 |
108 | cmp cl, 2 |
110 | cmp cl, 2 |
109 | jnz .ret |
111 | jnz .ret |
110 | mov cl, 5 |
112 | mov cl, 5 |
- | 113 | .2: |
|
111 | .2: mov [CURRENT_TASK+eax+TASKDATA.state], cl |
114 | mov [CURRENT_TASK+eax+TASKDATA.state], cl |
- | 115 | .ret: |
|
112 | .ret: ret |
116 | ret |
- | 117 | .1: |
|
113 | .1: dec ecx |
118 | dec ecx |
114 | jmp .2 |
119 | jmp .2 |
Line 115... | Line 120... | ||
115 | 120 | ||
116 | debug_resume: |
121 | debug_resume: |
117 | ; in: ecx=pid |
122 | ; in: ecx=pid |
Line 120... | Line 125... | ||
120 | mov eax, ecx |
125 | mov eax, ecx |
121 | call pid_to_slot |
126 | call pid_to_slot |
122 | shl eax, 5 |
127 | shl eax, 5 |
123 | jz .ret |
128 | jz .ret |
124 | call do_resume |
129 | call do_resume |
- | 130 | .ret: |
|
125 | .ret: sti |
131 | sti |
126 | ret |
132 | ret |
Line 127... | Line 133... | ||
127 | 133 | ||
128 | debug_getcontext: |
134 | debug_getcontext: |
129 | ; in: |
135 | ; in: |
Line 321... | Line 327... | ||
321 | dec eax |
327 | dec eax |
322 | jnz .err |
328 | jnz .err |
323 | call get_debuggee_slot |
329 | call get_debuggee_slot |
324 | jc .err |
330 | jc .err |
325 | shr eax, 5 |
331 | shr eax, 5 |
326 | ; mov ebx, esi |
332 | mov ecx, edi |
327 | call read_process_memory |
333 | call read_process_memory |
328 | sti |
334 | sti |
329 | mov dword [esp+32], eax |
335 | mov dword [esp+32], eax |
330 | ret |
336 | ret |
331 | .err: |
337 | .err: |
Line 347... | Line 353... | ||
347 | dec eax |
353 | dec eax |
348 | jnz debug_read_process_memory.err |
354 | jnz debug_read_process_memory.err |
349 | call get_debuggee_slot |
355 | call get_debuggee_slot |
350 | jc debug_read_process_memory.err |
356 | jc debug_read_process_memory.err |
351 | shr eax, 5 |
357 | shr eax, 5 |
352 | ; mov ebx, esi |
358 | mov ecx, edi |
353 | call write_process_memory |
359 | call write_process_memory |
354 | sti |
360 | sti |
355 | mov [esp+32], eax |
361 | mov [esp+32], eax |
356 | ret |
362 | ret |
Line 366... | Line 372... | ||
366 | mov edi, [timer_ticks] |
372 | mov edi, [timer_ticks] |
367 | add edi, 500 ; 5 sec timeout |
373 | add edi, 500 ; 5 sec timeout |
368 | .1: |
374 | .1: |
369 | mov eax, ebp |
375 | mov eax, ebp |
370 | shl eax, 8 |
376 | shl eax, 8 |
371 | mov edx, [SLOT_BASE+eax+APPDATA.dbg_event_mem] |
377 | mov esi, [SLOT_BASE+eax+APPDATA.dbg_event_mem] |
372 | test edx, edx |
378 | test esi, esi |
373 | jz .ret |
379 | jz .ret |
374 | ; read buffer header |
380 | ; read buffer header |
375 | push ecx |
381 | push ecx |
376 | push eax |
382 | push eax |
377 | push eax |
383 | push eax |
378 | mov eax, ebp |
384 | mov eax, ebp |
379 | mov ebx, esp |
385 | mov ecx, esp |
380 | mov ecx, 8 |
386 | mov edx, 8 |
381 | call read_process_memory |
387 | call read_process_memory |
382 | cmp eax, ecx |
388 | cmp eax, edx |
383 | jz @f |
389 | jz @f |
384 | add esp, 12 |
390 | add esp, 12 |
385 | jmp .ret |
391 | jmp .ret |
386 | @@: |
392 | @@: |
387 | cmp dword [ebx], 0 |
393 | cmp dword [ecx], 0 |
388 | jg @f |
394 | jg @f |
389 | .2: |
395 | .2: |
390 | pop ecx |
396 | pop ecx |
391 | pop ecx |
397 | pop ecx |
392 | pop ecx |
398 | pop ecx |
Line 398... | Line 404... | ||
398 | sti |
404 | sti |
399 | call change_task |
405 | call change_task |
400 | cli |
406 | cli |
401 | jmp .1 |
407 | jmp .1 |
402 | @@: |
408 | @@: |
403 | mov ecx, [ebx+8] |
409 | mov edx, [ecx+8] |
404 | add ecx, [ebx+4] |
410 | add edx, [ecx+4] |
405 | cmp ecx, [ebx] |
411 | cmp edx, [ecx] |
406 | ja .2 |
412 | ja .2 |
407 | ; advance buffer position |
413 | ; advance buffer position |
408 | push ecx |
414 | push edx |
409 | mov ecx, 4 |
415 | mov edx, 4 |
410 | sub ebx, ecx |
416 | sub ecx, edx |
411 | mov eax, ebp |
417 | mov eax, ebp |
412 | add edx, ecx |
418 | add esi, edx |
413 | call write_process_memory |
419 | call write_process_memory |
414 | pop eax |
420 | pop eax |
415 | ; write message |
421 | ; write message |
416 | mov eax, ebp |
422 | mov eax, ebp |
417 | add edx, ecx |
423 | add esi, edx |
418 | add edx, [ebx+8] |
424 | add esi, [ecx+8] |
419 | add ebx, 20 |
425 | add ecx, 20 |
420 | pop ecx |
426 | pop edx |
421 | pop ecx |
427 | pop edx |
422 | pop ecx |
428 | pop edx |
423 | call write_process_memory |
429 | call write_process_memory |
424 | ; new debug event |
430 | ; new debug event |
425 | mov eax, ebp |
431 | mov eax, ebp |
426 | shl eax, 8 |
432 | shl eax, 8 |
427 | or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h |
433 | or byte [SLOT_BASE+eax+APPDATA.event_mask+1], 1 ; set flag 100h |