source: mainline/kernel/arch/ia32/src/smp/ap.S@ c94f643

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since c94f643 was e0e00d7, checked in by Martin Sucha <sucha14@…>, 14 years ago

cstyle

  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[f761f1eb]1#
[df4ed85]2# Copyright (c) 2001-2004 Jakub Jermar
3# Copyright (c) 2005-2006 Martin Decky
[f761f1eb]4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
[e0e00d7]30/*
31 * Init code for application processors.
32 */
[f761f1eb]33
[66def8d]34#include <arch/boot/boot.h>
35#include <arch/boot/memmap.h>
36#include <arch/mm/page.h>
37#include <arch/pm.h>
38
39.section K_TEXT_START, "ax"
[f761f1eb]40
[5f85c91]41#ifdef CONFIG_SMP
[f761f1eb]42
[66def8d]43.global unmapped_ap_boot
[f761f1eb]44
45KTEXT=8
46KDATA=16
47
[e0e00d7]48/*
49 * This piece of code is real-mode and is meant to be aligned at 4K boundary.
50 * The requirement for such an alignment comes from MP Specification's
51 * STARTUP IPI requirements.
52 */
[f761f1eb]53
54.align 4096
[66def8d]55unmapped_ap_boot:
[f761f1eb]56.code16
57 cli
[f6297e0]58 xorw %ax, %ax
59 movw %ax, %ds
[f761f1eb]60
[e0e00d7]61 /* initialize Global Descriptor Table register */
62 lgdtl ap_gdtr
[f6297e0]63
[e0e00d7]64 /* switch to protected mode */
[f6297e0]65 movl %cr0, %eax
66 orl $1, %eax
[e0e00d7]67 movl %eax, %cr0
[66def8d]68 jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
[b52da8d7]69
[f761f1eb]70jump_to_kernel:
71.code32
[f6297e0]72 movw $KDATA, %ax
73 movw %ax, %ds
74 movw %ax, %es
75 movw %ax, %ss
[e0e00d7]76 movl $KA2PA(ctx), %eax /* KA2PA((uintptr_t) &ctx) */
[f6297e0]77 movl (%eax), %esp
[e0e00d7]78 subl $0x80000000, %esp /* KA2PA(ctx.sp) */
[f761f1eb]79
[e0e00d7]80 /*
81 * Map kernel and turn paging on.
82 * We assume that when using SMP, PSE is always available
83 */
84 call map_kernel_pse
[f6297e0]85
[e0e00d7]86 addl $0x80000000, %esp /* PA2KA(ctx.sp) */
[c0b45fa]87
[e0e00d7]88 /* create the first stack frame */
89 pushl $0
[bac86377]90 movl %esp, %ebp
91
[f6297e0]92 jmpl $KTEXT, $main_ap
[f761f1eb]93
[5f85c91]94#endif /* CONFIG_SMP */
[66def8d]95
96
[4e09712]97.section K_DATA_START, "aw", @progbits
[66def8d]98
99#ifdef CONFIG_SMP
100
101.global unmapped_ap_gdtr
102
103unmapped_ap_gdtr:
104 .word 0
105 .long 0
106
107#endif /* CONFIG_SMP */
Note: See TracBrowser for help on using the repository browser.