Changeset 42edee68 in mainline for arch/amd64/src/smp/ap.S


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

AMD64 SMP boots again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/smp/ap.S

    r46d26ee r42edee68  
    11#
    22# Copyright (C) 2001-2004 Jakub Jermar
     3# Copyright (C) 2005-2006 Martin Decky
    34# All rights reserved.
    45#
     
    3233
    3334#include <arch/boot/boot.h>
     35#include <arch/boot/memmap.h>
     36#include <arch/mm/page.h>
    3437#include <arch/pm.h>
    3538#include <arch/cpu.h>
    3639#include <arch/cpuid.h>
    37 #include <arch/mm/page.h>
    38        
    39 .section K_TEXT_START_2, "ax"
     40
     41.section K_TEXT_START, "ax"
    4042
    4143#ifdef CONFIG_SMP
    4244
    43 .global ap_boot
     45.global unmapped_ap_boot
    4446
    4547# This piece of code is real-mode and is meant to be alligned at 4K boundary.
     
    4850
    4951.align 4096
    50 ap_boot:
     52unmapped_ap_boot:
    5153.code16
    5254        cli
     
    5456        movw %ax, %ds
    5557
    56         lgdt real_bootstrap_gdtr_boot   # initialize Global Descriptor Table register
     58        lgdt ap_gdtr            # initialize Global Descriptor Table register
    5759       
    5860        movl %cr0, %eax
    5961        orl $1, %eax
    60         movl %eax, %cr0                 # switch to protected mode
     62        movl %eax, %cr0                         # switch to protected mode
     63        jmpl $gdtselector(KTEXT32_DES), $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
    6164       
    62         jmpl $gdtselector(KTEXT32_DES), $now_in_prot
    63 
    64 .code32
    65 now_in_prot:
     65jump_to_kernel:
     66.code32
    6667        movw $gdtselector(KDATA_DES), %ax
    6768        movw %ax, %ds
     69        movw %ax, %es
    6870        movw %ax, %ss
    6971       
    70 
    7172        # Enable 64-bit page transaltion entries - CR4.PAE = 1.
    7273        # Paging is not enabled until after long mode is enabled
     74       
    7375        movl %cr4, %eax
    7476        btsl $5, %eax
    7577        movl %eax, %cr4
    7678
    77         # Set up NEW paging tables, that are
    78         # already moved BOOT_OFFSET up
    79         leal ptl_0+BOOT_OFFSET, %eax
     79        leal ptl_0, %eax
    8080        movl %eax, %cr3
    8181       
     
    9292       
    9393        # At this point we are in compatibility mode
    94         jmpl $gdtselector(KTEXT_DES), $start64
     94        jmpl $gdtselector(KTEXT_DES), $start64 - BOOT_OFFSET + AP_BOOT_OFFSET
    9595
    9696.code64
    9797start64:
    9898        movq (ctx), %rsp
    99         call main_ap   # never returns
    100        
    101        
     99        call main_ap - AP_BOOT_OFFSET + BOOT_OFFSET   # never returns
     100
    102101#endif /* CONFIG_SMP */
     102
     103.section K_DATA_START, "ax"
     104
     105#ifdef CONFIG_SMP
     106
     107.global unmapped_ap_gdtr
     108
     109unmapped_ap_gdtr:
     110        .word 0
     111        .long 0
     112
     113#endif /* CONFIG_SMP */
Note: See TracChangeset for help on using the changeset viewer.