Annotation of XNU/osfmk/i386/gdt.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      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.
                     11:  * 
                     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
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:  * @OSF_COPYRIGHT@
                     24:  */
                     25: /* CMU_ENDHIST */
                     26: /* 
                     27:  * Mach Operating System
                     28:  * Copyright (c) 1991,1990 Carnegie Mellon University
                     29:  * All Rights Reserved.
                     30:  * 
                     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.
                     36:  * 
                     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.
                     40:  * 
                     41:  * Carnegie Mellon requests users of this software to return to
                     42:  * 
                     43:  *  Software Distribution Coordinator  or  [email protected]
                     44:  *  School of Computer Science
                     45:  *  Carnegie Mellon University
                     46:  *  Pittsburgh PA 15213-3890
                     47:  * 
                     48:  * any improvements or extensions that they make and grant Carnegie Mellon
                     49:  * the rights to redistribute these changes.
                     50:  */
                     51: /*
                     52:  */
                     53: 
                     54: /*
                     55:  * Global descriptor table.
                     56:  */
                     57: #include <i386/thread.h>
                     58: #include <i386/seg.h>
                     59: #include <mach/i386/vm_param.h>
                     60: #include <kern/thread.h>
                     61: #include <mach_kdb.h>
                     62: 
                     63: #ifdef MACH_BSD
                     64: extern int     trap_unix_syscall(void), trap_mach25_syscall(void),
                     65:                trap_machdep_syscall(void), syscall(void);
                     66: #endif
                     67: 
                     68: struct fake_descriptor gdt[GDTSZ] = {
                     69: /* 0x000 */    { 0, 0, 0, 0 },         /* always NULL */
                     70: /* 0x008 */    { LINEAR_KERNEL_ADDRESS + VM_MIN_ADDRESS,
                     71:                  (VM_MAX_KERNEL_ADDRESS-1-VM_MIN_KERNEL_ADDRESS)>>12,
                     72:                  SZ_32|SZ_G,
                     73:                  ACC_P|ACC_PL_K|ACC_CODE_R
                     74:                },                      /* kernel code */
                     75: /* 0x010 */    { LINEAR_KERNEL_ADDRESS + VM_MIN_ADDRESS,
                     76:                  (VM_MAX_KERNEL_ADDRESS-1-VM_MIN_KERNEL_ADDRESS)>>12,
                     77:                  SZ_32|SZ_G,
                     78:                  ACC_P|ACC_PL_K|ACC_DATA_W
                     79:                },                      /* kernel data */
                     80: /* 0x018 */    { LINEAR_KERNEL_ADDRESS + (unsigned int)ldt,
                     81:                  LDTSZ*sizeof(struct fake_descriptor)-1,
                     82:                  0,
                     83:                  ACC_P|ACC_PL_K|ACC_LDT
                     84:                },                      /* local descriptor table */
                     85: /* 0x020 */    { LINEAR_KERNEL_ADDRESS + (unsigned int)&ktss,
                     86:                  sizeof(struct i386_tss)-1,
                     87:                  0,
                     88:                  ACC_P|ACC_PL_K|ACC_TSS
                     89:                },                      /* TSS for this processor */
                     90: #ifdef MACH_BSD
                     91: /* 0x28 */     { (unsigned int) &trap_unix_syscall,
                     92:                   KERNEL_CS,
                     93:                   0,                           /* no parameters */
                     94:                   ACC_P|ACC_PL_U|ACC_CALL_GATE
                     95:                },
                     96: /* 0x30 */     { (unsigned int) &trap_mach25_syscall,
                     97:                   KERNEL_CS,
                     98:                   0,                           /* no parameters */
                     99:                   ACC_P|ACC_PL_U|ACC_CALL_GATE
                    100:                },
                    101: /* 0x38 */     { (unsigned int) &trap_machdep_syscall,
                    102:                   KERNEL_CS,
                    103:                   0,                           /* no parameters */
                    104:                   ACC_P|ACC_PL_U|ACC_CALL_GATE
                    105:                },
                    106: #else
                    107: /* 0x028 */    { 0, 0, 0, 0 },         /* per-thread LDT */
                    108: /* 0x030 */    { 0, 0, 0, 0 },         /* per-thread TSS for IO bitmap */
                    109: /* 0x038 */    { 0, 0, 0, 0 },
                    110: #endif
                    111: /* 0x040 */    { 0, 0, 0, 0 },
                    112: /* 0x048 */    { LINEAR_KERNEL_ADDRESS + (unsigned int)&cpu_data[0],
                    113:                  sizeof(cpu_data)-1,
                    114:                  SZ_32,
                    115:                  ACC_P|ACC_PL_K|ACC_DATA_W
                    116:                },                      /* per-CPU current thread address */
                    117: #if    MACH_KDB
                    118: /* 0x050 */    { LINEAR_KERNEL_ADDRESS + (unsigned int)&dbtss,
                    119:                  sizeof(struct i386_tss)-1,
                    120:                  0,
                    121:                  ACC_P|ACC_PL_K|ACC_TSS
                    122:                }                       /* TSS for this processor */
                    123: #endif /* MACH_KDB */
                    124: };

unix.superglobalmegacorp.com

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