| Zeile 5: | Zeile 5: | ||
==Struktur== | ==Struktur== | ||
Jeder Eintrag in den GDT besteht aus acht Bytes. | Jeder Eintrag in den GDT besteht aus acht Bytes. | ||
| + | === Struktur eines Eintrages === | ||
{| {{Prettytable}} | {| {{Prettytable}} | ||
! Byte || Name || Bits | ! Byte || Name || Bits | ||
| Zeile 27: | Zeile 28: | ||
|- | |- | ||
|} | |} | ||
| − | + | === Bedeutung === | |
{| {{Prettytable}} | {| {{Prettytable}} | ||
! Name || Bedeutung | ! Name || Bedeutung | ||
| Zeile 40: | Zeile 41: | ||
|} | |} | ||
| − | + | === Das Access-Byte === | |
{| {{Prettytable}} | {| {{Prettytable}} | ||
! Bit || Name|| Bedeutung | ! Bit || Name|| Bedeutung | ||
| Zeile 58: | Zeile 59: | ||
| 0 || Accessed bit || Sollte 0 gesetzt werden, wird dann vom Prozessor bei Zugriff gesetzt. | | 0 || Accessed bit || Sollte 0 gesetzt werden, wird dann vom Prozessor bei Zugriff gesetzt. | ||
|} | |} | ||
| − | + | ==== Beispielcode ==== | |
| − | Die Flags | + | char Set_Accessbyte(char enable, char privilege, char code, char read_write){ |
| + | char Bitmaske = 0x00; | ||
| + | /** enable geht von 0 bis 1 | ||
| + | 0x01 ist in Bits 00000001b*/ | ||
| + | if (enable = 1){ | ||
| + | Bitmaske = (Bitmaske | 0x01); | ||
| + | } | ||
| + | /* privilege geht von 0 bis 3 | ||
| + | 0x02 ist in Bits 00000010b | ||
| + | 0x04 ist in Bits 00000100b | ||
| + | 0x06 ist in Bits 00000110b*/ | ||
| + | if (privilege = 1) { | ||
| + | Bitmaske = (Bitmaske | 0x02); | ||
| + | } | ||
| + | else if (privilege = 2){ | ||
| + | Bitmaske = (Bitmaske | 0x04); | ||
| + | } | ||
| + | else if(privilege = 3){ | ||
| + | Bitmaske = (Bitmaske | 0x06); | ||
| + | } | ||
| + | Bitmaske = (Bitmaske | 0x08); | ||
| + | /* code 0 bis 1 */ | ||
| + | if (code = 1){ | ||
| + | Bitmaske = (Bitmaske | 0x0f); | ||
| + | } | ||
| + | /* read_write geht von 0 bis 1 */ | ||
| + | if (read_write = 1){ | ||
| + | Bitmaske = (Bitmaske | 0x40); | ||
| + | } | ||
| + | Return(Bitmaske); | ||
| + | } | ||
| + | === Die Flags === | ||
{| {{Prettytable}} | {| {{Prettytable}} | ||
! Bit || Name|| Bedeutung | ! Bit || Name|| Bedeutung | ||