Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4996 → Rev 4997

/drivers/usb/usbftdi/linkedlist.inc
1,9 → 1,14
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
head dd 0
node equ ftdi_context
node.next equ ftdi_context.next_context
linkedlist:
size dd 0
 
.add:
linkedlist_add:
push ebx
mov ebx, [head]
mov [head], eax
11,7 → 16,7
pop ebx
ret
 
.delete:
linkedlist_delete:
push ebx ecx
mov ebx, eax ; eax - pointer to node for delete
cmp eax, [head]
30,7 → 35,6
mov [ebx+node.next], ecx
jmp @f
 
 
.unlink_head:
mov ebx, [eax+node.next]
mov [head], ebx
41,7 → 45,25
pop ecx ebx
ret
 
.gethead:
linkedlist_isvalid:
push ebx ecx
xor ecx, ecx
mov ebx, [head]
.next_check:
cmp eax, ebx
jz .valid_pointer
mov ebx, [ebx + node.next]
test ebx, ebx
jz .invalid_pointer
jmp .next_check
.invalid_pointer:
inc ecx
.valid_pointer:
mov eax, ecx
pop ecx ebx
ret
 
linkedlist_gethead:
mov eax, [head]
ret