singrdk/base/Kernel/Singularity/Isal/ix/Gdt.cs

158 lines
5.9 KiB
C#
Raw Permalink Normal View History

2008-03-05 09:52:00 -05:00
////////////////////////////////////////////////////////////////////////////////
//
// Microsoft Research Singularity
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: Gdt.cs
//
// Note:
//
2008-11-17 18:29:00 -05:00
namespace Microsoft.Singularity.Isal.IX
2008-03-05 09:52:00 -05:00
{
using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
// A lgdt pointer to the tables
//
[CLSCompliant(false)]
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public struct Gdtp
2008-03-05 09:52:00 -05:00
{
2008-11-17 18:29:00 -05:00
#if ISA_IX64
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal ushort pad1;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal ushort pad2;
#endif
[AccessedByRuntime("referenced from c++")]
public ushort pad;
[AccessedByRuntime("referenced from c++")]
public ushort limit;
#if ISA_IX86
[AccessedByRuntime("referenced from c++")]
public uint addr;
#else
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public ulong addr;
#endif
2008-03-05 09:52:00 -05:00
};
/////////////////////////////////////////////// Segment Descriptor Tables.
//
// An entry in the Global Descriptor Table
//
[AccessedByRuntime("referenced from c++")]
[CLSCompliant(false)]
2008-11-17 18:29:00 -05:00
public struct Gdte
2008-03-05 09:52:00 -05:00
{
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public ushort limit;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public ushort base0_15;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public byte base16_23;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public byte access;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public byte granularity;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public byte base24_31;
2008-03-05 09:52:00 -05:00
// granularity bits
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint PAGES = 0x80;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint IS32BIT = 0x40;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint IS64BIT = 0x20;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint LIMIT20 = 0x0f;
2008-03-05 09:52:00 -05:00
// access bits
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint PRESENT = 0x80;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint RING3 = 0x60;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint RING2 = 0x40;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint RING1 = 0x20;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint RING0 = 0x00;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint USER = 0x10;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint CODE = 0x08;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint CONFORMING = 0x04;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint EXPANDDOWN = 0x04; // Data
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint READABLE = 0x02;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint WRITEABLE = 0x02; // Data
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint ACCESSED = 0x01;
2008-03-05 09:52:00 -05:00
// Non-user types:
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Tss16Free = 0x01;
[AccessedByRuntime("referenced from c++")]
public const uint Ldt = 0x02;
[AccessedByRuntime("referenced from c++")]
public const uint Tss16Busy = 0x03;
[AccessedByRuntime("referenced from c++")]
public const uint CallGate16 = 0x04;
[AccessedByRuntime("referenced from c++")]
public const uint TaskGate = 0x05;
[AccessedByRuntime("referenced from c++")]
public const uint IntGate16 = 0x06;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint TrapGate16 = 0x07;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Reserved8 = 0x08;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Tss32Free = 0x09;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Reserved10 = 0x0a;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Tss32Busy = 0x0b;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint CallGate32 = 0x0c;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint Reserved13 = 0x0d;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint IntGate32 = 0x0e;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
public const uint TrapGate32 = 0x0f;
}
// Defines a 64-bit System Segment Descriptor entry in the Global Descriptor Table
//
[AccessedByRuntime("referenced from c++")]
[CLSCompliant(false)]
public struct Gdte64
{
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal ushort limit;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal ushort base0_15;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal byte base16_23;
[AccessedByRuntime("referenced from c++")]
internal byte access;
[AccessedByRuntime("referenced from c++")]
internal byte granularity;
[AccessedByRuntime("referenced from c++")]
internal byte base24_31;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal uint base32_63;
2008-03-05 09:52:00 -05:00
[AccessedByRuntime("referenced from c++")]
2008-11-17 18:29:00 -05:00
internal uint reserved;
2008-03-05 09:52:00 -05:00
}
}