Modestus Moon OS  R4
CS 450 project
tables.h
Go to the documentation of this file.
1 #ifndef _TABLES_H
2 #define _TABLES_H
3 
4 #include "system.h"
5 
6 typedef struct idt_entry_struct
7 {
8  u16int base_low; //offset bits 0..15
9  u16int sselect; //stack selector in gdt or ldt
10  u8int zero; //this stays zero; unused
11  u8int flags; //attributes
12  u16int base_high; //offset bits 16..31
13 }
14  __attribute__ ((packed)) idt_entry;
15 
16 typedef struct idt_struct
17 {
20 }
21  __attribute__ ((packed)) idt_descriptor;
22 
23 typedef struct gdt_descriptor_struct
24 {
27 }
28  __attribute__ ((packed)) gdt_descriptor;
29 
30 typedef struct gdt_entry_struct
31 {
32  u16int limit_low; //first 16 bits of limit
33  u16int base_low; //first 16 bits of base
34  u8int base_mid; //bits 16-23 of base
35  u8int access; //next 8 bits; access flags
36  u8int flags; //page granularity, size
37  u8int base_high; //last 8 bits of the base
38 }
39  __attribute__ ((packed)) gdt_entry;
40 
41 
42 void idt_set_gate(u8int idx, u32int base, u16int sel, u8int flags);
43 void gdt_init_entry(int idx, u32int base, u32int limit, u8int access,
44  u8int flags);
45 
46 void init_idt();
47 void init_gdt();
48 
49 #endif
u8int flags
Definition: tables.h:36
u32int base
Definition: tables.h:53
void init_gdt()
Definition: tables.c:75
unsigned char u8int
Definition: system.h:25
u16int base_low
Definition: tables.h:33
u16int limit
Definition: tables.h:52
u8int access
Definition: tables.h:35
u8int zero
Definition: tables.h:10
u32int base
Definition: tables.h:19
struct idt_entry_struct __attribute__((packed)) idt_entry
u8int base_high
Definition: tables.h:37
u16int base_low
Definition: tables.h:8
u8int access
Definition: tables.h:55
u16int sselect
Definition: tables.h:9
void idt_set_gate(u8int idx, u32int base, u16int sel, u8int flags)
Definition: tables.c:27
u16int base_high
Definition: tables.h:12
u8int base_mid
Definition: tables.h:34
u8int flags
Definition: tables.h:11
unsigned long u32int
Definition: system.h:27
Definition: tables.h:30
void gdt_init_entry(int idx, u32int base, u32int limit, u8int access, u8int flags)
Definition: tables.c:57
u16int limit_low
Definition: tables.h:32
void init_idt()
Definition: tables.c:43
unsigned short u16int
Definition: system.h:26
u16int limit
Definition: tables.h:18
Definition: tables.h:6