diff options
Diffstat (limited to 'kernel/include')
| -rw-r--r-- | kernel/include/ext2.h | 1 | ||||
| -rw-r--r-- | kernel/include/font.h | 4 | ||||
| -rw-r--r-- | kernel/include/gdt.h | 40 | ||||
| -rw-r--r-- | kernel/include/keymap.h | 8 | ||||
| -rw-r--r-- | kernel/include/tss.h | 42 | ||||
| -rw-r--r-- | kernel/include/userspace.h | 7 |
6 files changed, 96 insertions, 6 deletions
diff --git a/kernel/include/ext2.h b/kernel/include/ext2.h index 1760fef..1acdb18 100644 --- a/kernel/include/ext2.h +++ b/kernel/include/ext2.h @@ -130,6 +130,7 @@ extern ext2_superblock_t* ext2_superblock; #define INODES_PER_BLOCK (BLOCK_SIZE / INODE_SIZE) +void ext2_init(void); void read_block(uint32_t block_num, void* block_ptr); void read_superblock(ext2_superblock_t* ext2_superblock); void read_bg_desc(uint32_t bg_desc, ext2_bg_desc_t* ext2_bg_desc); diff --git a/kernel/include/font.h b/kernel/include/font.h index f405a90..debaba9 100644 --- a/kernel/include/font.h +++ b/kernel/include/font.h @@ -19,7 +19,7 @@ typedef struct { /* font i used: /usr/share/kbd/consolefonts/lat9-16.psf.gz */ /* xxd -i font.psf */ -unsigned char font[] = { +const unsigned char font[] = { 0x72, 0xb5, 0x4a, 0x86, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc3, @@ -365,6 +365,6 @@ unsigned char font[] = { 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 }; -unsigned int font_len = 4128; +const uint32_t font_len = 4128; #endif diff --git a/kernel/include/gdt.h b/kernel/include/gdt.h new file mode 100644 index 0000000..4c84fe9 --- /dev/null +++ b/kernel/include/gdt.h @@ -0,0 +1,40 @@ +#ifndef GDT_H +#define GDT_H + +#include <types.h> + +struct gdt_seg_entry { + uint16_t limit; + uint16_t offset1; + uint8_t offset2; + uint8_t access; + uint8_t limitflags; + uint8_t offset3; +} __attribute__((packed)); +typedef struct gdt_seg_entry gdt_seg_entry; + +struct gdt_tss_entry { + uint16_t limit; + uint16_t offset1; + uint8_t offset2; + uint8_t access; + uint8_t limitflags; + uint8_t offset3; + uint32_t offset4; + uint32_t reserved; +} __attribute__((packed)); +typedef struct gdt_tss_entry gdt_tss_entry; + +struct gdt_p { + uint16_t size; + uint64_t offset; +} __attribute__((packed)); +typedef struct gdt_p gdt_p; + +void add_gdt_entry(uint32_t num, uint32_t offset, uint32_t limit, uint8_t access, uint8_t flags); +void add_gdt_tss(uint32_t num, uint64_t offset, uint32_t limit, uint8_t access, uint8_t flags); +void reload_gdt(void); +void load_gdt(gdt_p* pointer); +void init_gdt(void); + +#endif diff --git a/kernel/include/keymap.h b/kernel/include/keymap.h index c9b8697..62d6a96 100644 --- a/kernel/include/keymap.h +++ b/kernel/include/keymap.h @@ -89,7 +89,7 @@ #define KEY_F11 0x57 #define KEY_F12 0x58 -char keymap[] = { +const char keymap[] = { ' ', ' ', '1', @@ -220,9 +220,9 @@ char keymap[] = { ' ', }; -uint16_t keymap_len = 128; +const uint16_t keymap_len = 128; -char shift_keymap[] = { +const char shift_keymap[] = { ' ', ' ', '!', @@ -353,6 +353,6 @@ char shift_keymap[] = { ' ', }; -uint16_t shift_keymap_len = 128; +const uint16_t shift_keymap_len = 128; #endif diff --git a/kernel/include/tss.h b/kernel/include/tss.h new file mode 100644 index 0000000..f1af6d6 --- /dev/null +++ b/kernel/include/tss.h @@ -0,0 +1,42 @@ +#ifndef TSS_H +#define TSS_H + +#include <types.h> + +struct tss_type { + uint32_t reserved1; + uint32_t rsp0_low; + uint32_t rsp0_high; + uint32_t rsp1_low; + uint32_t rsp1_high; + uint32_t rsp2_low; + uint32_t rsp2_high; + uint32_t reserved2; + uint32_t reserved3; + uint32_t ist1_low; + uint32_t ist1_high; + uint32_t ist2_low; + uint32_t ist2_high; + uint32_t ist3_low; + uint32_t ist3_high; + uint32_t ist4_low; + uint32_t ist4_high; + uint32_t ist5_low; + uint32_t ist5_high; + uint32_t ist6_low; + uint32_t ist6_high; + uint32_t ist7_low; + uint32_t ist7_high; + uint32_t reserved4; + uint32_t reserved5; + uint16_t reserved6; + uint16_t iopb; +} __attribute__((packed, aligned(4096))); +typedef struct tss_type tss_type; + +extern tss_type tss; + +void load_tss(void); +void init_tss(void); + +#endif diff --git a/kernel/include/userspace.h b/kernel/include/userspace.h new file mode 100644 index 0000000..e03695d --- /dev/null +++ b/kernel/include/userspace.h @@ -0,0 +1,7 @@ +#ifndef USERSPACE_H +#define USERSPACE_H + +void begin_userspace(void); +void jump_userspace(void); + +#endif |
