Subversion Repositories Kolibri OS

Rev

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

Rev 859 Rev 864
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: 859 $
8
$Revision: 864 $
9
 
9
 
10
 
10
 
Line 43... Line 43...
43
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
43
proc free_kernel_space stdcall uses ebx ecx edx esi edi, base:dword
Line 44... Line 44...
44
 
44
 
45
           ret
45
           ret
Line 46... Line -...
46
endp
-
 
47
 
-
 
48
align 4
-
 
49
proc kernel_alloc stdcall, size:dword
-
 
50
           locals
-
 
51
             lin_addr    dd ?
-
 
52
             pages_count dd ?
-
 
53
           endl
-
 
54
 
-
 
55
           push ebx
-
 
56
           push edi
-
 
57
 
-
 
58
           mov eax, [size]
-
 
59
           add eax, 4095
-
 
60
           and eax, not 4095;
-
 
61
           mov [size], eax
-
 
62
           test eax, eax
-
 
63
           jz .err
-
 
64
 
-
 
65
           mov ebx, eax
-
 
66
           shr ebx, 12
-
 
67
           mov [pages_count], ebx
-
 
68
 
-
 
69
           stdcall alloc_kernel_space, eax
-
 
70
           test eax, eax
-
 
71
           jz .err
-
 
72
           mov [lin_addr], eax
-
 
73
 
-
 
74
           mov ecx, [pages_count]
-
 
75
           mov edx, eax
-
 
76
           mov ebx, ecx
-
 
77
 
-
 
78
           shr ecx, 3
-
 
79
           jz .next
-
 
80
 
-
 
81
           and ebx, not 7
-
 
82
           push ebx
-
 
83
           stdcall _alloc_pages, ebx
-
 
84
           pop ecx                   ; yes ecx!!!
-
 
85
           test eax, eax
-
 
86
           jz .err
-
 
87
 
-
 
88
           mov edi, eax
-
 
89
           mov edx, [lin_addr]
-
 
90
@@:
-
 
91
           stdcall map_page,edx,edi,dword PG_SW
-
 
92
           add edx, 0x1000
-
 
93
           add edi, 0x1000
-
 
94
           dec ecx
-
 
95
           jnz @B
-
 
96
.next:
-
 
97
           mov ecx, [pages_count]
-
 
98
           and ecx, 7
-
 
99
           jz .end
-
 
100
@@:
-
 
101
           push ecx
-
 
102
           call _alloc_page
-
 
103
           pop ecx
-
 
104
           test eax, eax
-
 
105
           jz .err
-
 
106
 
-
 
107
           stdcall map_page,edx,eax,dword PG_SW
-
 
108
           add edx, 0x1000
-
 
109
           dec ecx
-
 
110
           jnz @B
-
 
111
.end:
-
 
112
           mov eax, [lin_addr]
-
 
113
           pop edi
-
 
114
           pop ebx
-
 
115
           ret
-
 
116
.err:
-
 
117
           xor eax, eax
-
 
118
           pop edi
-
 
119
           pop ebx
-
 
Line 120... Line 46...
120
           ret
46
endp
121
endp
47
 
Line 122... Line 48...
122
 
48