]> git.saurik.com Git - apple/boot.git/blob - gen/libsaio/table.c
e73b438fb4236e9025aa869dede30f660089844c
[apple/boot.git] / gen / libsaio / table.c
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1990 Carnegie-Mellon University
28 * Copyright (c) 1989 Carnegie-Mellon University
29 * All rights reserved. The CMU software License Agreement specifies
30 * the terms and conditions for use and redistribution.
31 */
32
33 /*
34 * INTEL CORPORATION PROPRIETARY INFORMATION
35 *
36 * This software is supplied under the terms of a license agreement or
37 * nondisclosure agreement with Intel Corporation and may not be copied
38 * nor disclosed except in accordance with the terms of that agreement.
39 *
40 * Copyright 1988, 1989 Intel Corporation
41 */
42
43 /*
44 * Copyright 1993 NeXT, Inc.
45 * All rights reserved.
46 */
47
48 #include "memory.h"
49
50 #define NGDTENT 6
51 #define GDTLIMIT 48 /* NGDTENT * 8 */
52
53 /* Segment Descriptor
54 *
55 * 31 24 19 16 7 0
56 * ------------------------------------------------------------
57 * | | |B| |A| | | |1|0|E|W|A| |
58 * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
59 * | | |D| |L| 19..16| | |1|1|C|R|A| |
60 * ------------------------------------------------------------
61 * | | |
62 * | BASE 15..0 | LIMIT 15..0 |
63 * | | |
64 * ------------------------------------------------------------
65 */
66
67 struct seg_desc {
68 unsigned short limit_15_0;
69 unsigned short base_15_0;
70 unsigned char base_23_16;
71 unsigned char bit_15_8;
72 unsigned char bit_23_16;
73 unsigned char base_31_24;
74 };
75
76
77 struct seg_desc Gdt[NGDTENT] = {
78 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */
79 // byte granularity, 1Mb limit, MEMBASE offset
80 {0xFFFF, MEMBASE, 0x0, 0x9E, 0x4F, 0x0}, /* 0x8 : boot code */
81 // dword granularity, 2Gb limit, MEMBASE offset
82 {0xFFFF, MEMBASE, 0x0, 0x92, 0xCF, 0x0}, /* 0x10 : boot data */
83 {0xFFFF, MEMBASE, 0x0, 0x9E, 0xF, 0x0}, /* 0x18 : boot code, 16 bits */
84 {0xFFFF, 0x0, 0x0, 0x92, 0xCF, 0x0}, /* 0x20 : init data */
85 {0xFFFF, 0x0, 0x0, 0x9E, 0xCF, 0x0} /* 0x28 : init code */
86 };
87