|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990 Carnegie Mellon University ! 4: * Copyright (c) 1991 IBM Corporation ! 5: * All Rights Reserved. ! 6: * ! 7: * Permission to use, copy, modify and distribute this software and its ! 8: * documentation is hereby granted, provided that both the copyright ! 9: * notice and this permission notice appear in all copies of the ! 10: * software, derivative works or modified versions, and any portions ! 11: * thereof, and that both notices appear in supporting documentation, ! 12: * and that the name IBM not be used in advertising or publicity ! 13: * pertaining to distribution of the software without specific, written ! 14: * prior permission. ! 15: * ! 16: * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 17: * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR ! 18: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 19: * ! 20: * Carnegie Mellon requests users of this software to return to ! 21: * ! 22: * Software Distribution Coordinator or [email protected] ! 23: * School of Computer Science ! 24: * Carnegie Mellon University ! 25: * Pittsburgh PA 15213-3890 ! 26: * ! 27: * any improvements or extensions that they make and grant Carnegie Mellon ! 28: * the rights to redistribute these changes. ! 29: */ ! 30: ! 31: #include "cpu.h" ! 32: #include "vm_param.h" ! 33: ! 34: ! 35: /* Initialize the 32-bit kernel code and data segment descriptors ! 36: to point to the base of the kernel linear space region. */ ! 37: gdt_desc_initializer(KERNEL_CS, ! 38: kvtolin(0), 0xffffffff, ! 39: ACC_PL_K|ACC_CODE_R, SZ_32); ! 40: gdt_desc_initializer(KERNEL_DS, ! 41: kvtolin(0), 0xffffffff, ! 42: ACC_PL_K|ACC_DATA_W, SZ_32); ! 43: ! 44: /* Initialize the 16-bit real-mode code and data segment descriptors. */ ! 45: gdt_desc_initializer(KERNEL_16_CS, ! 46: kvtolin(0), 0xffff, ! 47: ACC_PL_K|ACC_CODE_R, SZ_16); ! 48: gdt_desc_initializer(KERNEL_16_DS, ! 49: kvtolin(0), 0xffff, ! 50: ACC_PL_K|ACC_DATA_W, SZ_16); ! 51: ! 52: /* Initialize the linear-space data segment descriptor. */ ! 53: gdt_desc_initializer(LINEAR_CS, ! 54: 0, 0xffffffff, ! 55: ACC_PL_K|ACC_CODE_R, SZ_32); ! 56: gdt_desc_initializer(LINEAR_DS, ! 57: 0, 0xffffffff, ! 58: ACC_PL_K|ACC_DATA_W, SZ_32); ! 59: ! 60: /* Initialize the master LDT and TSS descriptors. */ ! 61: #ifdef ENABLE_KERNEL_LDT ! 62: gdt_desc_initializer(KERNEL_LDT, ! 63: kvtolin(&cpu->tables.ldt), sizeof(cpu->tables.ldt)-1, ! 64: ACC_PL_K|ACC_LDT, 0); ! 65: #endif ! 66: #ifdef ENABLE_KERNEL_TSS ! 67: gdt_desc_initializer(KERNEL_TSS, ! 68: kvtolin(&cpu->tables.tss), sizeof(cpu->tables.tss)-1, ! 69: ACC_PL_K|ACC_TSS, 0); ! 70: #endif ! 71: ! 72: ! 73: void cpu_gdt_init(struct cpu *cpu) ! 74: { ! 75: /* Initialize all the selectors of the GDT. */ ! 76: #define gdt_sel(name) cpu_gdt_init_##name(cpu); ! 77: #include "gdt_sels.h" ! 78: #undef gdt_sel ! 79: } ! 80:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.