Annotation of kernel/machdep/i386/start.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright (c) 1992 NeXT Computer, Inc.
                     27:  *
                     28:  * Kernel startup routine.
                     29:  *
                     30:  * HISTORY
                     31:  *
                     32:  * 29 August 1992 ? at NeXT
                     33:  *     Created.
                     34:  */
                     35:  
                     36: #import <architecture/i386/asm_help.h>
                     37: 
                     38: #import <assym.h>
                     39: 
                     40:        TEXT
                     41:        /*
                     42:         * Kernel entry point.
                     43:         * Control is transferred here
                     44:         * from the boot loader.  Machine
                     45:         * is in protected mode, with paging
                     46:         * turned off.
                     47:         */
                     48: LEAF(_start, 0)
                     49: 
                     50: // BIOS/DOS hack                       // this says don''t test memory
                     51: //     movw    $0x1234, %ax            // on reboot/reset
                     52: //     movw    %ax, 0x472              // pretty obscure
                     53: // BIOS/DOS hack
                     54:        cld
                     55: 
                     56:        // Initialize GDT & IDT
                     57:        call    _gdt_init
                     58:        call    _idt_init
                     59: 
                     60:        // switch to new GDT
                     61:        ljmp    $ LCODESEL,$start1
                     62: 
                     63:        /*
                     64:         * The GDT and IDT descriptors
                     65:         * can't be defined in C due to
                     66:         * alignment problems.
                     67:         */     
                     68:        DATA
                     69:        .align  3
                     70: EXPORT(_gdt_limit)
                     71:        .word   0
                     72: EXPORT(_gdt_base)
                     73:        .long   0
                     74: 
                     75:        .align  3
                     76: EXPORT(_idt_limit)
                     77:        .word   0
                     78: EXPORT(_idt_base)
                     79:        .long   0
                     80:        
                     81:        TEXT    
                     82:        /*
                     83:         * Running off our GDT
                     84:         */
                     85: start1:
                     86:        // switch to new GDT
                     87:        mov     $ LDATASEL,%ax  
                     88:        mov     %ax,%ds
                     89:        mov     %ax,%es
                     90:        mov     %ax,%fs
                     91:        mov     %ax,%gs
                     92:        mov     %ax,%ss
                     93: 
                     94:        /*
                     95:         * Low level
                     96:         * initialization.
                     97:         * Size memory, set vm_page_size,
                     98:         * setup kernel pmap and enable paging.
                     99:         */
                    100:        call    _i386_init
                    101: 
                    102:        /*
                    103:         * Paging is now enabled.
                    104:         * Start using the kernel
                    105:         * segments.
                    106:         */
                    107:        ljmp    $ KCSSEL,$vstart
                    108:        
                    109: vstart:
                    110:        mov     $ KDSSEL,%ax
                    111:        mov     %ax,%ds
                    112:        mov     %ax,%es
                    113:        mov     %ax,%ss
                    114: 
                    115:        // High level initialization
                    116:        call    _startup_early
                    117:        call    _setup_main
                    118: 
                    119:        // Task switch to the first thread.
                    120:        push    %eax
                    121:        call    _start_initial_context
                    122:        // NOTREACHED
                    123:        hlt

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.