Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1262 vkos 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;  Copyright (C) Vasiliy Kosenko (vkos), 2009                                                    ;;
3
;;  This program is free software: you can redistribute it and/or modify it under the terms of    ;;
4
;;  the GNU General Public License as published by the Free Software Foundation, either version 3 ;;
5
;;  of the License, or (at your option) any later version.                                        ;;
6
;;                                                                                                ;;
7
;;  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;     ;;
8
;;  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ;;
9
;;  the GNU General Public License for more details.                                              ;;
10
;;                                                                                                ;;
11
;;  You should have received a copy of the GNU General Public License along with this program.    ;;
12
;;  If not, see .                                                   ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
 
15
thread_find_by_name:
16
	cld
17
 
18
	push ebp
19
	mov ebp, esp
20
 
21
	push ebx ecx
22
 
23
	push 1							;; initial slot
24
 
25
	mov ebx, dword [thread_find_buff]
26
 
27
	push 0
28
 
29
.cycle:
30
	mcall 9							;; Get thread info
31
	mov dword [esp], eax					;; number of slots
32
 
33
	cmp word [ebx+0x32], 9
34
	je .next
35
 
36
.cmpstr:
37
	mov ecx, 11
38
 
39
	mov esi, dword [thread_find_buff]
40
	add esi, 0xA						;; ESI = address of thread name in list
41
 
42
	mov edi, dword [ebp+8]					;; EDI = address of thread name to find
43
 
44
	repe cmpsb
45
	je .found
46
 
47
.next:
48
	mov ecx, dword [esp+4]
49
	inc ecx
50
	cmp ecx, dword [esp]
51
	jg .not_found
52
	mov dword [esp+4], ecx
53
	jmp .cycle
54
 
55
.found:
56
	mov eax, dword [ebx+30]					;; return TID
57
 
58
	jmp .exit
59
 
60
.not_found:
61
	xor eax, eax
62
 
63
.exit:
64
	pop ecx ebx
65
 
66
	leave
67
 
68
	ret 4
69
 
70
thread_find_buff:
71
	dd 0
72
 
73
event_add_mask:
74
	xchg eax, dword [esp+4]
75
	or dword [event_mask], eax
76
	mcall 40, dword [event_mask]
77
	xchg eax, dword [esp+4]
78
	ret 4
79
 
80
event_mask:
81
	dd 0