|
|
1.1 root 1: /*
2: * Copyright (c) 1995-1994 The University of Utah and
3: * the Computer Systems Laboratory at the University of Utah (CSL).
4: * All rights reserved.
5: *
6: * Permission to use, copy, modify and distribute this software is hereby
7: * granted provided that (1) source code retains these copyright, permission,
8: * and disclaimer notices, and (2) redistributions including binaries
9: * reproduce the notices in supporting documentation, and (3) all advertising
10: * materials mentioning features or use of this software display the following
11: * acknowledgement: ``This product includes software developed by the
12: * Computer Systems Laboratory at the University of Utah.''
13: *
14: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
15: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
16: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17: *
18: * CSL requests users of this software to return to [email protected] any
19: * improvements that they make and grant CSL redistribution rights.
20: *
21: * Author: Bryan Ford, University of Utah CSL
22: */
23:
24: #include <mach/machine/proc_reg.h>
25:
26: #include "cpu.h"
27: #include "vm_param.h"
28:
29: void cpu_tables_load(struct cpu *cpu)
30: {
31: struct pseudo_descriptor pdesc;
32:
33: /* Load the final GDT.
34: If paging is now on,
35: then this will point the processor to the GDT
36: at its new linear address in the kernel linear space. */
37: pdesc.limit = sizeof(cpu->tables.gdt)-1;
38: pdesc.linear_base = kvtolin(&cpu->tables.gdt);
39: set_gdt(&pdesc);
40:
41: /* Reload all the segment registers from the new GDT. */
42: asm volatile("
43: ljmp %0,$1f
44: 1:
45: " : : "i" (KERNEL_CS));
46: set_ds(KERNEL_DS);
47: set_es(KERNEL_DS);
48: set_fs(0);
49: set_gs(0);
50: set_ss(KERNEL_DS);
51:
52: /* Load the IDT. */
53: pdesc.limit = sizeof(cpu[0].tables.idt)-1;
54: pdesc.linear_base = kvtolin(&cpu->tables.idt);
55: set_idt(&pdesc);
56:
57: #ifdef DEFAULT_LDT
58: /* Load the default LDT. */
59: set_ldt(DEFAULT_LDT);
60: #endif
61:
62: #ifdef DEFAULT_TSS
63: /* Make sure it isn't marked busy. */
64: cpu->tables.gdt[DEFAULT_TSS_IDX].access &= ~ACC_TSS_BUSY;
65:
66: /* Load the default TSS. */
67: set_tr(DEFAULT_TSS);
68: #endif
69: }
70:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.