Rev 95 | Rev 110 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 95 | Rev 105 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | # Protected mode tables are statically initialised during compile |
37 | # Protected mode tables are statically initialised during compile |
38 | # time. So we can just load the respective table registers and |
38 | # time. So we can just load the respective table registers and |
39 | # switch to protected mode. |
39 | # switch to protected mode. |
40 | # |
40 | # |
41 | kernel_image_start: |
41 | kernel_image_start: |
42 | call memmap_arch_init |
- | |
43 | cli |
42 | cli |
- | 43 | call memmap_arch_init |
|
44 | xorw %ax,%ax |
44 | xorw %ax,%ax |
45 | movw %ax,%ds |
45 | movw %ax,%ds |
46 | lgdt gdtr |
46 | lgdt gdtr |
47 | movl %cr0,%eax |
47 | movl %cr0,%eax |
48 | orl $0x1,%eax |
48 | orl $0x1,%eax |
Line 60... | Line 60... | ||
60 | meeting_point: |
60 | meeting_point: |
61 | .code32 |
61 | .code32 |
62 | 62 | ||
63 | lidt idtr |
63 | lidt idtr |
64 | 64 | ||
- | 65 | # |
|
- | 66 | # Here we setup mapping for both the unmapped and mapped sections of the kernel. |
|
- | 67 | # For simplicity, we set only one 4M page for 0x00000000 and one for 0x80000000. |
|
- | 68 | # |
|
- | 69 | movl %cr4, %ecx |
|
- | 70 | orl $(1<<4), %ecx |
|
65 | call main_bsp # never returns |
71 | movl %ecx, %cr4 # turn PSE on |
- | 72 | ||
- | 73 | movl $((1<<7)|(1<<0)), %eax |
|
- | 74 | movl %eax, page_directory # mapping 0x00000000 => 0x00000000 |
|
- | 75 | ||
- | 76 | movl $(page_directory+(4096/2)), %edx |
|
- | 77 | movl %eax, (%edx) # mapping 0x80000000 => 0x00000000 |
|
- | 78 | ||
- | 79 | leal page_directory, %eax |
|
- | 80 | movl %eax, %cr3 |
|
66 | 81 | ||
- | 82 | # turn on paging |
|
- | 83 | movl %cr0, %ebx |
|
- | 84 | orl $(1<<31), %ebx |
|
- | 85 | movl %ebx, %cr0 |
|
- | 86 | ||
- | 87 | movl $_hardcoded_ktext_size, hardcoded_ktext_size |
|
- | 88 | movl $_hardcoded_kdata_size, hardcoded_kdata_size |
|
- | 89 | movl $_hardcoded_load_address, hardcoded_load_address |
|
- | 90 | ||
- | 91 | call main_bsp # never returns |
|
67 | 92 | ||
68 | cli |
93 | cli |
69 | hlt |
94 | hlt |
- | 95 | ||
- | 96 | .section K_DATA_START |
|
- | 97 | ||
- | 98 | .align 4096 |
|
- | 99 | page_directory: |
|
- | 100 | .space 4096, 0 |