kolibrios-fun/programs/system/launch/trunk/thread.inc
vkos 6d7d0d57eb Added ability to notify intrested processes about launching via Kobra
git-svn-id: svn://kolibrios.org@1262 a494cfbc-eb01-0410-851d-a64ba20cac60
2009-11-09 20:14:00 +00:00

82 lines
2.2 KiB
PHP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
;; This program is free software: you can redistribute it and/or modify it under the terms of ;;
;; the GNU General Public License as published by the Free Software Foundation, either version 3 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; ;;
;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ;;
;; the GNU General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU General Public License along with this program. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
thread_find_by_name:
cld
push ebp
mov ebp, esp
push ebx ecx
push 1 ;; initial slot
mov ebx, dword [thread_find_buff]
push 0
.cycle:
mcall 9 ;; Get thread info
mov dword [esp], eax ;; number of slots
cmp word [ebx+0x32], 9
je .next
.cmpstr:
mov ecx, 11
mov esi, dword [thread_find_buff]
add esi, 0xA ;; ESI = address of thread name in list
mov edi, dword [ebp+8] ;; EDI = address of thread name to find
repe cmpsb
je .found
.next:
mov ecx, dword [esp+4]
inc ecx
cmp ecx, dword [esp]
jg .not_found
mov dword [esp+4], ecx
jmp .cycle
.found:
mov eax, dword [ebx+30] ;; return TID
jmp .exit
.not_found:
xor eax, eax
.exit:
pop ecx ebx
leave
ret 4
thread_find_buff:
dd 0
event_add_mask:
xchg eax, dword [esp+4]
or dword [event_mask], eax
mcall 40, dword [event_mask]
xchg eax, dword [esp+4]
ret 4
event_mask:
dd 0