Hallo
Ich habe mal versucht einen Deskriptor in C Datenstrukturen umzusetzen. (Als Vorlage diente natürlich teejays tut) Vielleicht kann ja mal jemand drüber schauen und berichten wo sich Fehler eingeschlichen haben oder vielleicht hat ja auch jemand etwas Kritik für mich.
sp
PS: Ich hab es leider, aufgrund techn. Probleme, (noch) nicht testen können.
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
struct s_descriptor_access_type
{
//---------------------------------------------------------------------------
// 1 = CPU arbeitet gerade mit diesem Segment
// 0 = Segment nicht in Nutzung
//---------------------------------------------------------------------------
uint accessed : 1; //B0
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
uint type : 3;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1 = normales Segment
// 0 = System-Segment (TSS, Interrupt-Gate, ...)
//---------------------------------------------------------------------------
uint segment_type : 1;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Deskriptor Privilege Level
// 0,1,2,3
//---------------------------------------------------------------------------
uint dpl : 2;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1 = Segment befindet sich im Speicher
// 0 = Segment wurde duch OS ausgelagert
//---------------------------------------------------------------------------
uint present : 1; //B7
//---------------------------------------------------------------------------
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
struct s_descriptor_seg_info
{
//---------------------------------------------------------------------------
// Dieses BIT kann frei genutzt werden, es wird von der CPU
// nicht eingelesen bzw, verarbeitet.
//---------------------------------------------------------------------------
uint available_bit : 1; //B0
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Reserviert, sollte immr auf Null gesetzt werden.
//---------------------------------------------------------------------------
uint resv : 1
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1 = 386 (Datensegment max 4 GB, Code = 32 Bit, Stack = 32 Bit)
// 0 = 286 (Datensegment max 64 KB, Code = 16 Bit, Stack = 16 Bit)
//---------------------------------------------------------------------------
uint seg_32bit : 1;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
// 1 = Segmentgröße wird in 4KB Schritten eingegeben
// 0 = Segmentgröße wird als Bytes gesehen
//---------------------------------------------------------------------------
uint granular : 1; //B3
//---------------------------------------------------------------------------
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
struct s_descriptor
{
//---------------------------------------------------------------------------
// Segmentgröße: Bit 0 bis 15
//---------------------------------------------------------------------------
word segment_size_low;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
word segment_base_low;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
byte segment_base_middle;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
s_descriptor_access_type access_type;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
uint segment_size_high : 4;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
s_descriptor_seg_info segment_info;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
byte segment_base_high;
//---------------------------------------------------------------------------
};
//---------------------------------------------------------------------------