Changeset c4b3e3e in mainline for arch/amd64/src/boot/boot.S
- Timestamp:
- 2005-09-03T19:33:52Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c835e7c
- Parents:
- 78665c0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/boot/boot.S
r78665c0 rc4b3e3e 33 33 #include <arch/pm.h> 34 34 #include <arch/cpu.h> 35 #include <arch/cpuid.h> 36 #include <arch/boot/boot.h> 35 37 36 #define START_STACK 0x7c0037 38 #define START_STACK_64 0xffffffff80007c00 38 39 … … 45 46 # switch to protected mode. 46 47 # 48 49 #define START_STACK (BOOTSTRAP_OFFSET-0x400) 50 47 51 .section K_TEXT_START 48 52 .code16 … … 53 57 movw %ax,%ds 54 58 movw %ax,%ss # initialize stack segment register 55 movl $(START_STACK), %esp # initialize stack pointer59 movl $(START_STACK), %esp # initialize stack pointer 56 60 57 61 call memmap_arch_init … … 61 65 cmp $0x80000000, %eax # any function > 80000000h? 62 66 jbe no_long_mode 63 movl $ 0x80000001, %eax# Extended function code 8000000167 movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001 64 68 cpuid 65 69 bt $29, %edx # Test if long mode is supported. … … 89 93 movw %ax, %ss 90 94 95 movb $0xd1, %al # enable A20 using the keyboard controller 96 outb %al, $0x64 97 movb $0xdf, %al 98 outb %al, $0x60 99 100 91 101 # Enable 64-bit page transaltion entries - CR4.PAE = 1. 92 102 # Paging is not enabled until after long mode is enabled … … 98 108 leal ptl_0, %eax 99 109 movl %eax, %cr3 100 110 101 111 # Enable long mode 102 112 movl $EFER_MSR_NUM, %ecx # EFER MSR number … … 115 125 .code64 116 126 start64: 117 movq $(START_STACK_64), %rsp 127 movq $(PA2KA(START_STACK)), %rsp 128 129 # Copy kernel to higher physical memory 130 movq $BOOTSTRAP_OFFSET, %rsi 131 movq $BOOTSTRAP_OFFSET + BOOT_OFFSET, %rdi 132 movq $_hardcoded_kernel_size, %rcx 133 cld 134 rep movsb 118 135 119 136 call main_bsp # never returns … … 154 171 bsp_bootstrap_gdtr: 155 172 .word gdtselector(GDT_ITEMS) 156 .long KA2PA(gdt) 173 .long KA2PA(gdt)-BOOT_OFFSET 157 174 158 175 .global ap_bootstrap_gdtr 159 176 ap_bootstrap_gdtr: 160 177 .word gdtselector(GDT_ITEMS) 161 .long KA2PA(gdt) 178 .long KA2PA(gdt)-BOOT_OFFSET
Note:
See TracChangeset
for help on using the changeset viewer.