Changeset 8725fb4 in mainline


Ignore:
Timestamp:
2006-01-08T18:11:20Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46d26ee
Parents:
66def8d
Message:

break AMD64, will be fixed soon

Location:
arch/amd64
Files:
5 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/Makefile.inc

    r66def8d r8725fb4  
    7878        arch/$(ARCH)/src/fpu_context.c \
    7979        arch/$(ARCH)/src/boot/boot.S \
    80         arch/$(ARCH)/src/boot/memmap.S \
    8180        arch/$(ARCH)/src/pm.c \
    8281        arch/$(ARCH)/src/context.S \
  • arch/amd64/_link.ld.in

    r66def8d r8725fb4  
    1313#include <arch/mm/page.h>
    1414
    15 ENTRY(kernel_image_start)
    16 
    1715SECTIONS {
    18         .unmapped BOOTSTRAP_OFFSET: AT (BOOTSTRAP_OFFSET) {
     16        .unmapped BOOT_OFFSET: AT (0) {
    1917                unmapped_ktext_start = .;
    2018                *(K_TEXT_START);
    21                 *(K_TEXT_START_2);
    2219                unmapped_ktext_end = .;
    2320
     
    2724        }
    2825
    29         .mapped (PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET)+SIZEOF(.unmapped)) : AT (BOOTSTRAP_OFFSET+SIZEOF(.unmapped)) {
     26        .mapped (PA2KA(BOOT_OFFSET)+SIZEOF(.unmapped)) : AT (SIZEOF(.unmapped)) {
    3027                ktext_start = .;
    31                 *(BOOT_DATA);
    3228                *(.text);
    3329                ktext_end = .;
     
    3733                *(.rodata*);            /* string literals */
    3834                hardcoded_load_address = .;
    39                 QUAD(PA2KA(BOOT_OFFSET+BOOTSTRAP_OFFSET));
     35                QUAD(PA2KA(BOOT_OFFSET));
    4036                hardcoded_ktext_size = .;
    4137                QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start));
     
    5753                kdata_end = .;
    5854        }
    59 
    60         _hardcoded_kernel_size = (ktext_end - ktext_start) + (unmapped_ktext_end - unmapped_ktext_start) + (kdata_end - kdata_start) + (unmapped_kdata_end - unmapped_kdata_start);
    61 
    62         /* Symbols that need to be accessed both from real mode & long mode */
    63         /* e820*_boot is real mode (pre-above-1MB-move), e820* is */
    64         /* kernel mapped above-1MB-physical copied symbol */
    65         e820table_boot = KA2PA(e820table) - BOOT_OFFSET;
    66         e820counter_boot = KA2PA(e820counter) - BOOT_OFFSET;
    67 
    68         /* real_bootstrap_gdtr is mapped real_bootstrap_gdtr_boot */
    69         /* It is physically outside of kernel area, we have to access */
    70         /* it after modification from long mode for booting */
    71         /* SMP slave processors */
    72         real_bootstrap_gdtr = PA2KA(real_bootstrap_gdtr_boot);
    7355}
  • arch/amd64/include/boot/boot.h

    r66def8d r8725fb4  
    3030#define __amd64_BOOT_H__
    3131
    32 #define BOOTSTRAP_OFFSET                        0x8000
    33 #define BOOT_OFFSET                             0x100000
     32#define BOOT_OFFSET                     0x108000
     33#define AP_BOOT_OFFSET          0x8000
     34#define BOOT_STACK_SIZE 0x400
    3435
    3536#define MULTIBOOT_HEADER_MAGIC          0x1BADB002
  • arch/amd64/src/boot/boot.S

    r66def8d r8725fb4  
    3434#include <arch/boot/boot.h>
    3535
     36#define START_STACK     (BOOT_OFFSET - BOOT_STACK_SIZE)
    3637#define START_STACK_64  0xffffffff80007c00
    37                                        
    38 #
    39 # This is where we require any SPARTAN-kernel-compatible boot loader
    40 # to pass control in real mode.
    41 #
    42 # Protected mode tables are statically initialised during compile
    43 # time. So we can just load the respective table registers and
    44 # switch to protected mode.
    45 #
    46 
    47 #define START_STACK (BOOTSTRAP_OFFSET-0x400)
    4838       
    4939.section K_TEXT_START, "ax"
    50 .code16
    51 .global kernel_image_start
    52 .global multiboot_image_start
    53 kernel_image_start:
    54         cli
    55         xorw %ax,%ax
    56         movw %ax,%ds
    57         movw %ax,%es
    58         movw %ax,%ss            # initialize stack segment register
    59         movl $(START_STACK), %esp       # initialize stack pointer
    60        
    61         call memmap_arch_init
    62        
    63         movl $0x80000000, %eax 
    64         cpuid
    65         cmp $0x80000000, %eax   # any function > 80000000h?
    66         jbe no_long_mode
    67         movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001
    68         cpuid
    69         bt $29, %edx            # Test if long mode is supported.
    70         jnc no_long_mode
    71 
    72         # Load gdtr, idtr
    73         lgdt real_bootstrap_gdtr_boot
    74        
    75         movl %cr0,%eax
    76         orl $0x1,%eax
    77         movl %eax,%cr0                  # switch to protected mode
    78 
    79         jmpl $gdtselector(KTEXT32_DES), $now_in_prot
    80 
    81 no_long_mode:
    82 1:
    83         jmp 1b
    84        
     40# .code16
     41# .global kernel_image_start
     42# .global multiboot_image_start
     43# kernel_image_start:
     44#       cli
     45#       xorw %ax,%ax
     46#       movw %ax,%ds
     47#       movw %ax,%es
     48#       movw %ax,%ss            # initialize stack segment register
     49#       movl $(START_STACK), %esp       # initialize stack pointer
     50#      
     51#       call memmap_arch_init
     52#      
     53#       movl $0x80000000, %eax 
     54#       cpuid
     55#       cmp $0x80000000, %eax   # any function > 80000000h?
     56#       jbe no_long_mode
     57#       movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001
     58#       cpuid
     59#       bt $29, %edx            # Test if long mode is supported.
     60#       jnc no_long_mode
     61#
     62#       # Load gdtr, idtr
     63#       lgdt real_bootstrap_gdtr_boot
     64#      
     65#       movl %cr0,%eax
     66#       orl $0x1,%eax
     67#       movl %eax,%cr0                  # switch to protected mode
     68#
     69#       jmpl $gdtselector(KTEXT32_DES), $now_in_prot
     70#
     71# no_long_mode:
     72# 1:
     73#       jmp 1b
     74#      
    8575.code32
    8676.align 4
     
    8979        .long MULTIBOOT_HEADER_FLAGS
    9080        .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)        # checksum
    91         .long multiboot_header + BOOT_OFFSET
    92         .long unmapped_ktext_start + BOOT_OFFSET
     81        .long multiboot_header
     82        .long unmapped_ktext_start
    9383        .long 0
    9484        .long 0
    95         .long multiboot_image_start + BOOT_OFFSET
     85        .long multiboot_image_start
    9686
    9787multiboot_image_start:
     
    110100        multiboot_meeting_point:
    111101       
    112         hlt
    113 
    114 # Protected 32-bit. We want to reuse the code-seg descriptor,
    115 # the Default operand size must not be 1 when entering long mode
    116 now_in_prot: 
    117         # Set up stack & data descriptors
    118         movw $gdtselector(KDATA_DES), %ax
    119         movw %ax, %ds
    120         movw %ax, %ss
    121 
    122         movb $0xd1, %al         # enable A20 using the keyboard controller
    123         outb %al, $0x64
    124         movb $0xdf, %al
    125         outb %al, $0x60
    126 
     102        # Protected 32-bit. We want to reuse the code-seg descriptor,
     103        # the Default operand size must not be 1 when entering long mode
     104       
     105        pushl %ebx                                                      # save parameters from GRUB
     106        pushl %eax
    127107       
    128108        # Enable 64-bit page transaltion entries - CR4.PAE = 1.
    129109        # Paging is not enabled until after long mode is enabled
     110       
    130111        movl %cr4, %eax
    131112        btsl $5, %eax
     
    133114
    134115        # Set up paging tables
     116       
    135117        leal ptl_0, %eax
    136118        movl %eax, %cr3
    137119       
    138120        # Enable long mode
    139         movl $EFER_MSR_NUM, %ecx   # EFER MSR number
    140         rdmsr                   # Read EFER
    141         btsl $AMD_LME_FLAG, %eax            # Set LME=1
    142         wrmsr                   # Write EFER
     121       
     122        movl $EFER_MSR_NUM, %ecx        # EFER MSR number
     123        rdmsr                                           # Read EFER
     124        btsl $AMD_LME_FLAG, %eax        # Set LME=1
     125        wrmsr                                           # Write EFER
    143126       
    144127        # Enable paging to activate long mode (set CR0.PG=1)
     128       
    145129        movl %cr0, %eax
    146130        btsl $31, %eax
     
    148132       
    149133        # At this point we are in compatibility mode
     134       
    150135        jmpl $gdtselector(KTEXT_DES), $start64
    151136
     
    154139        movq $(PA2KA(START_STACK)), %rsp
    155140
    156         # Copy kernel to higher physical memory
    157         movq $BOOTSTRAP_OFFSET, %rsi
    158         movq $BOOTSTRAP_OFFSET + BOOT_OFFSET, %rdi
    159         movq $_hardcoded_kernel_size, %rcx
    160         cld
    161         rep movsb
    162        
    163141        call main_bsp   # never returns
    164 1:
    165         jmp 1b
     142       
     143        cli
     144        hlt
    166145                               
    167146.section K_DATA_START, "aw", @progbits
     
    219198        .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
    220199
    221 .global real_bootstrap_gdtr_boot
    222 real_bootstrap_gdtr_boot:
    223         .word gdtselector(GDT_ITEMS)
    224         .long KA2PA(gdt)-BOOT_OFFSET
    225 
    226200.global protected_bootstrap_gdtr
    227201protected_bootstrap_gdtr:
  • arch/amd64/src/mm/memory_init.c

    r66def8d r8725fb4  
    3232#include <print.h>
    3333
    34 __u8 e820counter __attribute__ ((section ("BOOT_DATA"))) = 0xff;
    35 struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS] __attribute__ ((section ("BOOT_DATA"))) ;
     34__u8 e820counter = 0xff;
     35struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS];
     36__u32 e801memorysize;
    3637
    3738size_t get_memory_size(void)
Note: See TracChangeset for help on using the changeset viewer.