diff options
author | Simponic <loganthebean222@gmail.com> | 2021-03-01 15:17:24 -0700 |
---|---|---|
committer | Simponic <loganthebean222@gmail.com> | 2021-03-01 15:17:24 -0700 |
commit | c0c846cc15bbc4a14f705eeb923ed1024f4ee1a0 (patch) | |
tree | 9556cbe258bc72d263c33dc4d9876d4fb72402dc /include | |
parent | 09d1dcf3b115658283cb09a08986271398e8d8f8 (diff) | |
download | simponicos-c0c846cc15bbc4a14f705eeb923ed1024f4ee1a0.tar.gz simponicos-c0c846cc15bbc4a14f705eeb923ed1024f4ee1a0.zip |
Move to GitHub for flexing
Diffstat (limited to 'include')
-rw-r--r-- | include/gdt.h | 4 | ||||
-rw-r--r-- | include/idt.h | 56 | ||||
-rw-r--r-- | include/isr.h | 13 | ||||
-rw-r--r-- | include/port.h | 11 | ||||
-rw-r--r-- | include/print.h | 5 |
5 files changed, 89 insertions, 0 deletions
diff --git a/include/gdt.h b/include/gdt.h index 8b239dd..51a7112 100644 --- a/include/gdt.h +++ b/include/gdt.h @@ -14,4 +14,8 @@ struct GDT_ptr { uint32_t base; } __attribute((packed)); +uint8_t gdt_entries[8 * 3]; // (8 bytes per entry) * (num entries) + +void encodeGDT(uint8_t* gdtEntry, struct GDT source); +void initializeGDT(); #endif //GDT_H diff --git a/include/idt.h b/include/idt.h new file mode 100644 index 0000000..c08cf75 --- /dev/null +++ b/include/idt.h @@ -0,0 +1,56 @@ +#ifndef IDT_H +#define IDT_H + +#include "types.h" + +struct IDT { + uint32_t base; + uint16_t selector; + uint8_t flags; +} __attribute__((packed)); + +struct IDT_ptr { + uint16_t limit; + uint32_t base; +} __attribute__((packed)); + +uint8_t idt_entries[8 * 256]; // 8 bytes per entry * 256 entries + +struct IDT createIDT(uint32_t base, uint16_t selector, uint8_t flags); +void encodeIDT(uint8_t* idtEntry, struct IDT source); +void initializeIDT(); + +extern void isr0 (); +extern void isr1 (); +extern void isr2 (); +extern void isr3 (); +extern void isr4 (); +extern void isr5 (); +extern void isr6 (); +extern void isr7 (); +extern void isr8 (); +extern void isr9 (); +extern void isr10(); +extern void isr11(); +extern void isr12(); +extern void isr13(); +extern void isr14(); +extern void isr15(); +extern void isr16(); +extern void isr17(); +extern void isr18(); +extern void isr19(); +extern void isr20(); +extern void isr21(); +extern void isr22(); +extern void isr23(); +extern void isr24(); +extern void isr25(); +extern void isr26(); +extern void isr27(); +extern void isr28(); +extern void isr29(); +extern void isr30(); +extern void isr31(); + +#endif // IDT_H diff --git a/include/isr.h b/include/isr.h new file mode 100644 index 0000000..831a2f4 --- /dev/null +++ b/include/isr.h @@ -0,0 +1,13 @@ +#ifndef ISR_H +#define ISR_H + +#include "types.h" + +struct registers{ + uint32_t ds; + uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; + uint32_t int_no, err_code; + uint32_t eip, cs, eflags, useresp, ss; +} __attribute__((packed)); + +#endif // ISR_H diff --git a/include/port.h b/include/port.h new file mode 100644 index 0000000..d3e6897 --- /dev/null +++ b/include/port.h @@ -0,0 +1,11 @@ +#ifndef PORT_H +#define PORT_H + +#include "types.h" + +uint8_t port_byte_in (uint8_t port); +void port_byte_out(uint8_t port, uint8_t data); +uint16_t port_word_in (uint16_t port); +void port_word_out(uint16_t port, uint16_t data); + +#endif // PORT_H diff --git a/include/print.h b/include/print.h index c46843c..421b1f0 100644 --- a/include/print.h +++ b/include/print.h @@ -11,9 +11,14 @@ typedef struct TextOutput { uint16_t* vid_mem; }__attribute__((packed)) TextOutput; +TextOutput monitor; + TextOutput createOutput(const int max_row, const int max_column, uint16_t* vid_mem); void scrollText(TextOutput* textOutput); void putChar(uint8_t character, uint8_t background, uint8_t foreground, TextOutput* textOutput); void print(char* string, uint8_t background, uint8_t foreground, TextOutput* textOutput); +char* itoa(int value, char* buffer, int base); +void printToMonitor(char* string); +void printIntToMonitor(int num, int base); #endif // PRINT_H |