Changeset c4b3e3e in mainline


Ignore:
Timestamp:
2005-09-03T19:33:52Z (19 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.

Location:
arch
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/_link.ld

    r78665c0 rc4b3e3e  
    1818                *(K_TEXT_START_2);
    1919                unmapped_ktext_end = .;
     20
    2021                unmapped_kdata_start = .;
    2122                *(K_DATA_START);
     
    2324        }
    2425
    25         .mapped (0xffffffff80000000+SIZEOF(.unmapped)+0x8000) : AT (0x8000+SIZEOF(.unmapped)) {
     26        .mapped (0xffffffff80100000+0x8000+SIZEOF(.unmapped)) : AT (0x8000+SIZEOF(.unmapped)) {
    2627                ktext_start = .;
    2728                *(BOOT_DATA);
     
    3839                hardcoded_kdata_size = .;
    3940                QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start));
     41                hardcoded_unmapped_ktext_size = .;
     42                LONG(unmapped_ktext_end - unmapped_ktext_start);
     43                hardcoded_unmapped_kdata_size = .;
     44                LONG(unmapped_kdata_end - unmapped_kdata_start);
    4045                *(COMMON);              /* global variables */
    4146
     
    5156                kdata_end = .;
    5257        }
    53         _map_address = 0xffffffff80000000;
     58        _map_address = 0xffffffff80100000;
     59        _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);
     60
    5461        e820table_boot = e820table - _map_address;
    5562        e820counter_boot = e820counter - _map_address;
  • arch/amd64/include/boot/boot.h

    r78665c0 rc4b3e3e  
    3131
    3232#define BOOTSTRAP_OFFSET                        0x8000
    33 #define BOOT_OFFSET                             0x0
     33#define BOOT_OFFSET                             0x100000
    3434
    3535#define MULTIBOOT_HEADER_MAGIC          0x1BADB002
  • arch/amd64/include/cpuid.h

    r78665c0 rc4b3e3e  
    3030#define __CPUID_H__
    3131
    32 #include <arch/types.h>
    33 
    3432#define AMD_CPUID_EXTENDED 0x80000001
    3533#define AMD_EXT_NOEXECUTE    20
     34
     35#ifndef __ASM__
     36
     37#include <arch/types.h>
    3638
    3739struct cpu_info {
     
    4951extern __u64 rdtsc(void);
    5052
     53#endif /* __ASM__ */
    5154#endif
  • 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
  • arch/ia32/include/boot/boot.h

    r78665c0 rc4b3e3e  
    3131
    3232#define BOOTSTRAP_OFFSET                        0x8000
    33 #define BOOT_OFFSET                                     0x100000
     33#define BOOT_OFFSET                             0x100000
    3434
    3535#define MULTIBOOT_HEADER_MAGIC          0x1BADB002
Note: See TracChangeset for help on using the changeset viewer.