KernOS
AR Namespace Reference

Access right byte convention - part of descriptor entry. More...

Variables

const uint8_t NULL_ACCESS = 0x00
 
const uint8_t KERN_CS_ACCESS = 0x9A
 Kernel code segment access descriptor. More...
 
const uint8_t USER_CS_ACCESS = 0xFA
 User code segment access descriptor. More...
 
const uint8_t KERN_DS_ACCESS = 0x92
 Kernel data segment access descriptor. More...
 
const uint8_t USER_DS_ACCESS = 0xF2
 User data segment access descriptor. More...
 
const uint8_t INTERRUPT_ACCESS = 0x8E
 Interrupt access descriptor. More...
 

Detailed Description

Access right byte convention - part of descriptor entry.

See also
AMD64 Architecture Programmer's Manual Volume 2: System Programming (PDF) (Technical report). 2013. p. 80.
bit 40-47 of Osdev's descriptor

Access right byte is used to specify read/write/execute access. Its bit field definition varies depending on whether used as code/data segment descriptor, or interrupt gate descriptor

Generic access right byte (bit 8-15 of descriptor)
|15|14|13|12|11|10|09|08|
|P |DPL  | S|    Type   |

For Code segment descriptor
| bit | name       | description
|   8 | Accessed   | Set indicates descriptor is copied from GDT to CS register
|   9 | Readable   | Set indicates executable, and readable
|  10 | Conforming | Set indicates code segment as conforming
|  11 | Code/data  | Set indicates code segment
|  12 | S bit      | Set indicates code/data segment
|13-14| DPL        | aka. Ring level, value range 0-3
|  15 | Present    | Set indicates that segment referenced by descriptor is loaded in memory

For Data segment descriptor
| bit | name        | description
|   8 | Accessed    | Set indicates descriptor is copied from GDT to CS register
|   9 | Writable    | Set indicates readable, and writeable
|  10 | Expand-down | Set indicates data address expands down, like stack
|  11 | Code/data   | Clear indicates data segment
|  12 | S bit       | Set indicates code/data segment
|13-14| DPL         | aka. Ring level, value range 0-3
|  15 | Present     | Set indicates that segment referenced by descriptor is loaded in memory

For Interrupt gate segment descriptor
| bit | name       | description
| 8-11| Type       | 1110 indicates 32-bit interrupt gate type
|  12 | S bit      | Clear indicates system descriptor
|13-14| DPL        | aka. Ring level, value range 0-3
|  15 | Present    | Set indicates that segment referenced by descriptor is loaded in memory

Variable Documentation

◆ INTERRUPT_ACCESS

const uint8_t AR::INTERRUPT_ACCESS = 0x8E

Interrupt access descriptor.

|P|DP|S|Type|
|1|00|0|1110|
|   8  |  E |

Definition at line 95 of file accessright.h.

◆ KERN_CS_ACCESS

const uint8_t AR::KERN_CS_ACCESS = 0x9A

Kernel code segment access descriptor.

|P|DP|S|C|C|R|A|
|1|00|1|1|0|1|0|
|   9  |   A   |

Definition at line 59 of file accessright.h.

◆ KERN_DS_ACCESS

const uint8_t AR::KERN_DS_ACCESS = 0x92

Kernel data segment access descriptor.

|P|DP|S|C|E|W|A|
|1|00|1|0|0|1|0|
|   9  |   2   |

Definition at line 77 of file accessright.h.

◆ NULL_ACCESS

const uint8_t AR::NULL_ACCESS = 0x00

Definition at line 50 of file accessright.h.

◆ USER_CS_ACCESS

const uint8_t AR::USER_CS_ACCESS = 0xFA

User code segment access descriptor.

|P|DP|S|C|C|R|A|
|1|11|1|1|0|1|0|
|   F  |   A   |

Definition at line 68 of file accessright.h.

◆ USER_DS_ACCESS

const uint8_t AR::USER_DS_ACCESS = 0xF2

User data segment access descriptor.

|P|DP|S|C|E|W|A|
|1|11|1|0|0|1|0|
|   F  |   2   |

Definition at line 86 of file accessright.h.