Rev 659 | Rev 662 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 659 | Rev 660 | ||
---|---|---|---|
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: 659 $ |
8 | $Revision: 660 $ |
9 | 9 | ||
Line 10... | Line 10... | ||
10 | 10 | ||
11 | align 4 |
11 | align 4 |
- | 12 | proc alloc_page |
|
12 | proc alloc_page |
13 | |
13 | 14 | pushfd |
|
14 | pushfd |
15 | cli |
15 | cli |
16 | push ebx |
16 | mov ebx, [page_start] |
17 | mov ebx, [page_start] |
17 | mov ecx, [page_end] |
18 | mov ecx, [page_end] |
18 | .l1: |
19 | .l1: |
19 | bsf eax,[ebx]; |
20 | bsf eax,[ebx]; |
- | 21 | jnz .found |
|
20 | jnz .found |
22 | add ebx,4 |
21 | add ebx,4 |
23 | cmp ebx, ecx |
22 | cmp ebx, ecx |
24 | jb .l1 |
23 | jb .l1 |
25 | pop ebx |
24 | popfd |
26 | popfd |
25 | xor eax,eax |
27 | xor eax,eax |
26 | ret |
28 | ret |
27 | .found: |
29 | .found: |
28 | btr [ebx], eax |
30 | btr [ebx], eax |
29 | mov [page_start],ebx |
31 | mov [page_start],ebx |
- | 32 | sub ebx, sys_pgmap |
|
30 | sub ebx, sys_pgmap |
33 | lea eax, [eax+ebx*8] |
31 | lea eax, [eax+ebx*8] |
34 | shl eax, 12 |
32 | shl eax, 12 |
35 | dec [pg_data.pages_free] |
Line 33... | Line 36... | ||
33 | dec [pg_data.pages_free] |
36 | pop ebx |
34 | popfd |
37 | popfd |
35 | ret |
38 | ret |
- | 39 | endp |
|
- | 40 | ||
36 | endp |
41 | align 4 |
37 | 42 | proc alloc_pages stdcall, count:dword |
|
38 | align 4 |
43 | pushfd |
39 | proc alloc_pages stdcall, count:dword |
44 | push ebx |
40 | pushfd |
45 | push edi |
Line 57... | Line 62... | ||
57 | dec edx |
62 | dec edx |
58 | jz .ok |
63 | jz .ok |
59 | inc ecx |
64 | inc ecx |
60 | cmp ecx,ebx |
65 | cmp ecx,ebx |
61 | jb .match |
66 | jb .match |
- | 67 | .fail: |
|
62 | .fail: xor eax, eax |
68 | xor eax, eax |
- | 69 | pop edi |
|
- | 70 | pop ebx |
|
63 | popfd |
71 | popfd |
64 | ret |
72 | ret |
65 | .next: |
73 | .next: |
66 | inc ecx |
74 | inc ecx |
67 | cmp ecx, ebx |
75 | cmp ecx, ebx |
68 | jb .find |
76 | jb .find |
- | 77 | pop edi |
|
- | 78 | pop ebx |
|
69 | popfd |
79 | popfd |
70 | xor eax, eax |
80 | xor eax, eax |
71 | ret |
81 | ret |
72 | .ok: |
82 | .ok: |
73 | sub ecx, edi |
83 | sub ecx, edi |
Line 79... | Line 89... | ||
79 | shl esi, 3+12 |
89 | shl esi, 3+12 |
80 | mov eax, esi |
90 | mov eax, esi |
81 | mov ebx, [count] |
91 | mov ebx, [count] |
82 | shl ebx, 3 |
92 | shl ebx, 3 |
83 | sub [pg_data.pages_free], ebx |
93 | sub [pg_data.pages_free], ebx |
- | 94 | pop edi |
|
- | 95 | pop ebx |
|
84 | popfd |
96 | popfd |
85 | ret |
97 | ret |
86 | endp |
98 | endp |
Line 87... | Line 99... | ||
87 | 99 |