/// <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(); }
public void SetEntry(ushort index, DescriptorTableEntry source) { Assert.InRange(index, Length); DescriptorTableEntry.CopyTo(&source, entries + index); }
public void AddEntry(DescriptorTableEntry source) { Length++; SetEntry((ushort)(Length - 1), source); }
public static void CopyTo(DescriptorTableEntry* source, DescriptorTableEntry* destination) { Memory.Copy((uint)source, (uint)destination, EntrySize); }
public static void Clear(DescriptorTableEntry* entry) { Memory.Clear((uint)entry, EntrySize); }
public void SetEntry(ushort index, DescriptorTableEntry source) { Assert.InRange(index, Length); DescriptorTableEntry.CopyTo(&source, entries + index); }
public void AddEntry(DescriptorTableEntry source) { Length++; SetEntry((ushort)(Length - 1), source); }