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

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3b0f1b9a was 8844e70, checked in by Jakub Jermar <jakub@…>, 9 years ago

ia32: use asmtool.h macros for defining symbols

  • Property mode set to 100644
File size: 2.8 KB
Line 
1#
2# Copyright (c) 2001-2004 Jakub Jermar
3# Copyright (c) 2005-2006 Martin Decky
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
30/*
31 * Init code for application processors.
32 */
33
34#include <abi/asmtool.h>
35#include <arch/boot/boot.h>
36#include <arch/boot/memmap.h>
37#include <arch/mm/page.h>
38#include <arch/pm.h>
39
40.section K_TEXT_START, "ax"
41
42#ifdef CONFIG_SMP
43
44KTEXT=8
45KDATA=16
46
47/*
48 * This piece of code is real-mode and is meant to be aligned at 4K boundary.
49 * The requirement for such an alignment comes from MP Specification's
50 * STARTUP IPI requirements.
51 */
52
53.align 4096
54SYMBOL(unmapped_ap_boot)
55.code16
56 cli
57 xorw %ax, %ax
58 movw %ax, %ds
59
60 /* initialize Global Descriptor Table register */
61 lgdtl ap_gdtr
62
63 /* switch to protected mode */
64 movl %cr0, %eax
65 orl $1, %eax
66 movl %eax, %cr0
67 jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
68
69jump_to_kernel:
70.code32
71 movw $KDATA, %ax
72 movw %ax, %ds
73 movw %ax, %es
74 movw %ax, %ss
75 movl $KA2PA(ctx), %eax /* KA2PA((uintptr_t) &ctx) */
76 movl (%eax), %esp
77 subl $0x80000000, %esp /* KA2PA(ctx.sp) */
78
79 /*
80 * Map kernel and turn paging on.
81 * We assume that when using SMP, PSE is always available
82 */
83 call map_kernel_pse
84
85 addl $0x80000000, %esp /* PA2KA(ctx.sp) */
86
87 /* create the first stack frame */
88 pushl $0
89 movl %esp, %ebp
90
91 jmpl $KTEXT, $main_ap
92
93#endif /* CONFIG_SMP */
94
95
96.section K_DATA_START, "aw", @progbits
97
98#ifdef CONFIG_SMP
99
100SYMBOL(unmapped_ap_gdtr)
101 .word 0
102 .long 0
103
104#endif /* CONFIG_SMP */
Note: See TracBrowser for help on using the repository browser.