1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 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 2.0 (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 | * Mach Operating System␊ |
26 | * Copyright (c) 1990 Carnegie-Mellon University␊ |
27 | * Copyright (c) 1989 Carnegie-Mellon University␊ |
28 | * All rights reserved. The CMU software License Agreement specifies␊ |
29 | * the terms and conditions for use and redistribution.␊ |
30 | *␊ |
31 | *␊ |
32 | * ␉␉␉INTEL CORPORATION PROPRIETARY INFORMATION␊ |
33 | *␊ |
34 | *␉This software is supplied under the terms of a license agreement or ␊ |
35 | *␉nondisclosure agreement with Intel Corporation and may not be copied ␊ |
36 | *␉nor disclosed except in accordance with the terms of that agreement.␊ |
37 | *␊ |
38 | *␉Copyright 1988, 1989 Intel Corporation␊ |
39 | *␊ |
40 | * Copyright 1993 NeXT, Inc.␊ |
41 | * All rights reserved.␊ |
42 | */␊ |
43 | ␊ |
44 | #include "memory.h"␊ |
45 | ␊ |
46 | /* Segment Descriptor␊ |
47 | *␊ |
48 | * 31 24 19 16 7 0␊ |
49 | * ------------------------------------------------------------␊ |
50 | * | | |B| |A| | | |1|0|E|W|A| |␊ |
51 | * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |␊ |
52 | * | | |D| |L| 19..16| | |1|1|C|R|A| |␊ |
53 | * ------------------------------------------------------------␊ |
54 | * | | |␊ |
55 | * | BASE 15..0 | LIMIT 15..0 |␊ |
56 | * | | |␊ |
57 | * ------------------------------------------------------------␊ |
58 | */␊ |
59 | ␊ |
60 | struct seg_desc {␊ |
61 | unsigned short limit_15_0;␊ |
62 | unsigned short base_15_0;␊ |
63 | unsigned char base_23_16;␊ |
64 | unsigned char bit_15_8;␊ |
65 | unsigned char bit_23_16;␊ |
66 | unsigned char base_31_24;␊ |
67 | };␊ |
68 | ␊ |
69 | // turbo - GDT must be in first 64k segment␊ |
70 | struct seg_desc __attribute__ ((section("__INIT,__data"))) Gdt[ NGDTENT ] = {␊ |
71 | /* 0x0 : null */␊ |
72 | {0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00},␊ |
73 | ␊ |
74 | /* 0x8 : boot protected mode 32-bit code segment␊ |
75 | byte granularity, 1MB limit, MEMBASE offset */␊ |
76 | //{0xFFFF, MEMBASE, 0x00, 0x9E, 0x4F, 0x00}, ␊ |
77 | ␉{0xFFFF, 0x0000, 0x00, 0x9E, 0xCF, 0x00},␊ |
78 | ␊ |
79 | /* 0x10 : boot protected mode data segment␊ |
80 | page granularity, 4GB limit, MEMBASE offset */␊ |
81 | {0xFFFF, MEMBASE, 0x00, 0x92, 0xCF, 0x00},␊ |
82 | ␊ |
83 | /* 0x18 : boot protected mode 16-bit code segment␊ |
84 | byte granularity, 1MB limit, MEMBASE offset */␊ |
85 | {0xFFFF, MEMBASE, 0x00, 0x9E, 0x0F, 0x00},␊ |
86 | ␊ |
87 | /* 0x20 : kernel init 32-bit data segment␊ |
88 | page granularity, 4GB limit, zero offset */␊ |
89 | {0xFFFF, 0x0000, 0x00, 0x92, 0xCF, 0x00},␊ |
90 | ␊ |
91 | /* 0x28 : kernel init 32-bit code segment␊ |
92 | page granularity, 4GB limit, zero offset */␊ |
93 | {0xFFFF, 0x0000, 0x00, 0x9E, 0xCF, 0x00},␊ |
94 | ␊ |
95 | /* 0x30 : boot real mode data/stack segment␊ |
96 | byte granularity, 64K limit, MEMBASE offset, expand-up */␊ |
97 | {0xFFFF, MEMBASE, 0x00, 0x92, 0x00, 0x00}, ␊ |
98 | };␊ |
99 | |