Upload files to "include"

This commit is contained in:
2025-05-20 20:39:37 -05:00
parent 1736fe6590
commit 4c7550b75b
4 changed files with 78 additions and 0 deletions

23
include/gdt.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef _GDT_H
#define _GDT_H
#include <stdint.h>
struct gdt_entry {
uint16_t limit_low; /* Lower 16 bits of limit */
uint16_t base_low; /* Lower 16 bits of base */
uint8_t base_middle; /* Next 8 bits of base */
uint8_t access; /* Access flags */
uint8_t granularity; /* Granularity + high 4 bits of limit */
uint8_t base_high; /* Last 8 bits of base */
} __attribute__((packed));
struct gdt_ptr {
uint16_t limit; /* Size of GDT - 1 */
uint32_t base; /* Base address of GDT */
} __attribute__((packed));
void gdt_install();
void gdt_set_entry(int num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran);
#endif

24
include/idt.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef _IDT_H
#define _IDT_H
#include <stdint.h>
struct idt_entry {
uint16_t base_low;
uint16_t sel; /* Kernel segment selector */
uint8_t always0; /* Always 0 */
uint8_t flags; /* Type and attributes */
uint16_t base_high;
} __attribute__((packed));
struct idt_ptr {
uint16_t limit;
uint32_t base;
} __attribute__((packed));
void idt_install(void);
void idt_install_isrs(void);
void idt_install_syscall(void);
void idt_set_entry(int num, uint32_t base, uint16_t sel, uint8_t flags);
#endif

16
include/io.h Normal file
View File

@ -0,0 +1,16 @@
/* Defines a abstract base for I/O in the Espresso kernel. */
#ifndef ESPRESSO_IO_H
#define ESPRESSO_IO_H
#include <stdint.h>
#include <text_display.h>
void print(const char* str);
char* input(uint8_t dev=0);
void writefile(uint8_t mode, char* file, char* data);
char* readfile(char* file);
#endif

15
include/isr.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef _ISR_H
#define _ISR_H
#include <stdint.h>
typedef struct {
uint32_t ds, edi, esi, ebp, esp, ebx, edx, ecx, eax;
uint32_t int_no, err_code;
uint32_t eip, cs, eflags, useresp, ss;
} regs_t;
void isr_handler(regs_t *r);
void syscall_handler(regs_t *r);
#endif