* Copyright (c) 1992, 1991 Carnegie Mellon University
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
* Carnegie Mellon requests users of this software to return to
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
* from: Mach, Revision 2.2 92/04/04 11:35:26 rpd
* $Id: boot2.S,v 1.2 1993/10/16 19:11:33 rgrimes Exp $
/* Conventional GDT indexes. */
#define BOOT_CS16_INDEX 5
#define BREAKPOINT_VECTOR 3
* boot2() -- second stage boot
/* fix up GDT entries for bootstrap */
#define FIXUP(gdt_index) \
movl %eax, EXT(Gdt)+(8*gdt_index)+2; /* actually movw %ax */ \
movb %bl, EXT(Gdt)+(8*gdt_index)+4
/* fix up GDT entry for GDT, and GDT and IDT pointers */
movl %ecx, EXT(Idtr_prot)+2
/* %es = vector table segment for a while */
/* fix up GDT entries for bdb */
movl $4*DEBUG_VECTOR, %esi
movl %es: 2(%esi), %eax /* actually movw to %ax */
/* Fetch entry points of bdb's protected mode trap handlers. These
* are stored at 2 before the corresponding entry points for real mode.
movl %es: (%esi), %ebx /* actually movw to %bx */
movl %es: 4*(BREAKPOINT_VECTOR-DEBUG_VECTOR)(%esi), %ecx
/* actually movw to %cx */
/* %es = bdb segment for a while */
/* fix up IDT entries for bdb */
movl %es: (%ebx), %eax /* actually movw to %ax */
movl %eax, EXT(Idt)+8*DEBUG_VECTOR /* actually movw %ax */
movl %es: (%ecx), %eax /* actually movw to %ax */
movl %eax, EXT(Idt)+8*BREAKPOINT_VECTOR /* actually movw %ax */
/* finished with groping in real mode segments */
/* change to protected mode */
movl $ EXT(edata), %edi /* no EXT(_edata) - krufty ld */
movl $ EXT(end), %ecx /* or EXT(_end) */
movzbl %dl, %edx /* discard head (%dh) and random high bits */
#if 0 /* XXX this would give losing "_ouraddr :". Better declared in C */