]> git.saurik.com Git - apple/boot.git/blob - gen/libsaio/table.c
2c1502193d6e9f4599ba7fec5a56fd82a5d4c2fb
[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 * Portions Copyright (c) 1999 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 1.1 (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 /*
33 * INTEL CORPORATION PROPRIETARY INFORMATION
34 *
35 * This software is supplied under the terms of a license agreement or
36 * nondisclosure agreement with Intel Corporation and may not be copied
37 * nor disclosed except in accordance with the terms of that agreement.
38 *
39 * Copyright 1988, 1989 Intel Corporation
40 */
41
42 /*
43 * Copyright 1993 NeXT, Inc.
44 * All rights reserved.
45 */
46
47 #include "memory.h"
48
49 #define NGDTENT 6
50 #define GDTLIMIT 48 /* NGDTENT * 8 */
51
52 /* Segment Descriptor
53 *
54 * 31 24 19 16 7 0
55 * ------------------------------------------------------------
56 * | | |B| |A| | | |1|0|E|W|A| |
57 * | BASE 31..24 |G|/|0|V| LIMIT |P|DPL| TYPE | BASE 23:16 |
58 * | | |D| |L| 19..16| | |1|1|C|R|A| |
59 * ------------------------------------------------------------
60 * | | |
61 * | BASE 15..0 | LIMIT 15..0 |
62 * | | |
63 * ------------------------------------------------------------
64 */
65
66 struct seg_desc {
67 unsigned short limit_15_0;
68 unsigned short base_15_0;
69 unsigned char base_23_16;
70 unsigned char bit_15_8;
71 unsigned char bit_23_16;
72 unsigned char base_31_24;
73 };
74
75
76 struct seg_desc Gdt[NGDTENT] = {
77 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0x0 : null */
78 // byte granularity, 1Mb limit, MEMBASE offset
79 {0xFFFF, MEMBASE, 0x0, 0x9E, 0x4F, 0x0}, /* 0x8 : boot code */
80 // dword granularity, 2Gb limit, MEMBASE offset
81 {0xFFFF, MEMBASE, 0x0, 0x92, 0xCF, 0x0}, /* 0x10 : boot data */
82 {0xFFFF, MEMBASE, 0x0, 0x9E, 0xF, 0x0}, /* 0x18 : boot code, 16 bits */
83 {0xFFFF, 0x0, 0x0, 0x92, 0xCF, 0x0}, /* 0x20 : init data */
84 {0xFFFF, 0x0, 0x0, 0x9E, 0xCF, 0x0} /* 0x28 : init code */
85 };
86