Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/libsaio/table.c

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

Archive Download this file

Revision: 2045