Rev 176 | Rev 216 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 176 | Rev 177 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | movw %ax,%ss # initialize stack segment register |
45 | movw %ax,%ss # initialize stack segment register |
46 | movl $0x7c00,%esp # initialize stack pointer |
46 | movl $0x7c00,%esp # initialize stack pointer |
47 | 47 | ||
48 | call memmap_arch_init |
48 | call memmap_arch_init |
49 | 49 | ||
- | 50 | lgdt gdtr # initialize Global Descriptor Table register |
|
- | 51 | lidt idtr # initialize Interrupt Descriptor Table register |
|
50 | lgdt gdtr |
52 | |
51 | movl %cr0,%eax |
53 | movl %cr0,%eax |
52 | orl $0x1,%eax |
54 | orl $0x1,%eax |
53 | movl %eax,%cr0 |
55 | movl %eax,%cr0 # switch to protected mode |
54 | jmpl $8,$meeting_point |
56 | jmpl $8,$meeting_point |
55 | meeting_point: |
57 | meeting_point: |
56 | .code32 |
58 | .code32 |
57 | 59 | ||
58 | movw $16,%ax |
60 | movw $16,%ax |
Line 60... | Line 62... | ||
60 | movw %ax,%gs |
62 | movw %ax,%gs |
61 | movw %ax,%fs |
63 | movw %ax,%fs |
62 | movw %ax,%ds # kernel data + stack |
64 | movw %ax,%ds # kernel data + stack |
63 | movw %ax,%ss |
65 | movw %ax,%ss |
64 | 66 | ||
65 | lidt idtr |
- | |
66 | - | ||
67 | call map_kernel |
67 | call map_kernel # map kernel and turn paging on |
68 | 68 | ||
69 | movl $_hardcoded_ktext_size, hardcoded_ktext_size |
69 | movl $_hardcoded_ktext_size, hardcoded_ktext_size |
70 | movl $_hardcoded_kdata_size, hardcoded_kdata_size |
70 | movl $_hardcoded_kdata_size, hardcoded_kdata_size |
71 | movl $_hardcoded_load_address, hardcoded_load_address |
71 | movl $_hardcoded_load_address, hardcoded_load_address |
72 | 72 | ||
Line 92... | Line 92... | ||
92 | movl %eax, (%edx) # mapping 0x80000000 => 0x00000000 |
92 | movl %eax, (%edx) # mapping 0x80000000 => 0x00000000 |
93 | 93 | ||
94 | leal page_directory, %eax |
94 | leal page_directory, %eax |
95 | movl %eax, %cr3 |
95 | movl %eax, %cr3 |
96 | 96 | ||
97 | # turn on paging |
97 | # turn paging on |
98 | movl %cr0, %ebx |
98 | movl %cr0, %ebx |
99 | orl $(1<<31), %ebx |
99 | orl $(1<<31), %ebx |
100 | movl %ebx, %cr0 |
100 | movl %ebx, %cr0 |
101 | ret |
101 | ret |
102 | 102 |