Subversion Repositories Kolibri OS

Rev

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

Rev 841 Rev 843
Line 53... Line 53...
53
;;
53
;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 55... Line 55...
55
 
55
 
Line 56... Line 56...
56
include 'macros.inc'
56
include 'macros.inc'
Line 57... Line 57...
57
 
57
 
Line 58... Line 58...
58
$Revision: 841 $
58
$Revision: 843 $
Line 291... Line 291...
291
 
291
 
292
MEM_WB     equ 6               ;write-back memory
292
MEM_WB     equ 6               ;write-back memory
293
MEM_WC     equ 1               ;write combined memory
293
MEM_WC     equ 1               ;write combined memory
Line 294... Line -...
294
MEM_UC     equ 0               ;uncached memory
-
 
295
 
-
 
296
align 4
-
 
297
init_mem:
-
 
298
 
-
 
299
           mov ecx, [BOOT_VAR + 0x9100]
-
 
300
           mov esi, BOOT_VAR + 0x9104
-
 
301
           xor eax, eax
-
 
302
@@:
-
 
303
           cmp dword [esi+16], 1
-
 
304
           jne .next
-
 
305
           mov edx, [esi+8]
-
 
306
           cmp eax, [esi+8]
-
 
307
           ja .next
-
 
308
 
-
 
309
           mov eax, [esi+8]
-
 
310
.next:
-
 
311
           add esi, 20
-
 
312
           loop @B
-
 
313
 
-
 
314
           and eax, -4096
-
 
315
 
-
 
316
           mov [MEM_AMOUNT], eax
-
 
317
           mov [pg_data.mem_amount], eax
-
 
318
 
-
 
319
           shr eax, 12
-
 
320
           mov edx, eax
-
 
321
           mov [pg_data.pages_count], eax
-
 
322
           shr eax, 3
-
 
323
           and eax, -4
-
 
324
           mov [pg_data.pagemap_size], eax
-
 
325
           mov ecx, eax
-
 
326
           fastcall _balloc
-
 
327
           ret
-
 
328
 
-
 
329
align 4
-
 
330
init_page_map:
-
 
331
 
-
 
332
           mov edi, sys_pgmap
-
 
333
           mov ecx, [pg_data.pagemap_size]
-
 
334
           shr ecx, 2
-
 
335
           or eax, -1
-
 
336
           cld
-
 
337
           rep stosd
-
 
338
 
-
 
339
           xchg bx, bx
-
 
340
 
-
 
341
           mov ecx, [_last_page]
-
 
342
           mov edx, [pg_data.pages_count]
-
 
343
           shr ecx, 12
-
 
344
           sub edx, ecx
-
 
345
           mov [pg_data.pages_free], edx
-
 
346
 
-
 
347
           mov edi, sys_pgmap
-
 
348
           mov ebx, ecx
-
 
349
           shr ecx, 5
-
 
Line 350... Line -...
350
           xor eax, eax
-
 
351
           rep stosd
294
MEM_UC     equ 0               ;uncached memory
352
 
-
 
353
           not eax
-
 
354
           mov ecx, ebx
-
 
355
           and ecx, 31
-
 
356
           shl eax, cl
-
 
357
           mov [edi], eax
-
 
358
           mov [page_start], edi;
-
 
359
 
-
 
360
           mov ebx, sys_pgmap
-
 
361
           add ebx, [pg_data.pagemap_size]
-
 
362
           mov [page_end], ebx
-
 
Line 363... Line 295...
363
 
295
 
364
           mov [pg_data.pg_mutex], 0
296
 
365
           ret
297
include 'core/mm.asm'
Line 396... Line 328...
396
	   mov cr3, eax 	  ; flush TLB
328
	   mov cr3, eax 	  ; flush TLB
Line 397... Line 329...
397
 
329
 
Line 398... Line -...
398
 
-
 
399
; MEMORY MODEL
-
 
400
 
330
 
401
           call init_mem
331
; MEMORY MODEL
402
 
332
 
Line 403... Line 333...
403
           mov ecx, 1280*1024
333
           mov ecx, 1280*1024
Line 435... Line 365...
435
	   mov	ax,tss0
365
	   mov	ax,tss0
436
	   ltr	ax
366
	   ltr	ax
Line 437... Line 367...
437
 
367
 
Line 438... Line 368...
438
           call init_kernel_heap     ; FIXME initialize heap after pager
368
           call init_kernel_heap     ; FIXME initialize heap after pager
439
 
-
 
-
 
369
 
Line 440... Line 370...
440
           call init_page_map
370
           call _init_mm
441
 
371
           mov [pg_data.pg_mutex], 0
442
 
372
 
443
; SAVE REAL MODE VARIABLES
373
; SAVE REAL MODE VARIABLES