Subversion Repositories Kolibri OS

Rev

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

Rev 1952 Rev 2047
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. 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: 1952 $
8
$Revision: 2047 $
9
 
9
 
10
 
10
 
Line 51... Line 51...
51
 
51
 
52
; ======================================================================
52
; ======================================================================
53
align 4
53
align 4
Line -... Line 54...
-
 
54
proc init_mem
-
 
55
 
-
 
56
	   mov	ecx, 0xC001001A 			; Top of Memory MSR
54
proc init_mem
57
	   xor	edi, edi
-
 
58
	   rdmsr
-
 
59
	   mov	esi, eax				; esi = total amount of memory
-
 
60
	   mov	ecx, 0x0200
-
 
61
.read_mtrr:
-
 
62
	   rdmsr
-
 
63
	   and	eax, 0xFFF00000 			; not just bitcleaning
-
 
64
	   jz	.next_mtrr				; ignore the main memory and free MTRRs
-
 
65
	   cmp	esi, eax
-
 
66
	   jb	.next_mtrr				; ignore MMIO blocks
-
 
67
	   mov	esi, eax
-
 
68
.next_mtrr:
-
 
69
	   add	cl, 2
-
 
70
	   cmp	cl, 0x10
-
 
71
	   jb	.read_mtrr
55
 
72
 
-
 
73
	   mov	eax, USER_DMA_SIZE
-
 
74
	   sub	esi, eax				; exclude the Global DMA block...
-
 
75
	   and	esi, 0xFF800000 			; ...and the hole above it
-
 
76
	   mov	eax, esi
-
 
77
	   mov	[MEM_AMOUNT-OS_BASE], eax
Line 56... Line -...
56
	   mov esi, (PCIe_CONFIG_SPACE-OS_BASE) 	; esi will hold total amount of memory
-
 
57
	   mov edx, esi 				; edx will hold maximum allocatable address
78
	   mov	[pg_data.mem_amount-OS_BASE], eax	; the true MEMTOP
58
 
79
	   mov	[UserDMAaddr-OS_BASE], eax
59
	   mov [MEM_AMOUNT-OS_BASE], esi
80
 
Line 60... Line 81...
60
	   mov [pg_data.mem_amount-OS_BASE], esi
81
	   mov edx, esi 				; edx will hold maximum allocatable address
61
	   shr esi, 12
82
	   shr esi, 12