Rev 279 | Rev 285 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 279 | Rev 280 | ||
---|---|---|---|
Line 101... | Line 101... | ||
101 | multiboot_image_start: |
101 | multiboot_image_start: |
102 | movl $BOOTSTRAP_OFFSET - 0x400, %esp # initialize stack pointer |
102 | movl $BOOTSTRAP_OFFSET - 0x400, %esp # initialize stack pointer |
103 | 103 | ||
104 | lgdt protected_bootstrap_gdtr - 0x80000000 # initialize Global Descriptor Table register |
104 | lgdt protected_bootstrap_gdtr - 0x80000000 # initialize Global Descriptor Table register |
105 | 105 | ||
106 | movw $KDATA, %ax |
106 | movw $KDATA, %cx |
107 | movw %ax, %es |
107 | movw %cx, %es |
108 | movw %ax, %gs |
108 | movw %cx, %gs |
109 | movw %ax, %fs |
109 | movw %cx, %fs |
110 | movw %ax, %ds # kernel data + stack |
110 | movw %cx, %ds # kernel data + stack |
111 | movw %ax, %ss |
111 | movw %cx, %ss |
112 | 112 | ||
113 | jmpl $KTEXT, $multiboot_meeting_point + BOOT_OFFSET |
113 | jmpl $KTEXT, $multiboot_meeting_point + BOOT_OFFSET |
114 | multiboot_meeting_point: |
114 | multiboot_meeting_point: |
115 | 115 | ||
- | 116 | pushl %ebx |
|
- | 117 | pushl %eax |
|
- | 118 | ||
116 | call map_kernel # map kernel and turn paging on |
119 | call map_kernel # map kernel and turn paging on |
117 | 120 | ||
- | 121 | popl %eax |
|
- | 122 | popl %ebx |
|
- | 123 | cmpl $MULTIBOOT_LOADER_MAGIC, %eax |
|
- | 124 | je valid_boot |
|
- | 125 | ||
- | 126 | # ... |
|
- | 127 | ||
- | 128 | jmp invalid_boot |
|
- | 129 | ||
- | 130 | valid_boot: |
|
- | 131 | ||
- | 132 | movl (%ebx), %eax |
|
- | 133 | ||
- | 134 | # ... check flags in eax |
|
- | 135 | ||
- | 136 | movl 4(%ebx), %ecx |
|
- | 137 | addl 8(%ebx), %ecx |
|
- | 138 | movl %ecx, e801memorysize |
|
- | 139 | ||
- | 140 | # movl 44(%ebx), %ecx |
|
- | 141 | xorl %ecx, %ecx |
|
- | 142 | movl %ecx, e820counter |
|
- | 143 | # movl 48(%ebx), %esi |
|
- | 144 | # movl $e820table, %edi |
|
- | 145 | # cld |
|
- | 146 | # rep movsb |
|
- | 147 | ||
- | 148 | invalid_boot: |
|
- | 149 | ||
118 | call main_bsp - BOOT_OFFSET # never returns |
150 | call main_bsp - BOOT_OFFSET # never returns |
119 | 151 | ||
120 | cli |
152 | cli |
121 | hlt |
153 | hlt |
122 | 154 |