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


Ignore:
Timestamp:
2005-09-03T19:33:52Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c835e7c
Parents:
78665c0
Message:

Moved AMD64 kernel above 1MB.

File:
1 edited

Legend:

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

    r78665c0 rc4b3e3e  
    3333#include <arch/pm.h>
    3434#include <arch/cpu.h>
     35#include <arch/cpuid.h>
     36#include <arch/boot/boot.h>
    3537
    36 #define START_STACK     0x7c00 
    3738#define START_STACK_64  0xffffffff80007c00
    3839                                       
     
    4546# switch to protected mode.
    4647#
     48
     49#define START_STACK (BOOTSTRAP_OFFSET-0x400)
     50       
    4751.section K_TEXT_START
    4852.code16
     
    5357        movw %ax,%ds
    5458        movw %ax,%ss            # initialize stack segment register
    55         movl $(START_STACK),%esp        # initialize stack pointer
     59        movl $(START_STACK), %esp       # initialize stack pointer
    5660       
    5761        call memmap_arch_init
     
    6165        cmp $0x80000000, %eax   # any function > 80000000h?
    6266        jbe no_long_mode
    63         movl $0x80000001, %eax  # Extended function code 80000001
     67        movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001
    6468        cpuid
    6569        bt $29, %edx            # Test if long mode is supported.
     
    8993        movw %ax, %ss
    9094
     95        movb $0xd1, %al         # enable A20 using the keyboard controller
     96        outb %al, $0x64
     97        movb $0xdf, %al
     98        outb %al, $0x60
     99
     100       
    91101        # Enable 64-bit page transaltion entries - CR4.PAE = 1.
    92102        # Paging is not enabled until after long mode is enabled
     
    98108        leal ptl_0, %eax
    99109        movl %eax, %cr3
    100                
     110       
    101111        # Enable long mode
    102112        movl $EFER_MSR_NUM, %ecx   # EFER MSR number
     
    115125.code64
    116126start64:
    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
    118135       
    119136        call main_bsp   # never returns
     
    154171bsp_bootstrap_gdtr:
    155172        .word gdtselector(GDT_ITEMS)
    156         .long KA2PA(gdt)
     173        .long KA2PA(gdt)-BOOT_OFFSET
    157174
    158175.global ap_bootstrap_gdtr
    159176ap_bootstrap_gdtr:
    160177        .word gdtselector(GDT_ITEMS)
    161         .long KA2PA(gdt)
     178        .long KA2PA(gdt)-BOOT_OFFSET
Note: See TracChangeset for help on using the changeset viewer.