Subversion Repositories Kolibri OS

Rev

Rev 1941 | Rev 2047 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1941 Rev 1952
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: 1941 $
8
$Revision: 1952 $
9
 
9
 
10
 
10
 
Line 11... Line 11...
11
MEM_WB	   equ 6	       ;write-back memory
11
MEM_WB	   equ 6	       ;write-back memory
12
MEM_WC	   equ 1	       ;write combined memory
12
MEM_WC	   equ 1	       ;write combined memory
13
MEM_UC	   equ 0	       ;uncached memory
13
MEM_UC	   equ 0	       ;uncached memory
Line 14... Line 14...
14
 
14
 
15
; ======================================================================
15
; ======================================================================
16
align 4
16
align 4
17
preinit_mem:
17
preinit_mem:
18
 
18
 
19
; clear [0x280000..HEAP_BASE]
19
; clear [CLEAN_ZONE..HEAP_BASE]
Line 20... Line 20...
20
	   xor	 eax,eax
20
	   xor	 eax,eax
Line 33... Line 33...
33
	   mov	 ecx, (uglobals_size/4)+4
33
	   mov	 ecx, (uglobals_size/4)+4
34
	   rep	 stosd
34
	   rep	 stosd
Line 35... Line 35...
35
 
35
 
36
; save [0..0xffff]
36
; save [0..0xffff]
37
	   xor	 esi, esi
37
	   xor	 esi, esi
38
	   mov	 edi,(BOOT_VAR-OS_BASE) 		; low mem storage area
38
	   mov	 edi, (BOOT_VAR	- OS_BASE)		; low mem storage area
39
	   mov	 ecx, 0x10000 / 4
39
	   mov	 ecx, 0x10000 / 4
40
	   rep	 movsd
40
	   rep	 movsd
41
; clear [0x1000..0x0ffff]
41
; clear [0x1000..0x0ffff]
42
	   mov	 edi,0x1000
42
	   mov	 edi,0x1000
Line 81... Line 81...
81
	   mov ebx, cr4
81
	   mov ebx, cr4
82
	   or  ebx, CR4_PSE
82
	   or  ebx, CR4_PSE
83
	   mov eax, PG_LARGE+PG_SW
83
	   mov eax, PG_LARGE+PG_SW
84
	   mov cr4, ebx
84
	   mov cr4, ebx
85
	   dec [pg_data.kernel_tables-OS_BASE]
85
	   dec [pg_data.kernel_tables-OS_BASE]
86
	   sub [pg_data.kernel_pages -OS_BASE], 1024	; 1 large page = 1024 ordinary pages
-
 
Line 87... Line 86...
87
 
86
 
88
	   mov [edx], eax				; map first (physical) 4M bytes
87
	   mov [edx], eax				; map first (physical) 4M bytes
Line 89... Line 88...
89
	   add edx, 4
88
	   add edx, 4
90
 
89
 
91
	   mov edi, [tmp_page_tabs]
-
 
92
	   mov ecx, [pg_data.kernel_pages -OS_BASE]	; map the rest of kernel space
-
 
93
	   mov eax, 0x00400000+PG_SW
-
 
94
.map_kernel_pages:
90
	   mov edi, [tmp_page_tabs]
95
	   stosd
91
	   mov ecx, [pg_data.kernel_pages -OS_BASE]	; safety cleaning of already-zeroed space
96
	   add	eax, 4096
-
 
Line 97... Line 92...
97
	   dec	ecx
92
	   xor eax, eax
98
	   jnz	.map_kernel_pages
93
	   rep stosd
99
 
94
 
100
	   mov ecx, [pg_data.kernel_tables-OS_BASE]	; build some PDEs to hold empty PTEs
95
	   mov ecx, [pg_data.kernel_tables-OS_BASE]	; build some PDEs to hold empty PTEs
-
 
96
	   mov eax, [tmp_page_tabs]
101
	   mov eax, [tmp_page_tabs]
97
	   or  eax, PG_SW
102
	   or  eax, PG_SW
98
	   mov edi, edx 		; edi = sys_pgdir+0x804
103
	   mov edi, edx 		; edi = sys_pgdir+0x804
99
 
104
.map_kernel_tabs:
100
.map_kernel_tabs:
105
	   stosd
101
	   stosd