Rev 347 | Rev 406 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 347 | Rev 371 | ||
---|---|---|---|
Line 211... | Line 211... | ||
211 | 211 | ||
212 | .global map_kernel |
212 | .global map_kernel |
213 | map_kernel: |
213 | map_kernel: |
214 | # |
214 | # |
215 | # Here we setup mapping for both the unmapped and mapped sections of the kernel. |
215 | # Here we setup mapping for both the unmapped and mapped sections of the kernel. |
216 | # For simplicity, we set only one 4M page for 0x00000000 and one for 0x80000000. |
216 | # For simplicity, we map the entire 4G space. |
217 | # |
217 | # |
218 | movl %cr4, %ecx |
218 | movl %cr4, %ecx |
219 | orl $(1<<4), %ecx |
219 | orl $(1<<4), %ecx |
220 | movl %ecx, %cr4 # turn PSE on |
220 | movl %ecx, %cr4 # turn PSE on |
221 | 221 | ||
- | 222 | movl $(page_directory+0), %esi |
|
- | 223 | movl $(page_directory+2048), %edi |
|
- | 224 | xorl %ecx, %ecx |
|
- | 225 | xorl %ebx, %ebx |
|
- | 226 | 0: |
|
222 | movl $((1<<7)|(1<<0)), %eax |
227 | movl $((1<<7)|(1<<0)), %eax |
- | 228 | orl %ebx, %eax |
|
- | 229 | movl %eax, (%esi,%ecx,4) # mapping 0x00000000+%ecx*4M => 0x00000000+%ecx*4M |
|
223 | movl %eax, page_directory # mapping 0x00000000 => 0x00000000 |
230 | movl %eax, (%edi,%ecx,4) # mapping 0x80000000+%ecx*4M => 0x00000000+%ecx*4M |
- | 231 | addl $(4*1024*1024), %ebx |
|
224 | 232 | ||
225 | movl $(page_directory+2048), %edx |
233 | incl %ecx |
226 | movl %eax, (%edx) # mapping 0x80000000 => 0x00000000 |
234 | cmpl $512, %ecx |
- | 235 | jl 0b |
|
227 | 236 | ||
228 | leal page_directory, %eax |
- | |
229 | movl %eax, %cr3 |
237 | movl %esi, %cr3 |
230 | 238 | ||
231 | # turn paging on |
239 | # turn paging on |
232 | movl %cr0, %ebx |
240 | movl %cr0, %ebx |
233 | orl $(1<<31), %ebx |
241 | orl $(1<<31), %ebx |
234 | movl %ebx, %cr0 |
242 | movl %ebx, %cr0 |