Subversion Repositories Kolibri OS

Rev

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

Rev 172 Rev 188
Line 117... Line 117...
117
proc create_app_space stdcall, app_size:dword,img_size:dword
117
proc create_app_space stdcall, app_size:dword,img_size:dword
118
           locals
118
           locals
119
             app_pages   dd ?
119
             app_pages   dd ?
120
             img_pages   dd ?
120
             img_pages   dd ?
121
             dir_addr    dd ?
121
             dir_addr    dd ?
122
             master_addr dd ?
-
 
123
             app_tabs    dd ?
122
             app_tabs    dd ?
124
           endl
123
           endl
Line 125... Line 124...
125
 
124
 
Line 126... Line 125...
126
           stdcall wait_mutex, pg_data.pg_mutex
125
           stdcall wait_mutex, pg_data.pg_mutex
127
 
126
 
128
           xor eax, eax
-
 
Line 129... Line 127...
129
           mov [dir_addr], eax
127
           xor eax, eax
130
           mov [master_addr], eax
128
           mov [dir_addr], eax
131
 
129
 
132
           mov eax, [app_size]
130
           mov eax, [app_size]
Line 177... Line 175...
177
 
175
 
178
           mov ecx, 256
176
           mov ecx, 256
179
           mov esi, sys_pgdir+0xc00
177
           mov esi, sys_pgdir+0xc00
Line 180... Line -...
180
           rep movsd
-
 
181
 
-
 
182
           call alloc_page
-
 
183
           test eax, eax
-
 
184
           jz .fail
-
 
185
           mov [master_addr], eax
-
 
186
           stdcall map_page,[tmp_task_ptab],eax,dword PG_SW
-
 
187
 
-
 
188
           mov ecx, 384
-
 
189
           mov edi, [tmp_task_ptab]
-
 
190
           mov esi, master_tab
-
 
191
           cld
-
 
192
           rep movsd
-
 
193
 
-
 
194
           mov ecx, 384
-
 
195
           xor eax, eax
-
 
196
           rep stosd
-
 
197
 
-
 
198
           mov ecx, 256
-
 
199
           mov esi, master_tab+0xc00
-
 
200
           rep movsd
178
           rep movsd
201
 
179
 
202
           mov eax, [master_addr]
180
           mov eax, [dir_addr]
203
           or eax, PG_SW
181
           or eax, PG_SW
204
           mov ebx, [tmp_task_pdir]
-
 
205
           mov [ebx+0x600], eax
-
 
Line 206... Line 182...
206
           mov ecx, [tmp_task_ptab]
182
           mov ebx, [tmp_task_pdir]
207
           mov [ecx+0x600],eax
183
           mov [ebx+0x600], eax
Line 208... Line 184...
208
 
184
 
Line 214... Line 190...
214
@@:
190
@@:
215
           call alloc_page
191
           call alloc_page
216
           test eax, eax
192
           test eax, eax
217
           jz .fail
193
           jz .fail
Line 218... Line 194...
218
 
194
 
219
           stdcall map_page_table,[tmp_task_pdir], edi, eax
195
           stdcall map_page_table, edi, eax
220
           add edi, 0x00400000
196
           add edi, 0x00400000
221
           dec edx
197
           dec edx
Line 222... Line 198...
222
           jnz @B
198
           jnz @B
Line 228... Line 204...
228
           shl ecx, 10
204
           shl ecx, 10
229
           xor eax, eax
205
           xor eax, eax
230
           rep stosd
206
           rep stosd
Line 231... Line 207...
231
 
207
 
232
           mov edx, new_app_base
-
 
233
 
208
           mov edx, new_app_base
234
.alloc:
209
.alloc:
235
           call alloc_page
210
           call alloc_page
236
           test eax, eax
211
           test eax, eax
Line 260... Line 235...
260
           shr ecx, 2
235
           shr ecx, 2
261
           xor eax, eax
236
           xor eax, eax
262
           cld
237
           cld
263
           rep stosd
238
           rep stosd
Line 264... Line -...
264
 
-
 
265
           stdcall map_page,[tmp_task_ptab],dword 0,dword PG_UNMAP
239
 
Line 266... Line 240...
266
           stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP
240
           stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP
267
 
241
 
268
           dec [pg_data.pg_mutex]
242
           dec [pg_data.pg_mutex]
Line 342... Line 316...
342
 
316
 
343
           mov eax, [pg_dir]
317
           mov eax, [pg_dir]
344
           and eax, not 0xFFF
318
           and eax, not 0xFFF
345
           stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
319
           stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
346
           mov esi, [tmp_task_pdir]
320
           mov esi, [tmp_task_pdir]
347
           add esi, 0x600
-
 
348
           mov eax, [esi]
-
 
349
           call free_page   ;destroy master table
-
 
350
           add esi, 4
321
           add esi, 0x604
351
           mov edi, 383
322
           mov edi, 383
352
.destroy:
323
.destroy:
353
           mov eax, [esi]
324
           mov eax, [esi]
354
           test eax, 1
325
           test eax, 1