Subversion Repositories Kolibri OS

Rev

Rev 837 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 837 Rev 914
Line 14... Line 14...
14
;;                                                              ;;
14
;;                                                              ;;
15
;;  See file COPYING for details                                ;;
15
;;  See file COPYING for details                                ;;
16
;;                                                              ;;
16
;;                                                              ;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 18... Line 18...
18
 
18
 
Line 19... Line 19...
19
$Revision: 593 $
19
$Revision: 914 $
20
 
20
 
21
 
21
 
Line 41... Line 41...
41
;       Adds a buffer number to the beginning of the free list.
41
;       Adds a buffer number to the beginning of the free list.
42
;       buffer number in eax  ( ms word zeroed )
42
;       buffer number in eax  ( ms word zeroed )
43
;       all other registers preserved
43
;       all other registers preserved
44
;        This always works, so no error returned
44
;        This always works, so no error returned
45
;***************************************************************************
45
;***************************************************************************
-
 
46
uglobal
-
 
47
  freeBuff_cnt dd ?
-
 
48
endg
46
freeBuff:
49
freeBuff:
-
 
50
;        inc     [freeBuff_cnt]
-
 
51
;        DEBUGF  1, "K : freeBuff (%u)\n", [freeBuff_cnt]
47
    push    ebx
52
    push    ebx
48
    push    ecx
53
    push    ecx
49
    mov     ebx, EMPTY_QUEUE
54
    mov     ebx, queues + EMPTY_QUEUE * 2
50
    shl     ebx, 1
-
 
51
    add     ebx, queues
-
 
52
    cli     ; Ensure that another process does not interfer
55
    cli     ; Ensure that another process does not interfer
53
    movzx   ecx, word [ebx]
56
    mov     cx, [ebx]
54
    mov     [ebx], ax
57
    mov     [ebx], ax
55
    shl     eax, 1
-
 
56
    add     eax, queueList
-
 
57
    mov     [eax], cx
58
    mov     [queueList + eax * 2], cx
58
    sti
59
    sti
59
    pop     ecx
60
    pop     ecx
60
    pop     ebx
61
    pop     ebx
Line 61... Line 62...
61
 
62
 
Line 103... Line 104...
103
;       queue number in eax ( ms word zeroed )
104
;       queue number in eax ( ms word zeroed )
104
;       buffer number in ebx  ( ms word zeroed )
105
;       buffer number in ebx  ( ms word zeroed )
105
;       all other registers preserved
106
;       all other registers preserved
106
;        This always works, so no error returned
107
;        This always works, so no error returned
107
;***************************************************************************
108
;***************************************************************************
-
 
109
uglobal
-
 
110
  queue_cnt dd ?
-
 
111
endg
108
queue:
112
queue:
-
 
113
;        inc     [queue_cnt]
-
 
114
;        DEBUGF  1, "K : queue (%u)\n", [queue_cnt]
109
    push    ebx
115
    push    ebx
110
    shl     ebx, 1
116
    shl     ebx, 1
111
    add     ebx, queueList        ; eax now holds address of queue entry
117
    add     ebx, queueList        ; eax now holds address of queue entry
112
    mov     [ebx], word NO_BUFFER    ; This buffer will be the last
118
    mov     [ebx], word NO_BUFFER    ; This buffer will be the last
Line 153... Line 159...
153
;       queue number in eax ( ms word zeroed )
159
;       queue number in eax ( ms word zeroed )
154
;       buffer number returned in eax ( ms word zeroed )
160
;       buffer number returned in eax ( ms word zeroed )
155
;       all other registers preserved
161
;       all other registers preserved
156
;
162
;
157
;***************************************************************************
163
;***************************************************************************
-
 
164
uglobal
-
 
165
  dequeue_cnt dd ?
-
 
166
endg
158
dequeue:
167
dequeue:
159
    push    ebx
168
    push    ebx
160
    shl     eax, 1
169
    shl     eax, 1
161
    add     eax, queues            ; eax now holds address of queue
170
    add     eax, queues            ; eax now holds address of queue
162
    mov     ebx, eax
171
    mov     ebx, eax
163
    cli
172
    cli
164
    movzx   eax, word [eax]
173
    movzx   eax, word [eax]
165
    cmp     ax, NO_BUFFER
174
    cmp     ax, NO_BUFFER
166
    je      dq_exit
175
    je      dq_exit
-
 
176
;        inc     [dequeue_cnt]
-
 
177
;        DEBUGF  1, "K : dequeue (%u)\n", [dequeue_cnt]
167
    push    eax
178
    push    eax
168
    shl     eax, 1
179
    shl     eax, 1
169
    add     eax, queueList        ; eax now holds address of queue entry
180
    add     eax, queueList        ; eax now holds address of queue entry
170
    mov     ax, [eax]
181
    mov     ax, [eax]
171
    mov     [ebx], ax
182
    mov     [ebx], ax