Made getgdt more descriptive
This commit is contained in:
parent
95c0371065
commit
9536ddd3d3
3 changed files with 38 additions and 12 deletions
|
@ -327,14 +327,14 @@ dd 0x00000000
|
|||
dw 0xffff
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
db 0b10011010
|
||||
db 0b10011110
|
||||
db 0b11001111
|
||||
db 0x00
|
||||
|
||||
dw 0xffff
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
db 0b10010010
|
||||
db 0b10010110
|
||||
db 0b11001111
|
||||
db 0x00
|
||||
.gdt_end:
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
| Entry | Base | Limit | Flags | Access | Purpose |
|
||||
|-------|-------------|---------|--------|------------|--------------|
|
||||
| 0x0 | 0x00000000 | 0x00000 | 0b0000 | 0b00000000 | Null Segment |
|
||||
| 0x8 | 0x00000000 | 0xfffff | 0b1100 | 0b10011010 | Code Segment |
|
||||
| 0x10 | 0x00000000 | 0xfffff | 0b1100 | 0b10010010 | Data Segment |
|
||||
| 0x8 | 0x00000000 | 0xfffff | 0b1100 | 0b10011110 | Code Segment |
|
||||
| 0x10 | 0x00000000 | 0xfffff | 0b1100 | 0b10010110 | Data Segment |
|
||||
|
||||
## Known issues
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ int get_gdt(char* unused) {
|
|||
uint32_t base = entry.base_lower | entry.base_middle << 16 | entry.base_higher << 24;
|
||||
uint32_t limit = entry.limit_lower | (entry.flags_limit_higher & 0x0f) << 16;
|
||||
uint8_t flags = (entry.flags_limit_higher >> 4);
|
||||
bool is_data = ((entry.access_byte & 0b00001000) >> 3) == 0;
|
||||
|
||||
//terminal_writestring("\nEntry ");
|
||||
//terminal_writeint(entry_num, 10);
|
||||
|
@ -70,14 +71,39 @@ int get_gdt(char* unused) {
|
|||
terminal_writeint(entry.access_byte, 2);
|
||||
terminal_writestring(" (ring ");
|
||||
terminal_writeint((entry.access_byte & 0b01100000) >> 5, 10);
|
||||
terminal_writestring(", S = ");
|
||||
terminal_writeint((entry.access_byte & 0b00010000) >> 4, 2);
|
||||
terminal_writestring(", EX = ");
|
||||
terminal_writeint((entry.access_byte & 0b00001000) >> 3, 2);
|
||||
terminal_writestring(", DC = ");
|
||||
terminal_writeint((entry.access_byte & 0b00000100) >> 2, 2);
|
||||
terminal_writestring(", RW = ");
|
||||
terminal_writeint((entry.access_byte & 0b00000010) >> 1, 2);
|
||||
if ((entry.access_byte & 0b00010000) == 0) {
|
||||
terminal_writestring(", System");
|
||||
}
|
||||
if (is_data) {
|
||||
terminal_writestring(", Data");
|
||||
|
||||
if((entry.access_byte & 0b00000100) == 0) {
|
||||
terminal_writestring(" (growing up, ");
|
||||
} else {
|
||||
terminal_writestring(" (growing down, ");
|
||||
}
|
||||
|
||||
if((entry.access_byte & 0b00000010) == 0) {
|
||||
terminal_writestring("r--)");
|
||||
} else {
|
||||
terminal_writestring("rw-)");
|
||||
}
|
||||
} else {
|
||||
terminal_writestring(", Code");
|
||||
|
||||
if((entry.access_byte & 0b00000100) == 0) {
|
||||
terminal_writestring(" (non-conforming, ");
|
||||
} else {
|
||||
terminal_writestring(" (conforming, ");
|
||||
}
|
||||
|
||||
if((entry.access_byte & 0b00000010) == 0) {
|
||||
terminal_writestring("--x)");
|
||||
} else {
|
||||
terminal_writestring("r-x)");
|
||||
}
|
||||
}
|
||||
|
||||
terminal_writestring(")\n");
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue