Exemple #1
0
        /// <summary>
        /// Sets up the GDT table and entries
        /// </summary>
        public static void Setup()
        {
            table = (DescriptorTable *)gdtTableAddress;
            table->Clear();
            table->AdressOfEntries = gdtTableAddress + DescriptorTable.StructSize;

            //Null segment
            var nullEntry = DescriptorTableEntry.CreateNullDescriptor();

            table->AddEntry(nullEntry);

            //code segment
            var codeEntry = DescriptorTableEntry.CreateCode(0, 0xFFFFFFFF);

            codeEntry.CodeSegment_Readable = true;
            codeEntry.PriviligeRing        = 0;
            codeEntry.Present     = true;
            codeEntry.AddressMode = DescriptorTableEntry.EAddressMode.Bits32;
            codeEntry.Granularity = true;
            table->AddEntry(codeEntry);

            //data segment
            var dataEntry = DescriptorTableEntry.CreateData(0, 0xFFFFFFFF);

            dataEntry.DataSegment_Writable = true;
            dataEntry.PriviligeRing        = 0;
            dataEntry.Present     = true;
            dataEntry.AddressMode = DescriptorTableEntry.EAddressMode.Bits32;
            dataEntry.Granularity = true;
            table->AddEntry(dataEntry);

            Flush();
        }
Exemple #2
0
 public void SetEntry(ushort index, DescriptorTableEntry source)
 {
     Assert.InRange(index, Length);
     DescriptorTableEntry.CopyTo(&source, entries + index);
 }
Exemple #3
0
 public void AddEntry(DescriptorTableEntry source)
 {
     Length++;
     SetEntry((ushort)(Length - 1), source);
 }
Exemple #4
0
 public static void CopyTo(DescriptorTableEntry* source, DescriptorTableEntry* destination)
 {
     Memory.Copy((uint)source, (uint)destination, EntrySize);
 }
Exemple #5
0
 public static void Clear(DescriptorTableEntry* entry)
 {
     Memory.Clear((uint)entry, EntrySize);
 }
Exemple #6
0
 public void SetEntry(ushort index, DescriptorTableEntry source)
 {
     Assert.InRange(index, Length);
     DescriptorTableEntry.CopyTo(&source, entries + index);
 }
Exemple #7
0
 public void AddEntry(DescriptorTableEntry source)
 {
     Length++;
     SetEntry((ushort)(Length - 1), source);
 }