2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
30 * Mach Operating System
31 * Copyright (c) 1991,1990 Carnegie Mellon University
32 * All Rights Reserved.
34 * Permission to use, copy, modify and distribute this software and its
35 * documentation is hereby granted, provided that both the copyright
36 * notice and this permission notice appear in all copies of the
37 * software, derivative works or modified versions, and any portions
38 * thereof, and that both notices appear in supporting documentation.
40 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
41 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
42 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
44 * Carnegie Mellon requests users of this software to return to
46 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
47 * School of Computer Science
48 * Carnegie Mellon University
49 * Pittsburgh PA 15213-3890
51 * any improvements or extensions that they make and grant Carnegie Mellon
52 * the rights to redistribute these changes.
57 #include "i386/AT386/mp/boot.h"
60 #define CR0_PE_OFF 0xfffffffe
66 #define LJMP(segment,address) \
68 .long address-EXT(slave_boot_base) ;\
71 #define LGDT(address) \
74 .long address-EXT(slave_boot_base)
76 ENTRY(slave_boot_base)
77 /* code is loaded at 0x0:0x1000 */
78 /* ljmp to the next instruction to set up %cs */
80 LJMP(MP_BOOTSEG, EXT(slave_pstart))
87 /* set up %ss and %esp */
92 mov $MP_BOOTSTACK, %esp
97 /* change to protected mode */
99 call EXT(real_to_prot)
106 transfer from real mode to protected mode.
110 /* guarantee that interrupt is disabled when in prot mode */
118 /* set the PE bit of CR0 */
125 /* make intrasegment jump to flush the processor pipeline and */
126 /* reload CS register */
131 /* we are in USE32 mode now */
132 /* set up the protective mode segment registers : DS, SS, ES */
142 start the program on protected mode where phyaddr is the entry point
149 mov 0x8(%ebp), %ecx /* entry offset */
150 mov $0x28, %ebx /* segment */
154 /* set up %ds and %es */
162 . = MP_GDT-MP_BOOT /* GDT location */
165 /* Segment Descriptor
168 * ------------------------------------------------------------
169 * | | |B| |A| | | |1|0|E|W|A| |
170 * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
171 * | | |D| |L| 19..16| | |1|1|C|R|A| |
172 * ------------------------------------------------------------
174 * | BASE 15..0 | LIMIT 15..0 |
176 * ------------------------------------------------------------
178 .word 0,0 /* 0x0 : null */
181 .word 0xffff,MP_BOOT /* 0x8 : boot code */
184 .word 0xffff,MP_BOOT /* 0x10 : boot data */
187 .word 0xffff,MP_BOOT /* 0x18 : boot code, 16 bits */
190 .word 0xffff,0 /* 0x20 : init data */
193 .word 0xffff,0 /* 0x28 : init code */
197 .short 48 /* limit (8*6 segs) */
198 .short MP_GDT /* base low */
199 .short 0 /* base high */
201 ENTRY(slave_boot_end)