Changeset c245372b in mainline for arch/amd64/src/boot/boot.S


Ignore:
Timestamp:
2005-08-29T13:56:47Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4dd0704
Parents:
b52da8d7
Message:

Fixed linker script to include .eh_frame section.
It now boots into protected mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/boot/boot.S

    rb52da8d7 rc245372b  
    4040#
    4141kernel_image_start:
     42        cli
     43        xorw %ax,%ax
     44        movw %ax,%ds
     45        movw %ax,%ss            # initialize stack segment register
     46        movl $0x7c00,%esp       # initialize stack pointer
     47       
     48        call memmap_arch_init
     49       
     50        mov $0x80000000, %eax 
     51        cpuid
     52        cmp $0x80000000, %eax   # any function > 80000000h?
     53        jbe no_long_mode
     54        mov $0x80000001, %eax   # Extended function code 80000001
     55        cpuid
     56        bt $29, %edx            # Test if long mode is supported.
     57        jnc no_long_mode
    4258
    43 meeting_point:
    44 .code32
     59# Fill out GDTR.base, IDTR.base
     60        leal gdtr, %eax
     61        movl gdt_addr, %ebx
     62        movl %ebx, 2(%eax)
    4563
     64        movl idt_addr, %ebx
     65        leal idtr, %eax
     66        movl %ebx, 2(%eax)
    4667
    47 .section K_DATA_START
     68# Load gdtr, idtr       
     69        lgdt gdtr
     70        lidt idtr
     71       
     72        mov $1, %eax    # Enable protected mode (CR0.PE = 1)
     73        mov %eax, %cr0
    4874
     75        jmpl $8, $now_in_prot
     76       
     77now_in_prot:
     78       
     79
     80no_long_mode:
     811:
     82        jmp 1b
     83                       
     84
     85.section K_DATA_START   
    4986.align 4096
    5087page_directory:
    5188        .space 4096, 0
     89
     90gdt_addr:       
     91        .quad gdt + 0x80000000
     92idt_addr:       
     93        .quad idt + 0x80000000
Note: See TracChangeset for help on using the changeset viewer.