Rev 680 | Rev 694 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 680 | Rev 685 | ||
|---|---|---|---|
| Line 47... | Line 47... | ||
| 47 | #define START_STACK (BOOTSTRAP_OFFSET-0x400) |
47 | #define START_STACK (BOOTSTRAP_OFFSET-0x400) |
| 48 | 48 | ||
| 49 | .section K_TEXT_START, "ax" |
49 | .section K_TEXT_START, "ax" |
| 50 | .code16 |
50 | .code16 |
| 51 | .global kernel_image_start |
51 | .global kernel_image_start |
| - | 52 | .global multiboot_image_start |
|
| 52 | kernel_image_start: |
53 | kernel_image_start: |
| 53 | cli |
54 | cli |
| 54 | xorw %ax,%ax |
55 | xorw %ax,%ax |
| 55 | movw %ax,%ds |
56 | movw %ax,%ds |
| 56 | movw %ax,%es |
57 | movw %ax,%es |
| Line 93... | Line 94... | ||
| 93 | .long 0 |
94 | .long 0 |
| 94 | .long multiboot_image_start + BOOT_OFFSET |
95 | .long multiboot_image_start + BOOT_OFFSET |
| 95 | 96 | ||
| 96 | multiboot_image_start: |
97 | multiboot_image_start: |
| 97 | movl $START_STACK, %esp # initialize stack pointer |
98 | movl $START_STACK, %esp # initialize stack pointer |
| - | 99 | ||
| - | 100 | lgdt protected_bootstrap_gdtr + BOOT_OFFSET # initialize Global Descriptor Table register |
|
| - | 101 | ||
| - | 102 | movw $gdtselector(KDATA_DES), %cx |
|
| - | 103 | movw %cx, %es |
|
| - | 104 | movw %cx, %gs |
|
| 98 | # FIXME TODO |
105 | movw %cx, %fs |
| - | 106 | movw %cx, %ds # kernel data + stack |
|
| - | 107 | movw %cx, %ss |
|
| - | 108 | ||
| - | 109 | jmpl $gdtselector(KTEXT_DES), $multiboot_meeting_point + BOOT_OFFSET |
|
| - | 110 | multiboot_meeting_point: |
|
| - | 111 | ||
| - | 112 | hlt |
|
| 99 | 113 | ||
| 100 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
114 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
| 101 | # the Default operand size must not be 1 when entering long mode |
115 | # the Default operand size must not be 1 when entering long mode |
| 102 | now_in_prot: |
116 | now_in_prot: |
| 103 | # Set up stack & data descriptors |
117 | # Set up stack & data descriptors |
| Line 206... | Line 220... | ||
| 206 | 220 | ||
| 207 | .global real_bootstrap_gdtr_boot |
221 | .global real_bootstrap_gdtr_boot |
| 208 | real_bootstrap_gdtr_boot: |
222 | real_bootstrap_gdtr_boot: |
| 209 | .word gdtselector(GDT_ITEMS) |
223 | .word gdtselector(GDT_ITEMS) |
| 210 | .long KA2PA(gdt)-BOOT_OFFSET |
224 | .long KA2PA(gdt)-BOOT_OFFSET |
| - | 225 | ||
| - | 226 | .global protected_bootstrap_gdtr |
|
| - | 227 | protected_bootstrap_gdtr: |
|
| - | 228 | .word gdtselector(GDT_ITEMS) |
|
| - | 229 | .long KA2PA(gdt) |
|