diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-13 13:10:49 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-13 13:10:49 +0000 |
| commit | 43c10da9cf77bb7676db3733499c1b578826dca9 (patch) | |
| tree | 5bee04f8dcc5c9feaf2b85b6cac382075268e14f /kc/core/cpu/descriptor.h | |
| parent | c1d179d50751d0ce08dc2b009fc5e334d20db11a (diff) | |
splitting out descriptor declarations
Diffstat (limited to 'kc/core/cpu/descriptor.h')
| -rw-r--r-- | kc/core/cpu/descriptor.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/kc/core/cpu/descriptor.h b/kc/core/cpu/descriptor.h new file mode 100644 index 0000000..802c09c --- /dev/null +++ b/kc/core/cpu/descriptor.h @@ -0,0 +1,55 @@ +#pragma once + +struct dtr64 +{ + uint16_t limit; + uint64_t base; +} __attribute__((packed)); + +struct segment_descriptor +{ + uint16_t limit0; + uint16_t base0; + uint8_t base16; + uint8_t access; + uint8_t flags_limit16; + uint8_t base24; +} __attribute__((packed)); + +enum segment_descriptor_type +{ + CODE64_SUPER_SEG, + CODE64_USER_SEG, + DATA_SEG, + TASK64_SEG, +}; + +struct gate_descriptor +{ + uint16_t offset0; + uint16_t selector; + uint8_t ist; + uint8_t access; + uint16_t offset16; + uint64_t offset32; +} __attribute__((packed)); + +enum gate_descriptor_type +{ + EMPTY_GATE, + INT64_GATE, + TRAP64_GATE, +}; + +struct task64_segment +{ + uint32_t reserved0; + uint64_t rsp0; + uint64_t rsp1; + uint64_t rsp2; + uint64_t reserved1; + uint64_t ist[7]; + uint16_t reserved2; + uint16_t iomap_base; +}; + |
