2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
27 * Mach Operating System
28 * Copyright (c) 1991,1990 Carnegie Mellon University
29 * All Rights Reserved.
31 * Permission to use, copy, modify and distribute this software and its
32 * documentation is hereby granted, provided that both the copyright
33 * notice and this permission notice appear in all copies of the
34 * software, derivative works or modified versions, and any portions
35 * thereof, and that both notices appear in supporting documentation.
37 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
38 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
39 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
41 * Carnegie Mellon requests users of this software to return to
43 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
44 * School of Computer Science
45 * Carnegie Mellon University
46 * Pittsburgh PA 15213-3890
48 * any improvements or extensions that they make and grant Carnegie Mellon
49 * the rights to redistribute these changes.
54 #include "i386/AT386/mp/boot.h"
57 #define CR0_PE_OFF 0xfffffffe
63 #define LJMP(segment,address) \
65 .long address-EXT(slave_boot_base) ;\
68 #define LGDT(address) \
71 .long address-EXT(slave_boot_base)
73 ENTRY(slave_boot_base)
74 /* code is loaded at 0x0:0x1000 */
75 /* ljmp to the next instruction to set up %cs */
77 LJMP(MP_BOOTSEG, EXT(slave_pstart))
84 /* set up %ss and %esp */
89 mov $MP_BOOTSTACK, %esp
94 /* change to protected mode */
96 call EXT(real_to_prot)
103 transfer from real mode to protected mode.
107 /* guarantee that interrupt is disabled when in prot mode */
115 /* set the PE bit of CR0 */
122 /* make intrasegment jump to flush the processor pipeline and */
123 /* reload CS register */
128 /* we are in USE32 mode now */
129 /* set up the protective mode segment registers : DS, SS, ES */
139 start the program on protected mode where phyaddr is the entry point
146 mov 0x8(%ebp), %ecx /* entry offset */
147 mov $0x28, %ebx /* segment */
151 /* set up %ds and %es */
159 . = MP_GDT-MP_BOOT /* GDT location */
162 /* Segment Descriptor
165 * ------------------------------------------------------------
166 * | | |B| |A| | | |1|0|E|W|A| |
167 * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
168 * | | |D| |L| 19..16| | |1|1|C|R|A| |
169 * ------------------------------------------------------------
171 * | BASE 15..0 | LIMIT 15..0 |
173 * ------------------------------------------------------------
175 .word 0,0 /* 0x0 : null */
178 .word 0xffff,MP_BOOT /* 0x8 : boot code */
181 .word 0xffff,MP_BOOT /* 0x10 : boot data */
184 .word 0xffff,MP_BOOT /* 0x18 : boot code, 16 bits */
187 .word 0xffff,0 /* 0x20 : init data */
190 .word 0xffff,0 /* 0x28 : init code */
194 .short 48 /* limit (8*6 segs) */
195 .short MP_GDT /* base low */
196 .short 0 /* base high */
198 ENTRY(slave_boot_end)